From 04bd38fdaf4cb63e05cfeb4413d6188f0e809be7 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 21 Sep 2023 08:31:02 +0000 Subject: [PATCH 1/8] Update Generator Version 3.0.0-alpha.20230921.2 --- eng/Packages.Data.props | 2 +- eng/emitter-package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index 7739deaf8a60..7decdd6ccef1 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -174,7 +174,7 @@ All should have PrivateAssets="All" set so they don't become package dependencies --> - + diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 67ed00021dae..688097b90445 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,6 +1,6 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-csharp": "0.2.0-beta.20230920.1" + "@azure-tools/typespec-csharp": "0.2.0-alpha.20230921.2" } } From b6c575847537244040cc7a2f97995ae80a388518 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 21 Sep 2023 08:40:57 +0000 Subject: [PATCH 2/8] Update SDK codes --- ...bridContainerServiceAgentPoolCollection.cs | 43 +++++ ...ontainerServiceVirtualNetworkCollection.cs | 42 +++++ ...Sample_HybridIdentityMetadataCollection.cs | 43 +++++ .../Sample_ProvisionedClusterCollection.cs | 42 +++++ .../Samples/Sample_StorageSpaceCollection.cs | 42 +++++ ...bridContainerServiceAgentPoolCollection.cs | 74 ++++++++ ...ontainerServiceVirtualNetworkCollection.cs | 74 ++++++++ .../HybridIdentityMetadataCollection.cs | 74 ++++++++ .../Generated/ProvisionedClusterCollection.cs | 74 ++++++++ .../src/Generated/StorageSpaceCollection.cs | 74 ++++++++ .../Sample_HybridComputeMachineCollection.cs | 42 +++++ ...HybridComputeMachineExtensionCollection.cs | 43 +++++ ...putePrivateEndpointConnectionCollection.cs | 43 +++++ ...ridComputePrivateLinkResourceCollection.cs | 44 +++++ ...HybridComputePrivateLinkScopeCollection.cs | 42 +++++ .../HybridComputeMachineCollection.cs | 76 ++++++++ ...HybridComputeMachineExtensionCollection.cs | 74 ++++++++ ...putePrivateEndpointConnectionCollection.cs | 74 ++++++++ ...ridComputePrivateLinkResourceCollection.cs | 74 ++++++++ ...HybridComputePrivateLinkScopeCollection.cs | 74 ++++++++ .../Sample_EndpointResourceCollection.cs | 80 ++++++++ .../Generated/EndpointResourceCollection.cs | 72 ++++++++ .../Sample_ConnectedClusterCollection.cs | 42 +++++ .../Generated/ConnectedClusterCollection.cs | 74 ++++++++ .../Samples/Sample_FirmwareCollection.cs | 86 +++++++++ .../Sample_FirmwareWorkspaceCollection.cs | 84 +++++++++ .../src/Generated/FirmwareCollection.cs | 74 ++++++++ .../Generated/FirmwareWorkspaceCollection.cs | 74 ++++++++ .../Samples/Sample_IotCentralAppCollection.cs | 42 +++++ ...tralPrivateEndpointConnectionCollection.cs | 43 +++++ ...IotCentralPrivateLinkResourceCollection.cs | 44 +++++ .../src/Generated/IotCentralAppCollection.cs | 74 ++++++++ ...tralPrivateEndpointConnectionCollection.cs | 74 ++++++++ ...IotCentralPrivateLinkResourceCollection.cs | 74 ++++++++ ...ple_EventHubConsumerGroupInfoCollection.cs | 44 +++++ ..._IotHubCertificateDescriptionCollection.cs | 43 +++++ .../Sample_IotHubDescriptionCollection.cs | 42 +++++ ...tHubPrivateEndpointConnectionCollection.cs | 43 +++++ ...ivateEndpointGroupInformationCollection.cs | 44 +++++ .../EventHubConsumerGroupInfoCollection.cs | 74 ++++++++ .../IotHubCertificateDescriptionCollection.cs | 74 ++++++++ .../Generated/IotHubDescriptionCollection.cs | 74 ++++++++ ...tHubPrivateEndpointConnectionCollection.cs | 74 ++++++++ ...ivateEndpointGroupInformationCollection.cs | 74 ++++++++ .../Sample_DeletedKeyVaultCollection.cs | 43 +++++ .../Sample_DeletedManagedHsmCollection.cs | 43 +++++ .../Samples/Sample_KeyVaultCollection.cs | 42 +++++ ...aultPrivateEndpointConnectionCollection.cs | 43 +++++ .../Sample_KeyVaultSecretCollection.cs | 43 +++++ .../Samples/Sample_ManagedHsmCollection.cs | 42 +++++ ...dHsmPrivateEndpointConnectionCollection.cs | 43 +++++ .../Generated/DeletedKeyVaultCollection.cs | 76 ++++++++ .../Generated/DeletedManagedHsmCollection.cs | 76 ++++++++ .../src/Generated/KeyVaultCollection.cs | 74 ++++++++ ...aultPrivateEndpointConnectionCollection.cs | 74 ++++++++ .../src/Generated/KeyVaultSecretCollection.cs | 74 ++++++++ .../src/Generated/ManagedHsmCollection.cs | 74 ++++++++ ...dHsmPrivateEndpointConnectionCollection.cs | 74 ++++++++ ...le_KubernetesClusterExtensionCollection.cs | 90 +++++++++ ...e_KubernetesFluxConfigurationCollection.cs | 45 +++++ ...tesSourceControlConfigurationCollection.cs | 45 +++++ .../KubernetesClusterExtensionCollection.cs | 74 ++++++++ .../KubernetesFluxConfigurationCollection.cs | 74 ++++++++ ...tesSourceControlConfigurationCollection.cs | 74 ++++++++ ...AttachedDatabaseConfigurationCollection.cs | 43 +++++ .../Samples/Sample_KustoClusterCollection.cs | 42 +++++ ...stoClusterPrincipalAssignmentCollection.cs | 43 +++++ .../Sample_KustoDataConnectionCollection.cs | 132 ++++++++++++++ .../Samples/Sample_KustoDatabaseCollection.cs | 86 +++++++++ ...toDatabasePrincipalAssignmentCollection.cs | 44 +++++ ...e_KustoManagedPrivateEndpointCollection.cs | 43 +++++ ...ustoPrivateEndpointConnectionCollection.cs | 43 +++++ ...mple_KustoPrivateLinkResourceCollection.cs | 44 +++++ .../Samples/Sample_KustoScriptCollection.cs | 44 +++++ ...AttachedDatabaseConfigurationCollection.cs | 74 ++++++++ .../src/Generated/KustoClusterCollection.cs | 74 ++++++++ ...stoClusterPrincipalAssignmentCollection.cs | 74 ++++++++ .../KustoDataConnectionCollection.cs | 74 ++++++++ .../src/Generated/KustoDatabaseCollection.cs | 74 ++++++++ ...toDatabasePrincipalAssignmentCollection.cs | 74 ++++++++ .../KustoManagedPrivateEndpointCollection.cs | 74 ++++++++ ...ustoPrivateEndpointConnectionCollection.cs | 74 ++++++++ .../KustoPrivateLinkResourceCollection.cs | 74 ++++++++ .../src/Generated/KustoScriptCollection.cs | 74 ++++++++ .../Generated/Samples/Sample_LabCollection.cs | 42 +++++ .../Samples/Sample_LabPlanCollection.cs | 42 +++++ .../Sample_LabServicesScheduleCollection.cs | 43 +++++ .../Samples/Sample_LabUserCollection.cs | 43 +++++ .../Sample_LabVirtualMachineCollection.cs | 44 +++++ ...Sample_LabVirtualMachineImageCollection.cs | 43 +++++ .../src/Generated/LabCollection.cs | 74 ++++++++ .../src/Generated/LabPlanCollection.cs | 74 ++++++++ .../LabServicesScheduleCollection.cs | 74 ++++++++ .../src/Generated/LabUserCollection.cs | 74 ++++++++ .../Generated/LabVirtualMachineCollection.cs | 74 ++++++++ .../LabVirtualMachineImageCollection.cs | 74 ++++++++ .../Sample_LoadTestingQuotaCollection.cs | 43 +++++ .../Sample_LoadTestingResourceCollection.cs | 42 +++++ .../Generated/LoadTestingQuotaCollection.cs | 74 ++++++++ .../LoadTestingResourceCollection.cs | 74 ++++++++ ...e_IntegrationAccountAgreementCollection.cs | 43 +++++ ...tionAccountAssemblyDefinitionCollection.cs | 43 +++++ ...tionAccountBatchConfigurationCollection.cs | 43 +++++ ...IntegrationAccountCertificateCollection.cs | 43 +++++ .../Sample_IntegrationAccountCollection.cs | 42 +++++ .../Sample_IntegrationAccountMapCollection.cs | 43 +++++ ...ple_IntegrationAccountPartnerCollection.cs | 43 +++++ ...mple_IntegrationAccountSchemaCollection.cs | 43 +++++ ...ple_IntegrationAccountSessionCollection.cs | 43 +++++ ...IntegrationServiceEnvironmentCollection.cs | 42 +++++ ...nServiceEnvironmentManagedApiCollection.cs | 43 +++++ .../Samples/Sample_LogicWorkflowCollection.cs | 42 +++++ ...Sample_LogicWorkflowRunActionCollection.cs | 45 +++++ ...icWorkflowRunActionRepetitionCollection.cs | 46 +++++ ...ctionRepetitionRequestHistoryCollection.cs | 47 +++++ ...rkflowRunActionRequestHistoryCollection.cs | 46 +++++ ...kflowRunActionScopeRepetitionCollection.cs | 46 +++++ .../Sample_LogicWorkflowRunCollection.cs | 44 +++++ ...ple_LogicWorkflowRunOperationCollection.cs | 45 +++++ .../Sample_LogicWorkflowTriggerCollection.cs | 44 +++++ ...e_LogicWorkflowTriggerHistoryCollection.cs | 45 +++++ .../Sample_LogicWorkflowVersionCollection.cs | 44 +++++ .../IntegrationAccountAgreementCollection.cs | 74 ++++++++ ...tionAccountAssemblyDefinitionCollection.cs | 74 ++++++++ ...tionAccountBatchConfigurationCollection.cs | 74 ++++++++ ...IntegrationAccountCertificateCollection.cs | 74 ++++++++ .../Generated/IntegrationAccountCollection.cs | 74 ++++++++ .../IntegrationAccountMapCollection.cs | 74 ++++++++ .../IntegrationAccountPartnerCollection.cs | 74 ++++++++ .../IntegrationAccountSchemaCollection.cs | 74 ++++++++ .../IntegrationAccountSessionCollection.cs | 74 ++++++++ ...IntegrationServiceEnvironmentCollection.cs | 74 ++++++++ ...nServiceEnvironmentManagedApiCollection.cs | 74 ++++++++ .../src/Generated/LogicWorkflowCollection.cs | 74 ++++++++ .../LogicWorkflowRunActionCollection.cs | 74 ++++++++ ...icWorkflowRunActionRepetitionCollection.cs | 74 ++++++++ ...ctionRepetitionRequestHistoryCollection.cs | 74 ++++++++ ...rkflowRunActionRequestHistoryCollection.cs | 74 ++++++++ ...kflowRunActionScopeRepetitionCollection.cs | 74 ++++++++ .../Generated/LogicWorkflowRunCollection.cs | 74 ++++++++ .../LogicWorkflowRunOperationCollection.cs | 74 ++++++++ .../LogicWorkflowTriggerCollection.cs | 74 ++++++++ .../LogicWorkflowTriggerHistoryCollection.cs | 74 ++++++++ .../LogicWorkflowVersionCollection.cs | 74 ++++++++ ...ple_OperationalizationClusterCollection.cs | 42 +++++ .../OperationalizationClusterCollection.cs | 74 ++++++++ ...achineLearningBatchDeploymentCollection.cs | 44 +++++ ..._MachineLearningBatchEndpointCollection.cs | 43 +++++ ..._MachineLearningCodeContainerCollection.cs | 43 +++++ ...le_MachineLearningCodeVersionCollection.cs | 44 +++++ ...ineLearningComponentContainerCollection.cs | 43 +++++ ...chineLearningComponentVersionCollection.cs | 44 +++++ ...Sample_MachineLearningComputeCollection.cs | 172 ++++++++++++++++++ ..._MachineLearningDataContainerCollection.cs | 43 +++++ ...le_MachineLearningDataVersionCollection.cs | 44 +++++ ...mple_MachineLearningDatastoreCollection.cs | 43 +++++ ...eLearningEnvironmentContainerCollection.cs | 43 +++++ ...ineLearningEnvironmentVersionCollection.cs | 44 +++++ .../Sample_MachineLearningJobCollection.cs | 172 ++++++++++++++++++ ...MachineLearningModelContainerCollection.cs | 43 +++++ ...e_MachineLearningModelVersionCollection.cs | 44 +++++ ...chineLearningOnlineDeploymentCollection.cs | 88 +++++++++ ...MachineLearningOnlineEndpointCollection.cs | 43 +++++ ...ningPrivateEndpointConnectionCollection.cs | 43 +++++ ...ample_MachineLearningScheduleCollection.cs | 43 +++++ ...mple_MachineLearningWorkspaceCollection.cs | 42 +++++ ...neLearningWorkspaceConnectionCollection.cs | 43 +++++ ...achineLearningBatchDeploymentCollection.cs | 74 ++++++++ .../MachineLearningBatchEndpointCollection.cs | 74 ++++++++ .../MachineLearningCodeContainerCollection.cs | 74 ++++++++ .../MachineLearningCodeVersionCollection.cs | 74 ++++++++ ...ineLearningComponentContainerCollection.cs | 74 ++++++++ ...chineLearningComponentVersionCollection.cs | 74 ++++++++ .../MachineLearningComputeCollection.cs | 74 ++++++++ .../MachineLearningDataContainerCollection.cs | 74 ++++++++ .../MachineLearningDataVersionCollection.cs | 74 ++++++++ .../MachineLearningDatastoreCollection.cs | 74 ++++++++ ...eLearningEnvironmentContainerCollection.cs | 74 ++++++++ ...ineLearningEnvironmentVersionCollection.cs | 74 ++++++++ .../Generated/MachineLearningJobCollection.cs | 74 ++++++++ ...MachineLearningModelContainerCollection.cs | 74 ++++++++ .../MachineLearningModelVersionCollection.cs | 74 ++++++++ ...chineLearningOnlineDeploymentCollection.cs | 74 ++++++++ ...MachineLearningOnlineEndpointCollection.cs | 74 ++++++++ ...ningPrivateEndpointConnectionCollection.cs | 74 ++++++++ .../MachineLearningScheduleCollection.cs | 74 ++++++++ .../MachineLearningWorkspaceCollection.cs | 74 ++++++++ ...neLearningWorkspaceConnectionCollection.cs | 74 ++++++++ ...Sample_MaintenanceApplyUpdateCollection.cs | 46 +++++ ...mple_MaintenanceConfigurationCollection.cs | 126 +++++++++++++ ...aintenancePublicConfigurationCollection.cs | 42 +++++ .../MaintenanceApplyUpdateCollection.cs | 86 +++++++++ .../MaintenanceConfigurationCollection.cs | 74 ++++++++ ...aintenancePublicConfigurationCollection.cs | 74 ++++++++ .../Sample_ManagedNetworkCollection.cs | 42 +++++ .../Sample_ManagedNetworkGroupCollection.cs | 43 +++++ ...e_ManagedNetworkPeeringPolicyCollection.cs | 43 +++++ .../Sample_ScopeAssignmentCollection.cs | 40 ++++ .../src/Generated/ManagedNetworkCollection.cs | 74 ++++++++ .../ManagedNetworkGroupCollection.cs | 74 ++++++++ .../ManagedNetworkPeeringPolicyCollection.cs | 74 ++++++++ .../Generated/ScopeAssignmentCollection.cs | 74 ++++++++ .../Samples/Sample_NetworkDeviceCollection.cs | 42 +++++ ...Sample_NetworkDeviceInterfaceCollection.cs | 43 +++++ .../Sample_NetworkDeviceSkuCollection.cs | 42 +++++ ...etworkFabricAccessControlListCollection.cs | 42 +++++ .../Samples/Sample_NetworkFabricCollection.cs | 42 +++++ ...ample_NetworkFabricControllerCollection.cs | 42 +++++ ..._NetworkFabricExternalNetworkCollection.cs | 43 +++++ ...mple_NetworkFabricIPCommunityCollection.cs | 42 +++++ ...workFabricIPExtendedCommunityCollection.cs | 42 +++++ .../Sample_NetworkFabricIPPrefixCollection.cs | 42 +++++ ..._NetworkFabricInternalNetworkCollection.cs | 43 +++++ ..._NetworkFabricInternetGatewayCollection.cs | 43 +++++ ...workFabricInternetGatewayRuleCollection.cs | 42 +++++ ...etworkFabricL2IsolationDomainCollection.cs | 42 +++++ ...etworkFabricL3IsolationDomainCollection.cs | 42 +++++ ...le_NetworkFabricNeighborGroupCollection.cs | 42 +++++ ...mple_NetworkFabricRoutePolicyCollection.cs | 42 +++++ .../Sample_NetworkFabricSkuCollection.cs | 42 +++++ .../Sample_NetworkPacketBrokerCollection.cs | 42 +++++ .../Samples/Sample_NetworkRackCollection.cs | 42 +++++ .../Samples/Sample_NetworkTapCollection.cs | 42 +++++ .../Sample_NetworkTapRuleCollection.cs | 42 +++++ ..._NetworkToNetworkInterconnectCollection.cs | 43 +++++ .../src/Generated/NetworkDeviceCollection.cs | 74 ++++++++ .../NetworkDeviceInterfaceCollection.cs | 74 ++++++++ .../Generated/NetworkDeviceSkuCollection.cs | 74 ++++++++ ...etworkFabricAccessControlListCollection.cs | 74 ++++++++ .../src/Generated/NetworkFabricCollection.cs | 74 ++++++++ .../NetworkFabricControllerCollection.cs | 74 ++++++++ .../NetworkFabricExternalNetworkCollection.cs | 74 ++++++++ .../NetworkFabricIPCommunityCollection.cs | 74 ++++++++ ...workFabricIPExtendedCommunityCollection.cs | 74 ++++++++ .../NetworkFabricIPPrefixCollection.cs | 74 ++++++++ .../NetworkFabricInternalNetworkCollection.cs | 74 ++++++++ .../NetworkFabricInternetGatewayCollection.cs | 74 ++++++++ ...workFabricInternetGatewayRuleCollection.cs | 74 ++++++++ ...etworkFabricL2IsolationDomainCollection.cs | 74 ++++++++ ...etworkFabricL3IsolationDomainCollection.cs | 74 ++++++++ .../NetworkFabricNeighborGroupCollection.cs | 74 ++++++++ .../NetworkFabricRoutePolicyCollection.cs | 74 ++++++++ .../Generated/NetworkFabricSkuCollection.cs | 74 ++++++++ .../NetworkPacketBrokerCollection.cs | 74 ++++++++ .../src/Generated/NetworkRackCollection.cs | 74 ++++++++ .../src/Generated/NetworkTapCollection.cs | 74 ++++++++ .../src/Generated/NetworkTapRuleCollection.cs | 74 ++++++++ .../NetworkToNetworkInterconnectCollection.cs | 74 ++++++++ ...e_FederatedIdentityCredentialCollection.cs | 43 +++++ .../Sample_UserAssignedIdentityCollection.cs | 42 +++++ .../FederatedIdentityCredentialCollection.cs | 74 ++++++++ .../UserAssignedIdentityCollection.cs | 74 ++++++++ ...rvicesMarketplaceRegistrationCollection.cs | 41 +++++ ...ervicesRegistrationAssignmentCollection.cs | 40 ++++ ...e_ManagedServicesRegistrationCollection.cs | 40 ++++ ...rvicesMarketplaceRegistrationCollection.cs | 74 ++++++++ ...ervicesRegistrationAssignmentCollection.cs | 76 ++++++++ .../ManagedServicesRegistrationCollection.cs | 74 ++++++++ .../Sample_PartnerResponseCollection.cs | 39 ++++ .../Generated/PartnerResponseCollection.cs | 74 ++++++++ .../Samples/Sample_MapsAccountCollection.cs | 42 +++++ .../Samples/Sample_MapsCreatorCollection.cs | 43 +++++ .../src/Generated/MapsAccountCollection.cs | 74 ++++++++ .../src/Generated/MapsCreatorCollection.cs | 74 ++++++++ ...rketplaceAdminApprovalRequestCollection.cs | 42 +++++ ...le_MarketplaceApprovalRequestCollection.cs | 41 +++++ .../Samples/Sample_PrivateStoreCollection.cs | 39 ++++ ...le_PrivateStoreCollectionInfoCollection.cs | 41 +++++ .../Sample_PrivateStoreOfferCollection.cs | 42 +++++ ...rketplaceAdminApprovalRequestCollection.cs | 78 ++++++++ .../MarketplaceApprovalRequestCollection.cs | 74 ++++++++ .../src/Generated/PrivateStoreCollection.cs | 66 +++++++ .../PrivateStoreCollectionInfoCollection.cs | 66 +++++++ .../Generated/PrivateStoreOfferCollection.cs | 74 ++++++++ .../Sample_MarketplaceAgreementCollection.cs | 44 +++++ ...mple_MarketplaceAgreementTermCollection.cs | 44 +++++ .../MarketplaceAgreementTermCollection.cs | 84 +++++++++ .../Sample_ContentKeyPolicyCollection.cs | 43 +++++ .../Samples/Sample_MediaAssetCollection.cs | 43 +++++ .../Sample_MediaAssetFilterCollection.cs | 44 +++++ .../Sample_MediaAssetTrackCollection.cs | 44 +++++ .../Samples/Sample_MediaJobCollection.cs | 44 +++++ .../Sample_MediaLiveEventCollection.cs | 43 +++++ .../Sample_MediaLiveOutputCollection.cs | 44 +++++ .../Sample_MediaServicesAccountCollection.cs | 42 +++++ ...le_MediaServicesAccountFilterCollection.cs | 43 +++++ ...icesPrivateEndpointConnectionCollection.cs | 43 +++++ ...iaServicesPrivateLinkResourceCollection.cs | 44 +++++ .../Sample_MediaTransformCollection.cs | 43 +++++ .../Sample_StreamingEndpointCollection.cs | 43 +++++ .../Sample_StreamingLocatorCollection.cs | 43 +++++ .../Sample_StreamingPolicyCollection.cs | 43 +++++ .../Generated/ContentKeyPolicyCollection.cs | 74 ++++++++ .../src/Generated/MediaAssetCollection.cs | 74 ++++++++ .../Generated/MediaAssetFilterCollection.cs | 74 ++++++++ .../Generated/MediaAssetTrackCollection.cs | 74 ++++++++ .../src/Generated/MediaJobCollection.cs | 74 ++++++++ .../src/Generated/MediaLiveEventCollection.cs | 74 ++++++++ .../Generated/MediaLiveOutputCollection.cs | 74 ++++++++ .../MediaServicesAccountCollection.cs | 74 ++++++++ .../MediaServicesAccountFilterCollection.cs | 74 ++++++++ ...icesPrivateEndpointConnectionCollection.cs | 74 ++++++++ ...iaServicesPrivateLinkResourceCollection.cs | 74 ++++++++ .../src/Generated/MediaTransformCollection.cs | 74 ++++++++ .../Generated/StreamingEndpointCollection.cs | 74 ++++++++ .../Generated/StreamingLocatorCollection.cs | 74 ++++++++ .../Generated/StreamingPolicyCollection.cs | 74 ++++++++ 307 files changed, 18629 insertions(+) diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridContainerServiceAgentPoolCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridContainerServiceAgentPoolCollection.cs index ab30fd3cb9cc..b5e05eb344a2 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridContainerServiceAgentPoolCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridContainerServiceAgentPoolCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAgentPool() Console.WriteLine($"Succeeded: {result}"); } + // GetAgentPool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAgentPool() + { + // Generated from example definition: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetAgentPool.json + // this example is just showing the usage of "agentPool_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 ProvisionedClusterResource created on azure + // for more information of creating ProvisionedClusterResource, please refer to the document of ProvisionedClusterResource + string subscriptionId = "a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b"; + string resourceGroupName = "test-arcappliance-resgrp"; + string resourceName = "test-hybridakscluster"; + ResourceIdentifier provisionedClusterResourceId = ProvisionedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ProvisionedClusterResource provisionedCluster = client.GetProvisionedClusterResource(provisionedClusterResourceId); + + // get the collection of this HybridContainerServiceAgentPoolResource + HybridContainerServiceAgentPoolCollection collection = provisionedCluster.GetHybridContainerServiceAgentPools(); + + // invoke the operation + string agentPoolName = "test-hybridaksnodepool"; + NullableResponse response = await collection.GetIfExistsAsync(agentPoolName); + HybridContainerServiceAgentPoolResource 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 + HybridContainerServiceAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutAgentPool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridContainerServiceVirtualNetworkCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridContainerServiceVirtualNetworkCollection.cs index ab93c188b3df..130af40cf991 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridContainerServiceVirtualNetworkCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridContainerServiceVirtualNetworkCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetVirtualNetwork() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualNetwork + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetwork() + { + // Generated from example definition: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetVirtualNetwork.json + // this example is just showing the usage of "virtualNetworks_Retrieve" 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 = "a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b"; + string resourceGroupName = "test-arcappliance-resgrp"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HybridContainerServiceVirtualNetworkResource + HybridContainerServiceVirtualNetworkCollection collection = resourceGroupResource.GetHybridContainerServiceVirtualNetworks(); + + // invoke the operation + string virtualNetworksName = "test-vnet-static"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworksName); + HybridContainerServiceVirtualNetworkResource 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 + HybridContainerServiceVirtualNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutVirtualNetwork [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridIdentityMetadataCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridIdentityMetadataCollection.cs index 2fa71d34df0b..589a4ccbdc70 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridIdentityMetadataCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_HybridIdentityMetadataCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_GetHybridIdentityMetadata() Console.WriteLine($"Succeeded: {result}"); } + // GetHybridIdentityMetadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetHybridIdentityMetadata() + { + // Generated from example definition: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetHybridIdentityMetadata.json + // this example is just showing the usage of "HybridIdentityMetadata_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 ProvisionedClusterResource created on azure + // for more information of creating ProvisionedClusterResource, please refer to the document of ProvisionedClusterResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + string resourceName = "ContosoTargetCluster"; + ResourceIdentifier provisionedClusterResourceId = ProvisionedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ProvisionedClusterResource provisionedCluster = client.GetProvisionedClusterResource(provisionedClusterResourceId); + + // get the collection of this HybridIdentityMetadataResource + HybridIdentityMetadataCollection collection = provisionedCluster.GetAllHybridIdentityMetadata(); + + // invoke the operation + string hybridIdentityMetadataResourceName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(hybridIdentityMetadataResourceName); + HybridIdentityMetadataResource 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 + HybridIdentityMetadataData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HybridIdentityMetadataListByCluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_ProvisionedClusterCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_ProvisionedClusterCollection.cs index 273184641d5a..2e961bdc1b85 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_ProvisionedClusterCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_ProvisionedClusterCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetProvisionedCluster() Console.WriteLine($"Succeeded: {result}"); } + // GetProvisionedCluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetProvisionedCluster() + { + // Generated from example definition: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetProvisionedCluster.json + // this example is just showing the usage of "ProvisionedClusters_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 = "a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b"; + string resourceGroupName = "test-arcappliance-resgrp"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ProvisionedClusterResource + ProvisionedClusterCollection collection = resourceGroupResource.GetProvisionedClusters(); + + // invoke the operation + string resourceName = "test-hybridakscluster"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + ProvisionedClusterResource 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 + ProvisionedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutProvisionedCluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_StorageSpaceCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_StorageSpaceCollection.cs index 5d84ee81a6ee..4c03ad475c66 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_StorageSpaceCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/samples/Generated/Samples/Sample_StorageSpaceCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetStorageSpace() Console.WriteLine($"Succeeded: {result}"); } + // GetStorageSpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetStorageSpace() + { + // Generated from example definition: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetStorageSpace.json + // this example is just showing the usage of "storageSpaces_Retrieve" 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 = "a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b"; + string resourceGroupName = "test-arcappliance-resgrp"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageSpaceResource + StorageSpaceCollection collection = resourceGroupResource.GetStorageSpaces(); + + // invoke the operation + string storageSpacesName = "test-storage"; + NullableResponse response = await collection.GetIfExistsAsync(storageSpacesName); + StorageSpaceResource 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 + StorageSpaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutStorageSpace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceAgentPoolCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceAgentPoolCollection.cs index f0294ec82c65..19833096cd06 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceAgentPoolCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceAgentPoolCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string agentPoolName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// agentPool_Get + /// + /// + /// + /// Parameter for the name of the agent pool in the provisioned cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _hybridContainerServiceAgentPoolagentPoolClientDiagnostics.CreateScope("HybridContainerServiceAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridContainerServiceAgentPoolagentPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridContainerServiceAgentPoolResource(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.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// agentPool_Get + /// + /// + /// + /// Parameter for the name of the agent pool in the provisioned cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _hybridContainerServiceAgentPoolagentPoolClientDiagnostics.CreateScope("HybridContainerServiceAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridContainerServiceAgentPoolagentPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridContainerServiceAgentPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceVirtualNetworkCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceVirtualNetworkCollection.cs index 78071b6f3b2b..2d21fb5d3ff5 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceVirtualNetworkCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceVirtualNetworkCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualNetworksName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName} + /// + /// + /// Operation Id + /// virtualNetworks_Retrieve + /// + /// + /// + /// Parameter for the name of the virtual network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworksName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworksName, nameof(virtualNetworksName)); + + using var scope = _hybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics.CreateScope("HybridContainerServiceVirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridContainerServiceVirtualNetworkvirtualNetworksRestClient.RetrieveAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworksName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridContainerServiceVirtualNetworkResource(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.HybridContainerService/virtualNetworks/{virtualNetworksName} + /// + /// + /// Operation Id + /// virtualNetworks_Retrieve + /// + /// + /// + /// Parameter for the name of the virtual network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworksName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworksName, nameof(virtualNetworksName)); + + using var scope = _hybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics.CreateScope("HybridContainerServiceVirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridContainerServiceVirtualNetworkvirtualNetworksRestClient.Retrieve(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworksName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridContainerServiceVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridIdentityMetadataCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridIdentityMetadataCollection.cs index ebb24b816ad3..5bfe5705700d 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridIdentityMetadataCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridIdentityMetadataCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string hybridIdentityMetadataResourceName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName} + /// + /// + /// Operation Id + /// HybridIdentityMetadata_Get + /// + /// + /// + /// Parameter for the name of the hybrid identity metadata 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 hybridIdentityMetadataResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hybridIdentityMetadataResourceName, nameof(hybridIdentityMetadataResourceName)); + + using var scope = _hybridIdentityMetadataHybridIdentityMetadataClientDiagnostics.CreateScope("HybridIdentityMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridIdentityMetadataHybridIdentityMetadataRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hybridIdentityMetadataResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridIdentityMetadataResource(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.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName} + /// + /// + /// Operation Id + /// HybridIdentityMetadata_Get + /// + /// + /// + /// Parameter for the name of the hybrid identity metadata resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hybridIdentityMetadataResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hybridIdentityMetadataResourceName, nameof(hybridIdentityMetadataResourceName)); + + using var scope = _hybridIdentityMetadataHybridIdentityMetadataClientDiagnostics.CreateScope("HybridIdentityMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridIdentityMetadataHybridIdentityMetadataRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hybridIdentityMetadataResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridIdentityMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterCollection.cs index 680a0693c4b8..8d429a81b51a 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName} + /// + /// + /// Operation Id + /// ProvisionedClusters_Get + /// + /// + /// + /// Parameter for the name of the provisioned cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _provisionedClusterClientDiagnostics.CreateScope("ProvisionedClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _provisionedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProvisionedClusterResource(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.HybridContainerService/provisionedClusters/{resourceName} + /// + /// + /// Operation Id + /// ProvisionedClusters_Get + /// + /// + /// + /// Parameter for the name of the provisioned cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _provisionedClusterClientDiagnostics.CreateScope("ProvisionedClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _provisionedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProvisionedClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/StorageSpaceCollection.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/StorageSpaceCollection.cs index 2ccbe57b41d1..cd354cb6657c 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/StorageSpaceCollection.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/StorageSpaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string storageSpacesName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName} + /// + /// + /// Operation Id + /// storageSpaces_Retrieve + /// + /// + /// + /// Parameter for the name of the storage object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageSpacesName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageSpacesName, nameof(storageSpacesName)); + + using var scope = _storageSpacestorageSpacesClientDiagnostics.CreateScope("StorageSpaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageSpacestorageSpacesRestClient.RetrieveAsync(Id.SubscriptionId, Id.ResourceGroupName, storageSpacesName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSpaceResource(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.HybridContainerService/storageSpaces/{storageSpacesName} + /// + /// + /// Operation Id + /// storageSpaces_Retrieve + /// + /// + /// + /// Parameter for the name of the storage object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageSpacesName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageSpacesName, nameof(storageSpacesName)); + + using var scope = _storageSpacestorageSpacesClientDiagnostics.CreateScope("StorageSpaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageSpacestorageSpacesRestClient.Retrieve(Id.SubscriptionId, Id.ResourceGroupName, storageSpacesName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputeMachineCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputeMachineCollection.cs index 3a4744b18f37..91dc8dc34c08 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputeMachineCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputeMachineCollection.cs @@ -131,6 +131,48 @@ public async Task Exists_GetMachine() Console.WriteLine($"Succeeded: {result}"); } + // Get Machine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMachine() + { + // Generated from example definition: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2022-05-10-preview/examples/Machines_Get.json + // this example is just showing the usage of "Machines_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 = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HybridComputeMachineResource + HybridComputeMachineCollection collection = resourceGroupResource.GetHybridComputeMachines(); + + // invoke the operation + string machineName = "myMachine"; + NullableResponse response = await collection.GetIfExistsAsync(machineName); + HybridComputeMachineResource 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 + HybridComputeMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Machines by resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputeMachineExtensionCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputeMachineExtensionCollection.cs index fc5674631412..4e2ea1222bba 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputeMachineExtensionCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputeMachineExtensionCollection.cs @@ -133,6 +133,49 @@ public async Task Exists_GETMachineExtension() Console.WriteLine($"Succeeded: {result}"); } + // GET Machine Extension + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GETMachineExtension() + { + // Generated from example definition: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2022-05-10-preview/examples/GETExtension.json + // this example is just showing the usage of "MachineExtensions_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 HybridComputeMachineResource created on azure + // for more information of creating HybridComputeMachineResource, please refer to the document of HybridComputeMachineResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + string machineName = "myMachine"; + ResourceIdentifier hybridComputeMachineResourceId = HybridComputeMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, machineName); + HybridComputeMachineResource hybridComputeMachine = client.GetHybridComputeMachineResource(hybridComputeMachineResourceId); + + // get the collection of this HybridComputeMachineExtensionResource + HybridComputeMachineExtensionCollection collection = hybridComputeMachine.GetHybridComputeMachineExtensions(); + + // invoke the operation + string extensionName = "CustomScriptExtension"; + NullableResponse response = await collection.GetIfExistsAsync(extensionName); + HybridComputeMachineExtensionResource 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 + HybridComputeMachineExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GET all Machine Extensions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateEndpointConnectionCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateEndpointConnectionCollection.cs index 404d3a1f2945..78023d75bce1 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateEndpointConnectionCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2022-05-10-preview/examples/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 HybridComputePrivateLinkScopeResource created on azure + // for more information of creating HybridComputePrivateLinkScopeResource, please refer to the document of HybridComputePrivateLinkScopeResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myResourceGroup"; + string scopeName = "myPrivateLinkScope"; + ResourceIdentifier hybridComputePrivateLinkScopeResourceId = HybridComputePrivateLinkScopeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, scopeName); + HybridComputePrivateLinkScopeResource hybridComputePrivateLinkScope = client.GetHybridComputePrivateLinkScopeResource(hybridComputePrivateLinkScopeResourceId); + + // get the collection of this HybridComputePrivateEndpointConnectionResource + HybridComputePrivateEndpointConnectionCollection collection = hybridComputePrivateLinkScope.GetHybridComputePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "private-endpoint-connection-name"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + HybridComputePrivateEndpointConnectionResource 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 + HybridComputePrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a private endpoint connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateLinkResourceCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateLinkResourceCollection.cs index c879c598b710..34a575c059a0 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateLinkResourceCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2022-05-10-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_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 HybridComputePrivateLinkScopeResource created on azure + // for more information of creating HybridComputePrivateLinkScopeResource, please refer to the document of HybridComputePrivateLinkScopeResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myResourceGroup"; + string scopeName = "myPrivateLinkScope"; + ResourceIdentifier hybridComputePrivateLinkScopeResourceId = HybridComputePrivateLinkScopeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, scopeName); + HybridComputePrivateLinkScopeResource hybridComputePrivateLinkScope = client.GetHybridComputePrivateLinkScopeResource(hybridComputePrivateLinkScopeResourceId); + + // get the collection of this HybridComputePrivateLinkResource + HybridComputePrivateLinkResourceCollection collection = hybridComputePrivateLinkScope.GetHybridComputePrivateLinkResources(); + + // invoke the operation + string groupName = "hybridcompute"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + HybridComputePrivateLinkResource 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 + HybridComputePrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateLinkScopeCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateLinkScopeCollection.cs index bce6568783f3..dc8b56c60a76 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateLinkScopeCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/samples/Generated/Samples/Sample_HybridComputePrivateLinkScopeCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_PrivateLinkScopeGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateLinkScopeGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkScopeGet() + { + // Generated from example definition: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2022-05-10-preview/examples/PrivateLinkScopesGet.json + // this example is just showing the usage of "PrivateLinkScopes_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 = "86dc51d3-92ed-4d7e-947a-775ea79b4919"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HybridComputePrivateLinkScopeResource + HybridComputePrivateLinkScopeCollection collection = resourceGroupResource.GetHybridComputePrivateLinkScopes(); + + // invoke the operation + string scopeName = "my-privatelinkscope"; + NullableResponse response = await collection.GetIfExistsAsync(scopeName); + HybridComputePrivateLinkScopeResource 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 + HybridComputePrivateLinkScopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateLinkScopeCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineCollection.cs index 63efc46a447f..b5da6b67bfe6 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string machineName, InstanceViewType? expan } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// + /// The name of the hybrid machine. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string machineName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _hybridComputeMachineMachinesClientDiagnostics.CreateScope("HybridComputeMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridComputeMachineMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, machineName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputeMachineResource(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.HybridCompute/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// + /// The name of the hybrid machine. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string machineName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(machineName, nameof(machineName)); + + using var scope = _hybridComputeMachineMachinesClientDiagnostics.CreateScope("HybridComputeMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridComputeMachineMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, machineName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputeMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineExtensionCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineExtensionCollection.cs index 9b508a8f295d..b3b9e85707ec 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineExtensionCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineExtensionCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string extensionName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName} + /// + /// + /// Operation Id + /// MachineExtensions_Get + /// + /// + /// + /// The name of the machine extension. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string extensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + + using var scope = _hybridComputeMachineExtensionMachineExtensionsClientDiagnostics.CreateScope("HybridComputeMachineExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridComputeMachineExtensionMachineExtensionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputeMachineExtensionResource(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.HybridCompute/machines/{machineName}/extensions/{extensionName} + /// + /// + /// Operation Id + /// MachineExtensions_Get + /// + /// + /// + /// The name of the machine extension. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string extensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + + using var scope = _hybridComputeMachineExtensionMachineExtensionsClientDiagnostics.CreateScope("HybridComputeMachineExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridComputeMachineExtensionMachineExtensionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputeMachineExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateEndpointConnectionCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateEndpointConnectionCollection.cs index 584b22cf02de..c404c8535d8c 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateEndpointConnectionCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _hybridComputePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HybridComputePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridComputePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputePrivateEndpointConnectionResource(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.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _hybridComputePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HybridComputePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridComputePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkResourceCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkResourceCollection.cs index 8f27b6a853b0..031d6f4725c6 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkResourceCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _hybridComputePrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("HybridComputePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridComputePrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputePrivateLinkResource(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.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _hybridComputePrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("HybridComputePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridComputePrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputePrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeCollection.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeCollection.cs index 8a244286fd1a..a0f10827da41 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeCollection.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string scopeName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName} + /// + /// + /// Operation Id + /// PrivateLinkScopes_Get + /// + /// + /// + /// The name of the Azure Arc PrivateLinkScope 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 scopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeName, nameof(scopeName)); + + using var scope = _hybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics.CreateScope("HybridComputePrivateLinkScopeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridComputePrivateLinkScopePrivateLinkScopesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, scopeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputePrivateLinkScopeResource(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.HybridCompute/privateLinkScopes/{scopeName} + /// + /// + /// Operation Id + /// PrivateLinkScopes_Get + /// + /// + /// + /// The name of the Azure Arc PrivateLinkScope resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeName, nameof(scopeName)); + + using var scope = _hybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics.CreateScope("HybridComputePrivateLinkScopeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridComputePrivateLinkScopePrivateLinkScopesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, scopeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridComputePrivateLinkScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResourceCollection.cs index 9ab678b312c5..fb980a7890ba 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResourceCollection.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResourceCollection.cs @@ -112,6 +112,46 @@ public async Task Exists_HybridConnectivityEndpointsGetCustom() Console.WriteLine($"Succeeded: {result}"); } + // HybridConnectivityEndpointsGetCustom + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HybridConnectivityEndpointsGetCustom() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetCustom.json + // this example is just showing the usage of "Endpoints_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EndpointResourceCollection collection = client.GetEndpointResources(scopeId); + + // invoke the operation + string endpointName = "custom"; + NullableResponse response = await collection.GetIfExistsAsync(endpointName); + EndpointResource 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 + EndpointResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HybridConnectivityEndpointsGetDefault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -172,6 +212,46 @@ public async Task Exists_HybridConnectivityEndpointsGetDefault() Console.WriteLine($"Succeeded: {result}"); } + // HybridConnectivityEndpointsGetDefault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HybridConnectivityEndpointsGetDefault() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetDefault.json + // this example is just showing the usage of "Endpoints_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EndpointResourceCollection collection = client.GetEndpointResources(scopeId); + + // invoke the operation + string endpointName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(endpointName); + EndpointResource 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 + EndpointResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HybridConnectivityEndpointsPutCustom [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceCollection.cs index 233945085a51..2f1857a0d1ac 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceCollection.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceCollection.cs @@ -307,6 +307,78 @@ public virtual Response Exists(string endpointName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName} + /// + /// + /// Operation Id + /// Endpoints_Get + /// + /// + /// + /// The endpoint name. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetIfExistsAsync(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(endpointName, nameof(endpointName)); + + using var scope = _endpointResourceEndpointsClientDiagnostics.CreateScope("EndpointResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _endpointResourceEndpointsRestClient.GetAsync(Id, endpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName} + /// + /// + /// Operation Id + /// Endpoints_Get + /// + /// + /// + /// The endpoint name. + /// The cancellation token to use. + /// is null. + public virtual NullableResponse GetIfExists(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(endpointName, nameof(endpointName)); + + using var scope = _endpointResourceEndpointsClientDiagnostics.CreateScope("EndpointResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _endpointResourceEndpointsRestClient.Get(Id, endpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/samples/Generated/Samples/Sample_ConnectedClusterCollection.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/samples/Generated/Samples/Sample_ConnectedClusterCollection.cs index 4b7719c31da2..305152ce52ed 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/samples/Generated/Samples/Sample_ConnectedClusterCollection.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/samples/Generated/Samples/Sample_ConnectedClusterCollection.cs @@ -168,6 +168,48 @@ public async Task Exists_GetClusterExample() Console.WriteLine($"Succeeded: {result}"); } + // GetClusterExample + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetClusterExample() + { + // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/GetClusterExample.json + // this example is just showing the usage of "ConnectedCluster_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; + string resourceGroupName = "k8sc-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConnectedClusterResource + ConnectedClusterCollection collection = resourceGroupResource.GetConnectedClusters(); + + // invoke the operation + string clusterName = "testCluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + ConnectedClusterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConnectedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetClustersExample [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterCollection.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterCollection.cs index bd572e64cadb..280dd39deb71 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterCollection.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} + /// + /// + /// Operation Id + /// ConnectedCluster_Get + /// + /// + /// + /// The name of the Kubernetes cluster on which get is called. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _connectedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectedClusterResource(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.Kubernetes/connectedClusters/{clusterName} + /// + /// + /// Operation Id + /// ConnectedCluster_Get + /// + /// + /// + /// The name of the Kubernetes cluster on which get is called. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _connectedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/samples/Generated/Samples/Sample_FirmwareCollection.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/samples/Generated/Samples/Sample_FirmwareCollection.cs index b18f2284c4aa..e8bf7efacac2 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/samples/Generated/Samples/Sample_FirmwareCollection.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/samples/Generated/Samples/Sample_FirmwareCollection.cs @@ -248,6 +248,49 @@ public async Task Exists_FirmwareGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // Firmware_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FirmwareGetMaximumSetGen() + { + // Generated from example definition: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Firmware_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 FirmwareWorkspaceResource created on azure + // for more information of creating FirmwareWorkspaceResource, please refer to the document of FirmwareWorkspaceResource + string subscriptionId = "685C0C6F-9867-4B1C-A534-AA3A05B54BCE"; + string resourceGroupName = "rgworkspaces-firmwares"; + string workspaceName = "A7"; + ResourceIdentifier firmwareWorkspaceResourceId = FirmwareWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + FirmwareWorkspaceResource firmwareWorkspace = client.GetFirmwareWorkspaceResource(firmwareWorkspaceResourceId); + + // get the collection of this FirmwareResource + FirmwareCollection collection = firmwareWorkspace.GetFirmwares(); + + // invoke the operation + string firmwareName = "umrkdttp"; + NullableResponse response = await collection.GetIfExistsAsync(firmwareName); + FirmwareResource 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 + FirmwareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Firmware_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -313,5 +356,48 @@ public async Task Exists_FirmwareGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + + // Firmware_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FirmwareGetMinimumSetGen() + { + // Generated from example definition: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Firmware_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 FirmwareWorkspaceResource created on azure + // for more information of creating FirmwareWorkspaceResource, please refer to the document of FirmwareWorkspaceResource + string subscriptionId = "685C0C6F-9867-4B1C-A534-AA3A05B54BCE"; + string resourceGroupName = "rgworkspaces-firmwares"; + string workspaceName = "A7"; + ResourceIdentifier firmwareWorkspaceResourceId = FirmwareWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + FirmwareWorkspaceResource firmwareWorkspace = client.GetFirmwareWorkspaceResource(firmwareWorkspaceResourceId); + + // get the collection of this FirmwareResource + FirmwareCollection collection = firmwareWorkspace.GetFirmwares(); + + // invoke the operation + string firmwareName = "umrkdttp"; + NullableResponse response = await collection.GetIfExistsAsync(firmwareName); + FirmwareResource 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 + FirmwareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/samples/Generated/Samples/Sample_FirmwareWorkspaceCollection.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/samples/Generated/Samples/Sample_FirmwareWorkspaceCollection.cs index 7ef839cd7144..da17bdf82ddf 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/samples/Generated/Samples/Sample_FirmwareWorkspaceCollection.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/samples/Generated/Samples/Sample_FirmwareWorkspaceCollection.cs @@ -232,6 +232,48 @@ public async Task Exists_WorkspacesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // Workspaces_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkspacesGetMaximumSetGen() + { + // Generated from example definition: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Workspaces_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 = "9781B4B5-0922-472A-80F0-B743D0596694"; + string resourceGroupName = "rgworkspaces"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FirmwareWorkspaceResource + FirmwareWorkspaceCollection collection = resourceGroupResource.GetFirmwareWorkspaces(); + + // invoke the operation + string workspaceName = "E_US"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + FirmwareWorkspaceResource 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 + FirmwareWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Workspaces_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -295,5 +337,47 @@ public async Task Exists_WorkspacesGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + + // Workspaces_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkspacesGetMinimumSetGen() + { + // Generated from example definition: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Workspaces_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 = "9781B4B5-0922-472A-80F0-B743D0596694"; + string resourceGroupName = "rgworkspaces"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FirmwareWorkspaceResource + FirmwareWorkspaceCollection collection = resourceGroupResource.GetFirmwareWorkspaces(); + + // invoke the operation + string workspaceName = "E_US"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + FirmwareWorkspaceResource 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 + FirmwareWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareCollection.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareCollection.cs index 3aeee9059d45..aafe85242237 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareCollection.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string firmwareName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId} + /// + /// + /// Operation Id + /// Firmware_Get + /// + /// + /// + /// The id of the firmware. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firmwareName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firmwareName, nameof(firmwareName)); + + using var scope = _firmwareClientDiagnostics.CreateScope("FirmwareCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _firmwareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firmwareName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FirmwareResource(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.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId} + /// + /// + /// Operation Id + /// Firmware_Get + /// + /// + /// + /// The id of the firmware. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firmwareName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firmwareName, nameof(firmwareName)); + + using var scope = _firmwareClientDiagnostics.CreateScope("FirmwareCollection.GetIfExists"); + scope.Start(); + try + { + var response = _firmwareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firmwareName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FirmwareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceCollection.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceCollection.cs index 0d2e1be5f294..3e7754bf2644 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceCollection.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the firmware analysis workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _firmwareWorkspaceWorkspacesClientDiagnostics.CreateScope("FirmwareWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _firmwareWorkspaceWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FirmwareWorkspaceResource(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.IoTFirmwareDefense/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the firmware analysis workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _firmwareWorkspaceWorkspacesClientDiagnostics.CreateScope("FirmwareWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _firmwareWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FirmwareWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralAppCollection.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralAppCollection.cs index 7e01a8e1d3b0..7bfca83fae5e 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralAppCollection.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralAppCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_AppsGet() Console.WriteLine($"Succeeded: {result}"); } + // Apps_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AppsGet() + { + // Generated from example definition: specification/iotcentral/resource-manager/Microsoft.IoTCentral/preview/2021-11-01-preview/examples/Apps_Get.json + // this example is just showing the usage of "Apps_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 = "resRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this IotCentralAppResource + IotCentralAppCollection collection = resourceGroupResource.GetIotCentralApps(); + + // invoke the operation + string resourceName = "myIoTCentralApp"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + IotCentralAppResource 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 + IotCentralAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Apps_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralPrivateEndpointConnectionCollection.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralPrivateEndpointConnectionCollection.cs index 1da3a0bc2a9d..7c5934492f10 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralPrivateEndpointConnectionCollection.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_PrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/iotcentral/resource-manager/Microsoft.IoTCentral/preview/2021-11-01-preview/examples/PrivateEndpointConnections_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 IotCentralAppResource created on azure + // for more information of creating IotCentralAppResource, please refer to the document of IotCentralAppResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string resourceName = "myIoTCentralApp"; + ResourceIdentifier iotCentralAppResourceId = IotCentralAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + IotCentralAppResource iotCentralApp = client.GetIotCentralAppResource(iotCentralAppResourceId); + + // get the collection of this IotCentralPrivateEndpointConnectionResource + IotCentralPrivateEndpointConnectionCollection collection = iotCentralApp.GetIotCentralPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myIoTCentralAppEndpoint"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + IotCentralPrivateEndpointConnectionResource 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 + IotCentralPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_Update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralPrivateLinkResourceCollection.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralPrivateLinkResourceCollection.cs index 529cf29fb2ba..34c51a351829 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralPrivateLinkResourceCollection.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/samples/Generated/Samples/Sample_IotCentralPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_PrivateLinksGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateLinks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinksGet() + { + // Generated from example definition: specification/iotcentral/resource-manager/Microsoft.IoTCentral/preview/2021-11-01-preview/examples/PrivateLinks_Get.json + // this example is just showing the usage of "PrivateLinks_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 IotCentralAppResource created on azure + // for more information of creating IotCentralAppResource, please refer to the document of IotCentralAppResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string resourceName = "myIoTCentralApp"; + ResourceIdentifier iotCentralAppResourceId = IotCentralAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + IotCentralAppResource iotCentralApp = client.GetIotCentralAppResource(iotCentralAppResourceId); + + // get the collection of this IotCentralPrivateLinkResource + IotCentralPrivateLinkResourceCollection collection = iotCentralApp.GetIotCentralPrivateLinkResources(); + + // invoke the operation + string groupId = "iotApp"; + NullableResponse response = await collection.GetIfExistsAsync(groupId); + IotCentralPrivateLinkResource 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 + IotCentralPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateLinks_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppCollection.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppCollection.cs index 05ae8e218e38..be847f70ef0d 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppCollection.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName} + /// + /// + /// Operation Id + /// Apps_Get + /// + /// + /// + /// The ARM resource name of the IoT Central application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _iotCentralAppAppsClientDiagnostics.CreateScope("IotCentralAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotCentralAppAppsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotCentralAppResource(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.IoTCentral/iotApps/{resourceName} + /// + /// + /// Operation Id + /// Apps_Get + /// + /// + /// + /// The ARM resource name of the IoT Central application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _iotCentralAppAppsClientDiagnostics.CreateScope("IotCentralAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotCentralAppAppsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotCentralAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateEndpointConnectionCollection.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateEndpointConnectionCollection.cs index 93d520e9d0e2..88f44328a7ce 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateEndpointConnectionCollection.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The private endpoint connection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _iotCentralPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("IotCentralPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotCentralPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotCentralPrivateEndpointConnectionResource(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.IoTCentral/iotApps/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The private endpoint connection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _iotCentralPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("IotCentralPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotCentralPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotCentralPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateLinkResourceCollection.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateLinkResourceCollection.cs index c9954e8e086e..e1e7d608a92f 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateLinkResourceCollection.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string groupId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// PrivateLinks_Get + /// + /// + /// + /// The private link resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _iotCentralPrivateLinkResourcePrivateLinksClientDiagnostics.CreateScope("IotCentralPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotCentralPrivateLinkResourcePrivateLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotCentralPrivateLinkResource(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.IoTCentral/iotApps/{resourceName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// PrivateLinks_Get + /// + /// + /// + /// The private link resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _iotCentralPrivateLinkResourcePrivateLinksClientDiagnostics.CreateScope("IotCentralPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotCentralPrivateLinkResourcePrivateLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotCentralPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_EventHubConsumerGroupInfoCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_EventHubConsumerGroupInfoCollection.cs index 9943a2073f7b..ffaad488e958 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_EventHubConsumerGroupInfoCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_EventHubConsumerGroupInfoCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_IotHubResourceListEventHubConsumerGroups() Console.WriteLine($"Succeeded: {result}"); } + // IotHubResource_ListEventHubConsumerGroups + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_IotHubResourceListEventHubConsumerGroups() + { + // Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getconsumergroup.json + // this example is just showing the usage of "IotHubResource_GetEventHubConsumerGroup" 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 IotHubDescriptionResource created on azure + // for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource + string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "testHub"; + ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + + // get the collection of this EventHubConsumerGroupInfoResource + string eventHubEndpointName = "events"; + EventHubConsumerGroupInfoCollection collection = iotHubDescription.GetEventHubConsumerGroupInfos(eventHubEndpointName); + + // invoke the operation + string name = "test"; + NullableResponse response = await collection.GetIfExistsAsync(name); + EventHubConsumerGroupInfoResource 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 + EventHubConsumerGroupInfoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // IotHubResource_CreateEventHubConsumerGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubCertificateDescriptionCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubCertificateDescriptionCollection.cs index 6c46d8f7a08d..30d78983f4e5 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubCertificateDescriptionCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubCertificateDescriptionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_CertificatesGet() Console.WriteLine($"Succeeded: {result}"); } + // Certificates_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CertificatesGet() + { + // Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getcertificate.json + // this example is just showing the usage of "Certificates_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 IotHubDescriptionResource created on azure + // for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource + string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "testhub"; + ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + + // get the collection of this IotHubCertificateDescriptionResource + IotHubCertificateDescriptionCollection collection = iotHubDescription.GetIotHubCertificateDescriptions(); + + // invoke the operation + string certificateName = "cert"; + NullableResponse response = await collection.GetIfExistsAsync(certificateName); + IotHubCertificateDescriptionResource 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 + IotHubCertificateDescriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Certificates_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubDescriptionCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubDescriptionCollection.cs index 2044128bbe99..44b40cc56569 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubDescriptionCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubDescriptionCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_IotHubResourceGet() Console.WriteLine($"Succeeded: {result}"); } + // IotHubResource_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_IotHubResourceGet() + { + // Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_get.json + // this example is just showing the usage of "IotHubResource_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 = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this IotHubDescriptionResource + IotHubDescriptionCollection collection = resourceGroupResource.GetIotHubDescriptions(); + + // invoke the operation + string resourceName = "testHub"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + IotHubDescriptionResource 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 + IotHubDescriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // IotHubResource_AddCosmosDbEndpoint [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubPrivateEndpointConnectionCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubPrivateEndpointConnectionCollection.cs index 97fa6f0f34fe..9321577a4371 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubPrivateEndpointConnectionCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PrivateEndpointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnection_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionGet() + { + // Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivateendpointconnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 IotHubDescriptionResource created on azure + // for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource + string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "testHub"; + ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + + // get the collection of this IotHubPrivateEndpointConnectionResource + IotHubPrivateEndpointConnectionCollection collection = iotHubDescription.GetIotHubPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myPrivateEndpointConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + IotHubPrivateEndpointConnectionResource 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 + IotHubPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnection_Update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubPrivateEndpointGroupInformationCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubPrivateEndpointGroupInformationCollection.cs index cac436a7b04c..a13cd4263415 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubPrivateEndpointGroupInformationCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/samples/Generated/Samples/Sample_IotHubPrivateEndpointGroupInformationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_PrivateLinkResourcesList() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateLinkResources_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesList() + { + // Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivatelinkresources.json + // this example is just showing the usage of "PrivateLinkResources_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 IotHubDescriptionResource created on azure + // for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource + string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "testHub"; + ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + + // get the collection of this IotHubPrivateEndpointGroupInformationResource + IotHubPrivateEndpointGroupInformationCollection collection = iotHubDescription.GetAllIotHubPrivateEndpointGroupInformation(); + + // invoke the operation + string groupId = "iotHub"; + NullableResponse response = await collection.GetIfExistsAsync(groupId); + IotHubPrivateEndpointGroupInformationResource 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 + IotHubPrivateEndpointGroupInformationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/EventHubConsumerGroupInfoCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/EventHubConsumerGroupInfoCollection.cs index 212b65df0b26..cf2ca80b276d 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/EventHubConsumerGroupInfoCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/EventHubConsumerGroupInfoCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name} + /// + /// + /// Operation Id + /// IotHubResource_GetEventHubConsumerGroup + /// + /// + /// + /// The name of the consumer group to retrieve. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _eventHubConsumerGroupInfoIotHubResourceClientDiagnostics.CreateScope("EventHubConsumerGroupInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubConsumerGroupInfoIotHubResourceRestClient.GetEventHubConsumerGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _eventHubEndpointName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubConsumerGroupInfoResource(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.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name} + /// + /// + /// Operation Id + /// IotHubResource_GetEventHubConsumerGroup + /// + /// + /// + /// The name of the consumer group to retrieve. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _eventHubConsumerGroupInfoIotHubResourceClientDiagnostics.CreateScope("EventHubConsumerGroupInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubConsumerGroupInfoIotHubResourceRestClient.GetEventHubConsumerGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _eventHubEndpointName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubConsumerGroupInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubCertificateDescriptionCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubCertificateDescriptionCollection.cs index 34cc90241d9b..92e6182d11d8 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubCertificateDescriptionCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubCertificateDescriptionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// The name of the certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _iotHubCertificateDescriptionCertificatesClientDiagnostics.CreateScope("IotHubCertificateDescriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotHubCertificateDescriptionCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotHubCertificateDescriptionResource(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.Devices/IotHubs/{resourceName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// The name of the certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _iotHubCertificateDescriptionCertificatesClientDiagnostics.CreateScope("IotHubCertificateDescriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotHubCertificateDescriptionCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotHubCertificateDescriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionCollection.cs index 5fd693025e38..d8716c3a3edf 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName} + /// + /// + /// Operation Id + /// IotHubResource_Get + /// + /// + /// + /// The name of the IoT hub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _iotHubDescriptionIotHubResourceClientDiagnostics.CreateScope("IotHubDescriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotHubDescriptionIotHubResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotHubDescriptionResource(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.Devices/IotHubs/{resourceName} + /// + /// + /// Operation Id + /// IotHubResource_Get + /// + /// + /// + /// The name of the IoT hub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _iotHubDescriptionIotHubResourceClientDiagnostics.CreateScope("IotHubDescriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotHubDescriptionIotHubResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotHubDescriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointConnectionCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointConnectionCollection.cs index 6c5ea9488712..a088a7dcbae6 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointConnectionCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _iotHubPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("IotHubPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotHubPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotHubPrivateEndpointConnectionResource(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.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _iotHubPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("IotHubPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotHubPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotHubPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointGroupInformationCollection.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointGroupInformationCollection.cs index 0716909e9432..c27de7070efc 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointGroupInformationCollection.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointGroupInformationCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string groupId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _iotHubPrivateEndpointGroupInformationPrivateLinkResourcesClientDiagnostics.CreateScope("IotHubPrivateEndpointGroupInformationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotHubPrivateEndpointGroupInformationPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotHubPrivateEndpointGroupInformationResource(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.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _iotHubPrivateEndpointGroupInformationPrivateLinkResourcesClientDiagnostics.CreateScope("IotHubPrivateEndpointGroupInformationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotHubPrivateEndpointGroupInformationPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotHubPrivateEndpointGroupInformationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultCollection.cs index 94010913afbe..a048912d351c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -80,5 +81,47 @@ public async Task Exists_RetrieveADeletedVault() Console.WriteLine($"Succeeded: {result}"); } + + // Retrieve a deleted vault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveADeletedVault() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getDeletedVault.json + // this example is just showing the usage of "Vaults_GetDeleted" 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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this DeletedKeyVaultResource + DeletedKeyVaultCollection collection = subscriptionResource.GetDeletedKeyVaults(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + string vaultName = "sample-vault"; + NullableResponse response = await collection.GetIfExistsAsync(location, vaultName); + DeletedKeyVaultResource 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 + DeletedKeyVaultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmCollection.cs index 951503c7360c..0fe71a6d6e48 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -80,5 +81,47 @@ public async Task Exists_RetrieveADeletedManagedHSM() Console.WriteLine($"Succeeded: {result}"); } + + // Retrieve a deleted managed HSM + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveADeletedManagedHSM() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/DeletedManagedHsm_Get.json + // this example is just showing the usage of "ManagedHsms_GetDeleted" 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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this DeletedManagedHsmResource + DeletedManagedHsmCollection collection = subscriptionResource.GetDeletedManagedHsms(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + string name = "hsm1"; + NullableResponse response = await collection.GetIfExistsAsync(location, name); + DeletedManagedHsmResource 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 + DeletedManagedHsmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultCollection.cs index f465f47e0fad..1a518dce7711 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultCollection.cs @@ -197,6 +197,48 @@ public async Task Exists_RetrieveAVault() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a vault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAVault() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getVault.json + // this example is just showing the usage of "Vaults_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 = "sample-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KeyVaultResource + KeyVaultCollection collection = resourceGroupResource.GetKeyVaults(); + + // invoke the operation + string vaultName = "sample-vault"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName); + KeyVaultResource 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 + KeyVaultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List vaults in the specified resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs index 9a2d040096ff..9ee8af6fffa3 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_KeyVaultGetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // KeyVaultGetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KeyVaultGetPrivateEndpointConnection() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 KeyVaultResource created on azure + // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "sample-group"; + string vaultName = "sample-vault"; + ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + + // get the collection of this KeyVaultPrivateEndpointConnectionResource + KeyVaultPrivateEndpointConnectionCollection collection = keyVault.GetKeyVaultPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "sample-pec"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + KeyVaultPrivateEndpointConnectionResource 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 + KeyVaultPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KeyVaultPutPrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs index 5035249812c9..e1f8ec6a4938 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_GetASecret() Console.WriteLine($"Succeeded: {result}"); } + // Get a secret + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASecret() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getSecret.json + // this example is just showing the usage of "Secrets_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 KeyVaultResource created on azure + // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "sample-group"; + string vaultName = "sample-vault"; + ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + + // get the collection of this KeyVaultSecretResource + KeyVaultSecretCollection collection = keyVault.GetKeyVaultSecrets(); + + // invoke the operation + string secretName = "secret-name"; + NullableResponse response = await collection.GetIfExistsAsync(secretName); + KeyVaultSecretResource 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 + KeyVaultSecretData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List secrets in the vault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmCollection.cs index 1fc38213d952..44f36db95559 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmCollection.cs @@ -138,6 +138,48 @@ public async Task Exists_RetrieveAManagedHSMPool() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a managed HSM Pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAManagedHSMPool() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_Get.json + // this example is just showing the usage of "ManagedHsms_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 = "hsm-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedHsmResource + ManagedHsmCollection collection = resourceGroupResource.GetManagedHsms(); + + // invoke the operation + string name = "hsm1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + ManagedHsmResource 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 + ManagedHsmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List managed HSM Pools in a resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionCollection.cs index 74d248695aac..c79cf5b07eec 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ManagedHsmGetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // ManagedHsmGetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagedHsmGetPrivateEndpointConnection() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_getPrivateEndpointConnection.json + // this example is just showing the usage of "MHSMPrivateEndpointConnections_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 ManagedHsmResource created on azure + // for more information of creating ManagedHsmResource, please refer to the document of ManagedHsmResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "sample-group"; + string name = "sample-mhsm"; + ResourceIdentifier managedHsmResourceId = ManagedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + ManagedHsmResource managedHsm = client.GetManagedHsmResource(managedHsmResourceId); + + // get the collection of this ManagedHsmPrivateEndpointConnectionResource + ManagedHsmPrivateEndpointConnectionCollection collection = managedHsm.GetManagedHsmPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "sample-pec"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + ManagedHsmPrivateEndpointConnectionResource 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 + ManagedHsmPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ManagedHsmPutPrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs index 4107257dae79..2624501a0e12 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs @@ -198,5 +198,81 @@ public virtual Response Exists(AzureLocation location, string vaultName, C throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_GetDeleted + /// + /// + /// + /// The location of the deleted vault. + /// The name of the vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deletedKeyVaultVaultsRestClient.GetDeletedAsync(Id.SubscriptionId, location, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedKeyVaultResource(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}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_GetDeleted + /// + /// + /// + /// The location of the deleted vault. + /// The name of the vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(AzureLocation location, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deletedKeyVaultVaultsRestClient.GetDeleted(Id.SubscriptionId, location, vaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedKeyVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs index f8e3368a5b60..877b7a583677 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs @@ -198,5 +198,81 @@ public virtual Response Exists(AzureLocation location, string name, Cancel throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name} + /// + /// + /// Operation Id + /// ManagedHsms_GetDeleted + /// + /// + /// + /// The location of the deleted managed HSM. + /// The name of the deleted managed HSM. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deletedManagedHsmManagedHsmsRestClient.GetDeletedAsync(Id.SubscriptionId, location, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedManagedHsmResource(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}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name} + /// + /// + /// Operation Id + /// ManagedHsms_GetDeleted + /// + /// + /// + /// The location of the deleted managed HSM. + /// The name of the deleted managed HSM. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(AzureLocation location, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deletedManagedHsmManagedHsmsRestClient.GetDeleted(Id.SubscriptionId, location, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedManagedHsmResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs index dffc6dcce6d5..c7204fb3e9db 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string vaultName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_Get + /// + /// + /// + /// The name of the vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_Get + /// + /// + /// + /// The name of the vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs index 3e4531b31fd9..5d821b6a2433 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs index 0c0b07622a5a..3817526dfb01 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string secretName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// + /// + /// Operation Id + /// Secrets_Get + /// + /// + /// + /// The name of the secret. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string secretName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); + + using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// + /// + /// Operation Id + /// Secrets_Get + /// + /// + /// + /// The name of the secret. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string secretName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); + + using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.GetIfExists"); + scope.Start(); + try + { + var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs index e94d222f306d..fc0df9488a04 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// + /// + /// Operation Id + /// ManagedHsms_Get + /// + /// + /// + /// The name of the managed HSM Pool. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// + /// + /// Operation Id + /// ManagedHsms_Get + /// + /// + /// + /// The name of the managed HSM Pool. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs index 3de200c28d13..85f109f15bb9 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// MHSMPrivateEndpointConnections_Get + /// + /// + /// + /// Name of the private endpoint connection associated with the managed hsm pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// MHSMPrivateEndpointConnections_Get + /// + /// + /// + /// Name of the private endpoint connection associated with the managed hsm pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesClusterExtensionCollection.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesClusterExtensionCollection.cs index de7ada005921..b08537023a94 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesClusterExtensionCollection.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesClusterExtensionCollection.cs @@ -192,6 +192,51 @@ public async Task Exists_GetExtension() Console.WriteLine($"Succeeded: {result}"); } + // Get Extension + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExtension() + { + // Generated from example definition: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetExtension.json + // this example is just showing the usage of "Extensions_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 = "subId1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KubernetesClusterExtensionResource + string clusterRp = "Microsoft.Kubernetes"; + string clusterResourceName = "connectedClusters"; + string clusterName = "clusterName1"; + KubernetesClusterExtensionCollection collection = resourceGroupResource.GetKubernetesClusterExtensions(clusterRp, clusterResourceName, clusterName); + + // invoke the operation + string extensionName = "ClusterMonitor"; + NullableResponse response = await collection.GetIfExistsAsync(extensionName); + KubernetesClusterExtensionResource 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 + KubernetesClusterExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Extension with Plan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -262,6 +307,51 @@ public async Task Exists_GetExtensionWithPlan() Console.WriteLine($"Succeeded: {result}"); } + // Get Extension with Plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExtensionWithPlan() + { + // Generated from example definition: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetExtensionWithPlan.json + // this example is just showing the usage of "Extensions_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 = "subId1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KubernetesClusterExtensionResource + string clusterRp = "Microsoft.Kubernetes"; + string clusterResourceName = "connectedClusters"; + string clusterName = "clusterName1"; + KubernetesClusterExtensionCollection collection = resourceGroupResource.GetKubernetesClusterExtensions(clusterRp, clusterResourceName, clusterName); + + // invoke the operation + string extensionName = "azureVote"; + NullableResponse response = await collection.GetIfExistsAsync(extensionName); + KubernetesClusterExtensionResource 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 + KubernetesClusterExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Extensions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesFluxConfigurationCollection.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesFluxConfigurationCollection.cs index 6a12df68bd35..4fac23c7a78f 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesFluxConfigurationCollection.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesFluxConfigurationCollection.cs @@ -89,6 +89,51 @@ public async Task Exists_GetFluxConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get Flux Configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFluxConfiguration() + { + // Generated from example definition: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetFluxConfiguration.json + // this example is just showing the usage of "FluxConfigurations_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 = "subId1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KubernetesFluxConfigurationResource + string clusterRp = "Microsoft.Kubernetes"; + string clusterResourceName = "connectedClusters"; + string clusterName = "clusterName1"; + KubernetesFluxConfigurationCollection collection = resourceGroupResource.GetKubernetesFluxConfigurations(clusterRp, clusterResourceName, clusterName); + + // invoke the operation + string fluxConfigurationName = "srs-fluxconfig"; + NullableResponse response = await collection.GetIfExistsAsync(fluxConfigurationName); + KubernetesFluxConfigurationResource 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 + KubernetesFluxConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Flux Configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesSourceControlConfigurationCollection.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesSourceControlConfigurationCollection.cs index 172cc896d803..d3d62bf79d35 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesSourceControlConfigurationCollection.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/samples/Generated/Samples/Sample_KubernetesSourceControlConfigurationCollection.cs @@ -89,6 +89,51 @@ public async Task Exists_GetSourceControlConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get Source Control Configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSourceControlConfiguration() + { + // Generated from example definition: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetSourceControlConfiguration.json + // this example is just showing the usage of "SourceControlConfigurations_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 = "subId1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KubernetesSourceControlConfigurationResource + string clusterRp = "Microsoft.Kubernetes"; + string clusterResourceName = "connectedClusters"; + string clusterName = "clusterName1"; + KubernetesSourceControlConfigurationCollection collection = resourceGroupResource.GetKubernetesSourceControlConfigurations(clusterRp, clusterResourceName, clusterName); + + // invoke the operation + string sourceControlConfigurationName = "SRS_GitHubConfig"; + NullableResponse response = await collection.GetIfExistsAsync(sourceControlConfigurationName); + KubernetesSourceControlConfigurationResource 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 + KubernetesSourceControlConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Source Control Configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesClusterExtensionCollection.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesClusterExtensionCollection.cs index 06c8a0e2d7eb..28734b8bf7cb 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesClusterExtensionCollection.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesClusterExtensionCollection.cs @@ -335,6 +335,80 @@ public virtual Response Exists(string extensionName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName} + /// + /// + /// Operation Id + /// Extensions_Get + /// + /// + /// + /// Name of the Extension. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string extensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + + using var scope = _kubernetesClusterExtensionExtensionsClientDiagnostics.CreateScope("KubernetesClusterExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kubernetesClusterExtensionExtensionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _clusterRp, _clusterResourceName, _clusterName, extensionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KubernetesClusterExtensionResource(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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName} + /// + /// + /// Operation Id + /// Extensions_Get + /// + /// + /// + /// Name of the Extension. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string extensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + + using var scope = _kubernetesClusterExtensionExtensionsClientDiagnostics.CreateScope("KubernetesClusterExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kubernetesClusterExtensionExtensionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _clusterRp, _clusterResourceName, _clusterName, extensionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KubernetesClusterExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesFluxConfigurationCollection.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesFluxConfigurationCollection.cs index f32002f62872..af5a963f3963 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesFluxConfigurationCollection.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesFluxConfigurationCollection.cs @@ -335,6 +335,80 @@ public virtual Response Exists(string fluxConfigurationName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName} + /// + /// + /// Operation Id + /// FluxConfigurations_Get + /// + /// + /// + /// Name of the Flux Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string fluxConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fluxConfigurationName, nameof(fluxConfigurationName)); + + using var scope = _kubernetesFluxConfigurationFluxConfigurationsClientDiagnostics.CreateScope("KubernetesFluxConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kubernetesFluxConfigurationFluxConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _clusterRp, _clusterResourceName, _clusterName, fluxConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KubernetesFluxConfigurationResource(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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName} + /// + /// + /// Operation Id + /// FluxConfigurations_Get + /// + /// + /// + /// Name of the Flux Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fluxConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fluxConfigurationName, nameof(fluxConfigurationName)); + + using var scope = _kubernetesFluxConfigurationFluxConfigurationsClientDiagnostics.CreateScope("KubernetesFluxConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kubernetesFluxConfigurationFluxConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _clusterRp, _clusterResourceName, _clusterName, fluxConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KubernetesFluxConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesSourceControlConfigurationCollection.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesSourceControlConfigurationCollection.cs index b017f814fb11..41cf815f0e8f 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesSourceControlConfigurationCollection.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesSourceControlConfigurationCollection.cs @@ -335,6 +335,80 @@ public virtual Response Exists(string sourceControlConfigurationName, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName} + /// + /// + /// Operation Id + /// SourceControlConfigurations_Get + /// + /// + /// + /// Name of the Source Control Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sourceControlConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceControlConfigurationName, nameof(sourceControlConfigurationName)); + + using var scope = _kubernetesSourceControlConfigurationSourceControlConfigurationsClientDiagnostics.CreateScope("KubernetesSourceControlConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kubernetesSourceControlConfigurationSourceControlConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _clusterRp, _clusterResourceName, _clusterName, sourceControlConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KubernetesSourceControlConfigurationResource(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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName} + /// + /// + /// Operation Id + /// SourceControlConfigurations_Get + /// + /// + /// + /// Name of the Source Control Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sourceControlConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceControlConfigurationName, nameof(sourceControlConfigurationName)); + + using var scope = _kubernetesSourceControlConfigurationSourceControlConfigurationsClientDiagnostics.CreateScope("KubernetesSourceControlConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kubernetesSourceControlConfigurationSourceControlConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _clusterRp, _clusterResourceName, _clusterName, sourceControlConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KubernetesSourceControlConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoAttachedDatabaseConfigurationCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoAttachedDatabaseConfigurationCollection.cs index aadfb4161569..c2e48ce88559 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoAttachedDatabaseConfigurationCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoAttachedDatabaseConfigurationCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_AttachedDatabaseConfigurationsGet() Console.WriteLine($"Succeeded: {result}"); } + // AttachedDatabaseConfigurationsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AttachedDatabaseConfigurationsGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoAttachedDatabaseConfigurationsGet.json + // this example is just showing the usage of "AttachedDatabaseConfigurations_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 KustoClusterResource created on azure + // for more information of creating KustoClusterResource, please refer to the document of KustoClusterResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster2"; + ResourceIdentifier kustoClusterResourceId = KustoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + KustoClusterResource kustoCluster = client.GetKustoClusterResource(kustoClusterResourceId); + + // get the collection of this KustoAttachedDatabaseConfigurationResource + KustoAttachedDatabaseConfigurationCollection collection = kustoCluster.GetKustoAttachedDatabaseConfigurations(); + + // invoke the operation + string attachedDatabaseConfigurationName = "attachedDatabaseConfigurationsTest"; + NullableResponse response = await collection.GetIfExistsAsync(attachedDatabaseConfigurationName); + KustoAttachedDatabaseConfigurationResource 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 + KustoAttachedDatabaseConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AttachedDatabaseConfigurationsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoClusterCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoClusterCollection.cs index 9ae2b5f5e885..88d0e499e963 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoClusterCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoClusterCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_KustoClustersGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoClustersGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoClustersGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersGet.json + // this example is just showing the usage of "Clusters_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 = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KustoClusterResource + KustoClusterCollection collection = resourceGroupResource.GetKustoClusters(); + + // invoke the operation + string clusterName = "kustoCluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + KustoClusterResource 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 + KustoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoClustersCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoClusterPrincipalAssignmentCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoClusterPrincipalAssignmentCollection.cs index 097d199081f5..6bc971f131c2 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoClusterPrincipalAssignmentCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoClusterPrincipalAssignmentCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_KustoClusterPrincipalAssignmentsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoClusterPrincipalAssignmentsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoClusterPrincipalAssignmentsGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterPrincipalAssignmentsGet.json + // this example is just showing the usage of "ClusterPrincipalAssignments_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 KustoClusterResource created on azure + // for more information of creating KustoClusterResource, please refer to the document of KustoClusterResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + ResourceIdentifier kustoClusterResourceId = KustoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + KustoClusterResource kustoCluster = client.GetKustoClusterResource(kustoClusterResourceId); + + // get the collection of this KustoClusterPrincipalAssignmentResource + KustoClusterPrincipalAssignmentCollection collection = kustoCluster.GetKustoClusterPrincipalAssignments(); + + // invoke the operation + string principalAssignmentName = "kustoprincipal1"; + NullableResponse response = await collection.GetIfExistsAsync(principalAssignmentName); + KustoClusterPrincipalAssignmentResource 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 + KustoClusterPrincipalAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoClusterPrincipalAssignmentsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDataConnectionCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDataConnectionCollection.cs index 9f38822c773d..0cd18891f56f 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDataConnectionCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDataConnectionCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_KustoDataConnectionsCosmosDbGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoDataConnectionsCosmosDbGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoDataConnectionsCosmosDbGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsCosmosDbGet.json + // this example is just showing the usage of "DataConnections_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 KustoDatabaseResource created on azure + // for more information of creating KustoDatabaseResource, please refer to the document of KustoDatabaseResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + string databaseName = "KustoDatabase1"; + ResourceIdentifier kustoDatabaseResourceId = KustoDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, databaseName); + KustoDatabaseResource kustoDatabase = client.GetKustoDatabaseResource(kustoDatabaseResourceId); + + // get the collection of this KustoDataConnectionResource + KustoDataConnectionCollection collection = kustoDatabase.GetKustoDataConnections(); + + // invoke the operation + string dataConnectionName = "dataConnectionTest"; + NullableResponse response = await collection.GetIfExistsAsync(dataConnectionName); + KustoDataConnectionResource 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 + KustoDataConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoDataConnectionsEventGridGet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -192,6 +236,50 @@ public async Task Exists_KustoDataConnectionsEventGridGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoDataConnectionsEventGridGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoDataConnectionsEventGridGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsEventGridGet.json + // this example is just showing the usage of "DataConnections_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 KustoDatabaseResource created on azure + // for more information of creating KustoDatabaseResource, please refer to the document of KustoDatabaseResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + string databaseName = "KustoDatabase8"; + ResourceIdentifier kustoDatabaseResourceId = KustoDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, databaseName); + KustoDatabaseResource kustoDatabase = client.GetKustoDatabaseResource(kustoDatabaseResourceId); + + // get the collection of this KustoDataConnectionResource + KustoDataConnectionCollection collection = kustoDatabase.GetKustoDataConnections(); + + // invoke the operation + string dataConnectionName = "dataConnectionTest"; + NullableResponse response = await collection.GetIfExistsAsync(dataConnectionName); + KustoDataConnectionResource 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 + KustoDataConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoDataConnectionsGet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -260,6 +348,50 @@ public async Task Exists_KustoDataConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoDataConnectionsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoDataConnectionsGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsGet.json + // this example is just showing the usage of "DataConnections_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 KustoDatabaseResource created on azure + // for more information of creating KustoDatabaseResource, please refer to the document of KustoDatabaseResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + string databaseName = "KustoDatabase8"; + ResourceIdentifier kustoDatabaseResourceId = KustoDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, databaseName); + KustoDatabaseResource kustoDatabase = client.GetKustoDatabaseResource(kustoDatabaseResourceId); + + // get the collection of this KustoDataConnectionResource + KustoDataConnectionCollection collection = kustoDatabase.GetKustoDataConnections(); + + // invoke the operation + string dataConnectionName = "dataConnectionTest"; + NullableResponse response = await collection.GetIfExistsAsync(dataConnectionName); + KustoDataConnectionResource 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 + KustoDataConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoDataConnectionsCosmosDbCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabaseCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabaseCollection.cs index 73d757afbbef..aa7e0b81cb62 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabaseCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabaseCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_KustoDatabasesGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoDatabasesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoDatabasesGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasesGet.json + // this example is just showing the usage of "Databases_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 KustoClusterResource created on azure + // for more information of creating KustoClusterResource, please refer to the document of KustoClusterResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + ResourceIdentifier kustoClusterResourceId = KustoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + KustoClusterResource kustoCluster = client.GetKustoClusterResource(kustoClusterResourceId); + + // get the collection of this KustoDatabaseResource + KustoDatabaseCollection collection = kustoCluster.GetKustoDatabases(); + + // invoke the operation + string databaseName = "KustoDatabase8"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + KustoDatabaseResource 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 + KustoDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoSuspendedDatabasesGet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -188,6 +231,49 @@ public async Task Exists_KustoSuspendedDatabasesGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoSuspendedDatabasesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoSuspendedDatabasesGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoSuspendedDatabasesGet.json + // this example is just showing the usage of "Databases_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 KustoClusterResource created on azure + // for more information of creating KustoClusterResource, please refer to the document of KustoClusterResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + ResourceIdentifier kustoClusterResourceId = KustoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + KustoClusterResource kustoCluster = client.GetKustoClusterResource(kustoClusterResourceId); + + // get the collection of this KustoDatabaseResource + KustoDatabaseCollection collection = kustoCluster.GetKustoDatabases(); + + // invoke the operation + string databaseName = "KustoDatabase9"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + KustoDatabaseResource 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 + KustoDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Kusto ReadOnly database update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabasePrincipalAssignmentCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabasePrincipalAssignmentCollection.cs index 8946f4dcb4b2..fd5cd2dd0cac 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabasePrincipalAssignmentCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabasePrincipalAssignmentCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_KustoDatabasePrincipalAssignmentsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoDatabasePrincipalAssignmentsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoDatabasePrincipalAssignmentsGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasePrincipalAssignmentsGet.json + // this example is just showing the usage of "DatabasePrincipalAssignments_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 KustoDatabaseResource created on azure + // for more information of creating KustoDatabaseResource, please refer to the document of KustoDatabaseResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + string databaseName = "Kustodatabase8"; + ResourceIdentifier kustoDatabaseResourceId = KustoDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, databaseName); + KustoDatabaseResource kustoDatabase = client.GetKustoDatabaseResource(kustoDatabaseResourceId); + + // get the collection of this KustoDatabasePrincipalAssignmentResource + KustoDatabasePrincipalAssignmentCollection collection = kustoDatabase.GetKustoDatabasePrincipalAssignments(); + + // invoke the operation + string principalAssignmentName = "kustoprincipal1"; + NullableResponse response = await collection.GetIfExistsAsync(principalAssignmentName); + KustoDatabasePrincipalAssignmentResource 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 + KustoDatabasePrincipalAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoDatabasePrincipalAssignmentsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoManagedPrivateEndpointCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoManagedPrivateEndpointCollection.cs index 06a4a9f1d045..d734a9809a17 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoManagedPrivateEndpointCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoManagedPrivateEndpointCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_KustoManagedPrivateEndpointsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoManagedPrivateEndpointsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoManagedPrivateEndpointsGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoManagedPrivateEndpointsGet.json + // this example is just showing the usage of "ManagedPrivateEndpoints_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 KustoClusterResource created on azure + // for more information of creating KustoClusterResource, please refer to the document of KustoClusterResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + ResourceIdentifier kustoClusterResourceId = KustoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + KustoClusterResource kustoCluster = client.GetKustoClusterResource(kustoClusterResourceId); + + // get the collection of this KustoManagedPrivateEndpointResource + KustoManagedPrivateEndpointCollection collection = kustoCluster.GetKustoManagedPrivateEndpoints(); + + // invoke the operation + string managedPrivateEndpointName = "managedPrivateEndpointTest"; + NullableResponse response = await collection.GetIfExistsAsync(managedPrivateEndpointName); + KustoManagedPrivateEndpointResource 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 + KustoManagedPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoManagedPrivateEndpointsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoPrivateEndpointConnectionCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoPrivateEndpointConnectionCollection.cs index ea08e23e04d2..2c8d0c21530b 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoPrivateEndpointConnectionCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoPrivateEndpointConnectionsGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 KustoClusterResource created on azure + // for more information of creating KustoClusterResource, please refer to the document of KustoClusterResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + ResourceIdentifier kustoClusterResourceId = KustoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + KustoClusterResource kustoCluster = client.GetKustoClusterResource(kustoClusterResourceId); + + // get the collection of this KustoPrivateEndpointConnectionResource + KustoPrivateEndpointConnectionCollection collection = kustoCluster.GetKustoPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointTest"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + KustoPrivateEndpointConnectionResource 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 + KustoPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a private endpoint connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoPrivateLinkResourceCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoPrivateLinkResourceCollection.cs index baad9ef99714..21467e716900 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoPrivateLinkResourceCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoPrivateLinkResourcesGet.json + // this example is just showing the usage of "PrivateLinkResources_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 KustoClusterResource created on azure + // for more information of creating KustoClusterResource, please refer to the document of KustoClusterResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + ResourceIdentifier kustoClusterResourceId = KustoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + KustoClusterResource kustoCluster = client.GetKustoClusterResource(kustoClusterResourceId); + + // get the collection of this KustoPrivateLinkResource + KustoPrivateLinkResourceCollection collection = kustoCluster.GetKustoPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "cluster"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + KustoPrivateLinkResource 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 + KustoPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoScriptCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoScriptCollection.cs index a6b24be3b205..871b93456c32 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoScriptCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoScriptCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_KustoScriptsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoScriptsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoScriptsGet() + { + // Generated from example definition: specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoScriptsGet.json + // this example is just showing the usage of "Scripts_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 KustoDatabaseResource created on azure + // for more information of creating KustoDatabaseResource, please refer to the document of KustoDatabaseResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string clusterName = "kustoCluster"; + string databaseName = "Kustodatabase8"; + ResourceIdentifier kustoDatabaseResourceId = KustoDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, databaseName); + KustoDatabaseResource kustoDatabase = client.GetKustoDatabaseResource(kustoDatabaseResourceId); + + // get the collection of this KustoScriptResource + KustoScriptCollection collection = kustoDatabase.GetKustoScripts(); + + // invoke the operation + string scriptName = "kustoScript"; + NullableResponse response = await collection.GetIfExistsAsync(scriptName); + KustoScriptResource 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 + KustoScriptData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoScriptsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoAttachedDatabaseConfigurationCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoAttachedDatabaseConfigurationCollection.cs index bf7a7fb0ef7d..6dc1f80bab47 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoAttachedDatabaseConfigurationCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoAttachedDatabaseConfigurationCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string attachedDatabaseConfigurationName, C } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName} + /// + /// + /// Operation Id + /// AttachedDatabaseConfigurations_Get + /// + /// + /// + /// The name of the attached database configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string attachedDatabaseConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedDatabaseConfigurationName, nameof(attachedDatabaseConfigurationName)); + + using var scope = _kustoAttachedDatabaseConfigurationAttachedDatabaseConfigurationsClientDiagnostics.CreateScope("KustoAttachedDatabaseConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoAttachedDatabaseConfigurationAttachedDatabaseConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, attachedDatabaseConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoAttachedDatabaseConfigurationResource(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.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName} + /// + /// + /// Operation Id + /// AttachedDatabaseConfigurations_Get + /// + /// + /// + /// The name of the attached database configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string attachedDatabaseConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedDatabaseConfigurationName, nameof(attachedDatabaseConfigurationName)); + + using var scope = _kustoAttachedDatabaseConfigurationAttachedDatabaseConfigurationsClientDiagnostics.CreateScope("KustoAttachedDatabaseConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoAttachedDatabaseConfigurationAttachedDatabaseConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, attachedDatabaseConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoAttachedDatabaseConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterCollection.cs index 050f76d8446c..7bc7b0a9e6f8 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the Kusto cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _kustoClusterClustersClientDiagnostics.CreateScope("KustoClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoClusterResource(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.Kusto/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the Kusto cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _kustoClusterClustersClientDiagnostics.CreateScope("KustoClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterPrincipalAssignmentCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterPrincipalAssignmentCollection.cs index 80683be74db2..3a4867c4c8eb 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterPrincipalAssignmentCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterPrincipalAssignmentCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string principalAssignmentName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName} + /// + /// + /// Operation Id + /// ClusterPrincipalAssignments_Get + /// + /// + /// + /// The name of the Kusto principalAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string principalAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(principalAssignmentName, nameof(principalAssignmentName)); + + using var scope = _kustoClusterPrincipalAssignmentClusterPrincipalAssignmentsClientDiagnostics.CreateScope("KustoClusterPrincipalAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoClusterPrincipalAssignmentClusterPrincipalAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, principalAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoClusterPrincipalAssignmentResource(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.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName} + /// + /// + /// Operation Id + /// ClusterPrincipalAssignments_Get + /// + /// + /// + /// The name of the Kusto principalAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string principalAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(principalAssignmentName, nameof(principalAssignmentName)); + + using var scope = _kustoClusterPrincipalAssignmentClusterPrincipalAssignmentsClientDiagnostics.CreateScope("KustoClusterPrincipalAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoClusterPrincipalAssignmentClusterPrincipalAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, principalAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoClusterPrincipalAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDataConnectionCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDataConnectionCollection.cs index abc8ba71e00d..aab75b52b053 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDataConnectionCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDataConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string dataConnectionName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName} + /// + /// + /// Operation Id + /// DataConnections_Get + /// + /// + /// + /// The name of the data connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + using var scope = _kustoDataConnectionDataConnectionsClientDiagnostics.CreateScope("KustoDataConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoDataConnectionDataConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoDataConnectionResource(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.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName} + /// + /// + /// Operation Id + /// DataConnections_Get + /// + /// + /// + /// The name of the data connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + using var scope = _kustoDataConnectionDataConnectionsClientDiagnostics.CreateScope("KustoDataConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoDataConnectionDataConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoDataConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseCollection.cs index e8d700266e47..dafca6dfc59f 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseCollection.cs @@ -282,6 +282,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database in the Kusto cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _kustoDatabaseDatabasesClientDiagnostics.CreateScope("KustoDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoDatabaseDatabasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoDatabaseResource(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.Kusto/clusters/{clusterName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database in the Kusto cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _kustoDatabaseDatabasesClientDiagnostics.CreateScope("KustoDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoDatabaseDatabasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabasePrincipalAssignmentCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabasePrincipalAssignmentCollection.cs index 5893b877e855..22fbd0ff4c09 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabasePrincipalAssignmentCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabasePrincipalAssignmentCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string principalAssignmentName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName} + /// + /// + /// Operation Id + /// DatabasePrincipalAssignments_Get + /// + /// + /// + /// The name of the Kusto principalAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string principalAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(principalAssignmentName, nameof(principalAssignmentName)); + + using var scope = _kustoDatabasePrincipalAssignmentDatabasePrincipalAssignmentsClientDiagnostics.CreateScope("KustoDatabasePrincipalAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoDatabasePrincipalAssignmentDatabasePrincipalAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, principalAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoDatabasePrincipalAssignmentResource(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.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName} + /// + /// + /// Operation Id + /// DatabasePrincipalAssignments_Get + /// + /// + /// + /// The name of the Kusto principalAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string principalAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(principalAssignmentName, nameof(principalAssignmentName)); + + using var scope = _kustoDatabasePrincipalAssignmentDatabasePrincipalAssignmentsClientDiagnostics.CreateScope("KustoDatabasePrincipalAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoDatabasePrincipalAssignmentDatabasePrincipalAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, principalAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoDatabasePrincipalAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoManagedPrivateEndpointCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoManagedPrivateEndpointCollection.cs index 1a6c3cdd2e9d..95d1c40b5812 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoManagedPrivateEndpointCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoManagedPrivateEndpointCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string managedPrivateEndpointName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The name of the managed private endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _kustoManagedPrivateEndpointManagedPrivateEndpointsClientDiagnostics.CreateScope("KustoManagedPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoManagedPrivateEndpointManagedPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoManagedPrivateEndpointResource(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.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The name of the managed private endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _kustoManagedPrivateEndpointManagedPrivateEndpointsClientDiagnostics.CreateScope("KustoManagedPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoManagedPrivateEndpointManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoManagedPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateEndpointConnectionCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateEndpointConnectionCollection.cs index d546d4871dcf..991e31dc30e0 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateEndpointConnectionCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _kustoPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KustoPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoPrivateEndpointConnectionResource(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.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _kustoPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KustoPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateLinkResourceCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateLinkResourceCollection.cs index 3fc82132735e..24ae9b6de287 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateLinkResourceCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _kustoPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("KustoPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoPrivateLinkResource(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.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _kustoPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("KustoPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoScriptCollection.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoScriptCollection.cs index 97735cc37eb6..1cee8f5fe717 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoScriptCollection.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoScriptCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string scriptName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName} + /// + /// + /// Operation Id + /// Scripts_Get + /// + /// + /// + /// The name of the Kusto database script. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scriptName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptName, nameof(scriptName)); + + using var scope = _kustoScriptScriptsClientDiagnostics.CreateScope("KustoScriptCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kustoScriptScriptsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoScriptResource(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.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName} + /// + /// + /// Operation Id + /// Scripts_Get + /// + /// + /// + /// The name of the Kusto database script. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scriptName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptName, nameof(scriptName)); + + using var scope = _kustoScriptScriptsClientDiagnostics.CreateScope("KustoScriptCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kustoScriptScriptsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KustoScriptResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabCollection.cs index a86608a35c0b..e1d703cd74fd 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetLab() Console.WriteLine($"Succeeded: {result}"); } + // getLab + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLab() + { + // Generated from example definition: specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/examples/Labs/getLab.json + // this example is just showing the usage of "Labs_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LabResource + LabCollection collection = resourceGroupResource.GetLabs(); + + // invoke the operation + string labName = "testlab"; + NullableResponse response = await collection.GetIfExistsAsync(labName); + LabResource 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 + LabData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // putLab [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabPlanCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabPlanCollection.cs index 431e5d3b1f07..f8684fcad562 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabPlanCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabPlanCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetLabPlan() Console.WriteLine($"Succeeded: {result}"); } + // getLabPlan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLabPlan() + { + // Generated from example definition: specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/examples/LabPlans/getLabPlan.json + // this example is just showing the usage of "LabPlans_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LabPlanResource + LabPlanCollection collection = resourceGroupResource.GetLabPlans(); + + // invoke the operation + string labPlanName = "testlabplan"; + NullableResponse response = await collection.GetIfExistsAsync(labPlanName); + LabPlanResource 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 + LabPlanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // putLabPlan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabServicesScheduleCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabServicesScheduleCollection.cs index 879ed368a3da..b263c30a8750 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabServicesScheduleCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabServicesScheduleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetSchedule() Console.WriteLine($"Succeeded: {result}"); } + // getSchedule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSchedule() + { + // Generated from example definition: specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/examples/Schedules/getSchedule.json + // this example is just showing the usage of "Schedules_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 LabResource created on azure + // for more information of creating LabResource, please refer to the document of LabResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string labName = "testlab"; + ResourceIdentifier labResourceId = LabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + LabResource lab = client.GetLabResource(labResourceId); + + // get the collection of this LabServicesScheduleResource + LabServicesScheduleCollection collection = lab.GetLabServicesSchedules(); + + // invoke the operation + string scheduleName = "schedule1"; + NullableResponse response = await collection.GetIfExistsAsync(scheduleName); + LabServicesScheduleResource 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 + LabServicesScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // putSchedule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabUserCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabUserCollection.cs index 466ccec44cc3..52eeb59a431a 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabUserCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabUserCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetUser() Console.WriteLine($"Succeeded: {result}"); } + // getUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetUser() + { + // Generated from example definition: specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/examples/Users/getUser.json + // this example is just showing the usage of "Users_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 LabResource created on azure + // for more information of creating LabResource, please refer to the document of LabResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string labName = "testlab"; + ResourceIdentifier labResourceId = LabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + LabResource lab = client.GetLabResource(labResourceId); + + // get the collection of this LabUserResource + LabUserCollection collection = lab.GetLabUsers(); + + // invoke the operation + string userName = "testuser"; + NullableResponse response = await collection.GetIfExistsAsync(userName); + LabUserResource 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 + LabUserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // putUser [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabVirtualMachineCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabVirtualMachineCollection.cs index 4558f14a3686..719af70324f8 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabVirtualMachineCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabVirtualMachineCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + + // getVirtualMachine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachine() + { + // Generated from example definition: specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/examples/VirtualMachines/getVirtualMachine.json + // this example is just showing the usage of "VirtualMachines_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 LabResource created on azure + // for more information of creating LabResource, please refer to the document of LabResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string labName = "testlab"; + ResourceIdentifier labResourceId = LabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + LabResource lab = client.GetLabResource(labResourceId); + + // get the collection of this LabVirtualMachineResource + LabVirtualMachineCollection collection = lab.GetLabVirtualMachines(); + + // invoke the operation + string virtualMachineName = "template"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineName); + LabVirtualMachineResource 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 + LabVirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabVirtualMachineImageCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabVirtualMachineImageCollection.cs index ea8d88c42d7b..eb5de5211189 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabVirtualMachineImageCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/samples/Generated/Samples/Sample_LabVirtualMachineImageCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetImage() Console.WriteLine($"Succeeded: {result}"); } + // getImage + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetImage() + { + // Generated from example definition: specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/examples/Images/getImage.json + // this example is just showing the usage of "Images_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 LabPlanResource created on azure + // for more information of creating LabPlanResource, please refer to the document of LabPlanResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string labPlanName = "testlabplan"; + ResourceIdentifier labPlanResourceId = LabPlanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labPlanName); + LabPlanResource labPlan = client.GetLabPlanResource(labPlanResourceId); + + // get the collection of this LabVirtualMachineImageResource + LabVirtualMachineImageCollection collection = labPlan.GetLabVirtualMachineImages(); + + // invoke the operation + string imageName = "image1"; + NullableResponse response = await collection.GetIfExistsAsync(imageName); + LabVirtualMachineImageResource 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 + LabVirtualMachineImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // putImage [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabCollection.cs index 4954bd854c3b..8d0aea74e7b9 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string labName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName} + /// + /// + /// Operation Id + /// Labs_Get + /// + /// + /// + /// The name of the lab that uniquely identifies it within containing lab plan. Used in resource URIs. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string labName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(labName, nameof(labName)); + + using var scope = _labClientDiagnostics.CreateScope("LabCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _labRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, labName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabResource(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.LabServices/labs/{labName} + /// + /// + /// Operation Id + /// Labs_Get + /// + /// + /// + /// The name of the lab that uniquely identifies it within containing lab plan. Used in resource URIs. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string labName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(labName, nameof(labName)); + + using var scope = _labClientDiagnostics.CreateScope("LabCollection.GetIfExists"); + scope.Start(); + try + { + var response = _labRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, labName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanCollection.cs index 4a336f9b52ed..02d758908e94 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string labPlanName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName} + /// + /// + /// Operation Id + /// LabPlans_Get + /// + /// + /// + /// The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs and in UI. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string labPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(labPlanName, nameof(labPlanName)); + + using var scope = _labPlanClientDiagnostics.CreateScope("LabPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _labPlanRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, labPlanName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabPlanResource(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.LabServices/labPlans/{labPlanName} + /// + /// + /// Operation Id + /// LabPlans_Get + /// + /// + /// + /// The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs and in UI. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string labPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(labPlanName, nameof(labPlanName)); + + using var scope = _labPlanClientDiagnostics.CreateScope("LabPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _labPlanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, labPlanName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabPlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabServicesScheduleCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabServicesScheduleCollection.cs index bd5715c3548e..05d40785dc14 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabServicesScheduleCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabServicesScheduleCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string scheduleName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName} + /// + /// + /// Operation Id + /// Schedules_Get + /// + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); + + using var scope = _labServicesScheduleSchedulesClientDiagnostics.CreateScope("LabServicesScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _labServicesScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scheduleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabServicesScheduleResource(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.LabServices/labs/{labName}/schedules/{scheduleName} + /// + /// + /// Operation Id + /// Schedules_Get + /// + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); + + using var scope = _labServicesScheduleSchedulesClientDiagnostics.CreateScope("LabServicesScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _labServicesScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scheduleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabServicesScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabUserCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabUserCollection.cs index 2d5f6627b6f8..5f80bddf99c2 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabUserCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabUserCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string userName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName} + /// + /// + /// Operation Id + /// Users_Get + /// + /// + /// + /// The name of the user that uniquely identifies it within containing lab. Used in resource URIs. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var scope = _labUserUsersClientDiagnostics.CreateScope("LabUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _labUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabUserResource(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.LabServices/labs/{labName}/users/{userName} + /// + /// + /// Operation Id + /// Users_Get + /// + /// + /// + /// The name of the user that uniquely identifies it within containing lab. Used in resource URIs. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var scope = _labUserUsersClientDiagnostics.CreateScope("LabUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = _labUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineCollection.cs index 4896336dae48..67466cf02ee5 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string virtualMachineName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource URIs. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); + + using var scope = _labVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("LabVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _labVirtualMachineVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualMachineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabVirtualMachineResource(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.LabServices/labs/{labName}/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource URIs. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); + + using var scope = _labVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("LabVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _labVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualMachineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineImageCollection.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineImageCollection.cs index b24fc78c0a8c..e94e9be2ebed 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineImageCollection.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineImageCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string imageName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// The image name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string imageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + using var scope = _labVirtualMachineImageImagesClientDiagnostics.CreateScope("LabVirtualMachineImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _labVirtualMachineImageImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabVirtualMachineImageResource(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.LabServices/labPlans/{labPlanName}/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// The image name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string imageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + using var scope = _labVirtualMachineImageImagesClientDiagnostics.CreateScope("LabVirtualMachineImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _labVirtualMachineImageImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LabVirtualMachineImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/samples/Generated/Samples/Sample_LoadTestingQuotaCollection.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/samples/Generated/Samples/Sample_LoadTestingQuotaCollection.cs index 3ee21b07ae5b..6f82220070db 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/samples/Generated/Samples/Sample_LoadTestingQuotaCollection.cs +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/samples/Generated/Samples/Sample_LoadTestingQuotaCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_QuotasGet() Console.WriteLine($"Succeeded: {result}"); } + + // Quotas_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotasGet() + { + // Generated from example definition: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/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. + + // 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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this LoadTestingQuotaResource + AzureLocation location = new AzureLocation("westus"); + LoadTestingQuotaCollection collection = subscriptionResource.GetAllLoadTestingQuota(location); + + // invoke the operation + string quotaBucketName = "testQuotaBucket"; + NullableResponse response = await collection.GetIfExistsAsync(quotaBucketName); + LoadTestingQuotaResource 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 + LoadTestingQuotaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/samples/Generated/Samples/Sample_LoadTestingResourceCollection.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/samples/Generated/Samples/Sample_LoadTestingResourceCollection.cs index 77b2f01483f1..14e670adeb65 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/samples/Generated/Samples/Sample_LoadTestingResourceCollection.cs +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/samples/Generated/Samples/Sample_LoadTestingResourceCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_LoadTestsGet() Console.WriteLine($"Succeeded: {result}"); } + // LoadTests_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LoadTestsGet() + { + // Generated from example definition: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_Get.json + // this example is just showing the usage of "LoadTests_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 LoadTestingResource + LoadTestingResourceCollection collection = resourceGroupResource.GetLoadTestingResources(); + + // invoke the operation + string loadTestName = "myLoadTest"; + NullableResponse response = await collection.GetIfExistsAsync(loadTestName); + LoadTestingResource 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 + LoadTestingResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // LoadTests_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingQuotaCollection.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingQuotaCollection.cs index 935d0914beee..7f2e34c134f7 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingQuotaCollection.cs +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingQuotaCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string quotaBucketName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName} + /// + /// + /// Operation Id + /// Quotas_Get + /// + /// + /// + /// Quota Bucket name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string quotaBucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaBucketName, nameof(quotaBucketName)); + + using var scope = _loadTestingQuotaQuotasClientDiagnostics.CreateScope("LoadTestingQuotaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _loadTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), quotaBucketName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadTestingQuotaResource(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}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName} + /// + /// + /// Operation Id + /// Quotas_Get + /// + /// + /// + /// Quota Bucket name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string quotaBucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaBucketName, nameof(quotaBucketName)); + + using var scope = _loadTestingQuotaQuotasClientDiagnostics.CreateScope("LoadTestingQuotaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _loadTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), quotaBucketName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadTestingQuotaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingResourceCollection.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingResourceCollection.cs index 37d71ac9b423..5539b1af44b8 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingResourceCollection.cs +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string loadTestName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName} + /// + /// + /// Operation Id + /// LoadTests_Get + /// + /// + /// + /// Load Test name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string loadTestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadTestName, nameof(loadTestName)); + + using var scope = _loadTestingResourceLoadTestsClientDiagnostics.CreateScope("LoadTestingResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _loadTestingResourceLoadTestsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, loadTestName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadTestingResource(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.LoadTestService/loadTests/{loadTestName} + /// + /// + /// Operation Id + /// LoadTests_Get + /// + /// + /// + /// Load Test name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string loadTestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadTestName, nameof(loadTestName)); + + using var scope = _loadTestingResourceLoadTestsClientDiagnostics.CreateScope("LoadTestingResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _loadTestingResourceLoadTestsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, loadTestName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadTestingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountAgreementCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountAgreementCollection.cs index c55629961102..861b399024b4 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountAgreementCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountAgreementCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetAgreementByName() Console.WriteLine($"Succeeded: {result}"); } + // Get agreement by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAgreementByName() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountAgreements_Get.json + // this example is just showing the usage of "IntegrationAccountAgreements_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 IntegrationAccountResource created on azure + // for more information of creating IntegrationAccountResource, please refer to the document of IntegrationAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string integrationAccountName = "testIntegrationAccount"; + ResourceIdentifier integrationAccountResourceId = IntegrationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, integrationAccountName); + IntegrationAccountResource integrationAccount = client.GetIntegrationAccountResource(integrationAccountResourceId); + + // get the collection of this IntegrationAccountAgreementResource + IntegrationAccountAgreementCollection collection = integrationAccount.GetIntegrationAccountAgreements(); + + // invoke the operation + string agreementName = "testAgreement"; + NullableResponse response = await collection.GetIfExistsAsync(agreementName); + IntegrationAccountAgreementResource 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 + IntegrationAccountAgreementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update an agreement [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountAssemblyDefinitionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountAssemblyDefinitionCollection.cs index 69e9932dcfa4..33c45c58b928 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountAssemblyDefinitionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountAssemblyDefinitionCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetAnIntegrationAccountAssembly() Console.WriteLine($"Succeeded: {result}"); } + // Get an integration account assembly + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnIntegrationAccountAssembly() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountAssemblies_Get.json + // this example is just showing the usage of "IntegrationAccountAssemblies_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 IntegrationAccountResource created on azure + // for more information of creating IntegrationAccountResource, please refer to the document of IntegrationAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string integrationAccountName = "testIntegrationAccount"; + ResourceIdentifier integrationAccountResourceId = IntegrationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, integrationAccountName); + IntegrationAccountResource integrationAccount = client.GetIntegrationAccountResource(integrationAccountResourceId); + + // get the collection of this IntegrationAccountAssemblyDefinitionResource + IntegrationAccountAssemblyDefinitionCollection collection = integrationAccount.GetIntegrationAccountAssemblyDefinitions(); + + // invoke the operation + string assemblyArtifactName = "testAssembly"; + NullableResponse response = await collection.GetIfExistsAsync(assemblyArtifactName); + IntegrationAccountAssemblyDefinitionResource 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 + IntegrationAccountAssemblyDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update an account assembly [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountBatchConfigurationCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountBatchConfigurationCollection.cs index 37a269a4a1df..943f7659f151 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountBatchConfigurationCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountBatchConfigurationCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetABatchConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get a batch configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetABatchConfiguration() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountBatchConfigurations_Get.json + // this example is just showing the usage of "IntegrationAccountBatchConfigurations_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 IntegrationAccountResource created on azure + // for more information of creating IntegrationAccountResource, please refer to the document of IntegrationAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string integrationAccountName = "testIntegrationAccount"; + ResourceIdentifier integrationAccountResourceId = IntegrationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, integrationAccountName); + IntegrationAccountResource integrationAccount = client.GetIntegrationAccountResource(integrationAccountResourceId); + + // get the collection of this IntegrationAccountBatchConfigurationResource + IntegrationAccountBatchConfigurationCollection collection = integrationAccount.GetIntegrationAccountBatchConfigurations(); + + // invoke the operation + string batchConfigurationName = "testBatchConfiguration"; + NullableResponse response = await collection.GetIfExistsAsync(batchConfigurationName); + IntegrationAccountBatchConfigurationResource 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 + IntegrationAccountBatchConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a batch configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountCertificateCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountCertificateCollection.cs index bf6611438ee9..fbb3a2ca3bc6 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountCertificateCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountCertificateCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetCertificateByName() Console.WriteLine($"Succeeded: {result}"); } + // Get certificate by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCertificateByName() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountCertificates_Get.json + // this example is just showing the usage of "IntegrationAccountCertificates_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 IntegrationAccountResource created on azure + // for more information of creating IntegrationAccountResource, please refer to the document of IntegrationAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string integrationAccountName = "testIntegrationAccount"; + ResourceIdentifier integrationAccountResourceId = IntegrationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, integrationAccountName); + IntegrationAccountResource integrationAccount = client.GetIntegrationAccountResource(integrationAccountResourceId); + + // get the collection of this IntegrationAccountCertificateResource + IntegrationAccountCertificateCollection collection = integrationAccount.GetIntegrationAccountCertificates(); + + // invoke the operation + string certificateName = "testCertificate"; + NullableResponse response = await collection.GetIfExistsAsync(certificateName); + IntegrationAccountCertificateResource 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 + IntegrationAccountCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a certificate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountCollection.cs index cd2c13b445fa..1a3b17d22bdb 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetIntegrationAccountByName() Console.WriteLine($"Succeeded: {result}"); } + // Get integration account by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetIntegrationAccountByName() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccounts_Get.json + // this example is just showing the usage of "IntegrationAccounts_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this IntegrationAccountResource + IntegrationAccountCollection collection = resourceGroupResource.GetIntegrationAccounts(); + + // invoke the operation + string integrationAccountName = "testIntegrationAccount"; + NullableResponse response = await collection.GetIfExistsAsync(integrationAccountName); + IntegrationAccountResource 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 + IntegrationAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update an integration account [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountMapCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountMapCollection.cs index 7a923101dbb0..83d1df33a140 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountMapCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountMapCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetMapByName() Console.WriteLine($"Succeeded: {result}"); } + // Get map by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMapByName() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountMaps_Get.json + // this example is just showing the usage of "IntegrationAccountMaps_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 IntegrationAccountResource created on azure + // for more information of creating IntegrationAccountResource, please refer to the document of IntegrationAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string integrationAccountName = "testIntegrationAccount"; + ResourceIdentifier integrationAccountResourceId = IntegrationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, integrationAccountName); + IntegrationAccountResource integrationAccount = client.GetIntegrationAccountResource(integrationAccountResourceId); + + // get the collection of this IntegrationAccountMapResource + IntegrationAccountMapCollection collection = integrationAccount.GetIntegrationAccountMaps(); + + // invoke the operation + string mapName = "testMap"; + NullableResponse response = await collection.GetIfExistsAsync(mapName); + IntegrationAccountMapResource 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 + IntegrationAccountMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a map [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountPartnerCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountPartnerCollection.cs index cc72b7618242..2b91100fda25 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountPartnerCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountPartnerCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetPartnerByName() Console.WriteLine($"Succeeded: {result}"); } + // Get partner by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPartnerByName() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountPartners_Get.json + // this example is just showing the usage of "IntegrationAccountPartners_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 IntegrationAccountResource created on azure + // for more information of creating IntegrationAccountResource, please refer to the document of IntegrationAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string integrationAccountName = "testIntegrationAccount"; + ResourceIdentifier integrationAccountResourceId = IntegrationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, integrationAccountName); + IntegrationAccountResource integrationAccount = client.GetIntegrationAccountResource(integrationAccountResourceId); + + // get the collection of this IntegrationAccountPartnerResource + IntegrationAccountPartnerCollection collection = integrationAccount.GetIntegrationAccountPartners(); + + // invoke the operation + string partnerName = "testPartner"; + NullableResponse response = await collection.GetIfExistsAsync(partnerName); + IntegrationAccountPartnerResource 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 + IntegrationAccountPartnerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a partner [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountSchemaCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountSchemaCollection.cs index c7984412d655..2ff5a65b786c 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountSchemaCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountSchemaCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetSchemaByName() Console.WriteLine($"Succeeded: {result}"); } + // Get schema by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSchemaByName() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountSchemas_Get.json + // this example is just showing the usage of "IntegrationAccountSchemas_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 IntegrationAccountResource created on azure + // for more information of creating IntegrationAccountResource, please refer to the document of IntegrationAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string integrationAccountName = "testIntegrationAccount"; + ResourceIdentifier integrationAccountResourceId = IntegrationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, integrationAccountName); + IntegrationAccountResource integrationAccount = client.GetIntegrationAccountResource(integrationAccountResourceId); + + // get the collection of this IntegrationAccountSchemaResource + IntegrationAccountSchemaCollection collection = integrationAccount.GetIntegrationAccountSchemas(); + + // invoke the operation + string schemaName = "testSchema"; + NullableResponse response = await collection.GetIfExistsAsync(schemaName); + IntegrationAccountSchemaResource 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 + IntegrationAccountSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update schema [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountSessionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountSessionCollection.cs index 06360669372e..0e4ae367baa9 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountSessionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationAccountSessionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAnIntegrationAccountSession() Console.WriteLine($"Succeeded: {result}"); } + // Get an integration account session + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnIntegrationAccountSession() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountSessions_Get.json + // this example is just showing the usage of "IntegrationAccountSessions_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 IntegrationAccountResource created on azure + // for more information of creating IntegrationAccountResource, please refer to the document of IntegrationAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string integrationAccountName = "testia123"; + ResourceIdentifier integrationAccountResourceId = IntegrationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, integrationAccountName); + IntegrationAccountResource integrationAccount = client.GetIntegrationAccountResource(integrationAccountResourceId); + + // get the collection of this IntegrationAccountSessionResource + IntegrationAccountSessionCollection collection = integrationAccount.GetIntegrationAccountSessions(); + + // invoke the operation + string sessionName = "testsession123-ICN"; + NullableResponse response = await collection.GetIfExistsAsync(sessionName); + IntegrationAccountSessionResource 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 + IntegrationAccountSessionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update an integration account session [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationServiceEnvironmentCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationServiceEnvironmentCollection.cs index 81828598df8f..d4e7001da94a 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationServiceEnvironmentCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationServiceEnvironmentCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetIntegrationServiceEnvironmentByName() Console.WriteLine($"Succeeded: {result}"); } + // Get integration service environment by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetIntegrationServiceEnvironmentByName() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationServiceEnvironments_Get.json + // this example is just showing the usage of "IntegrationServiceEnvironments_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 = "f34b22a3-2202-4fb1-b040-1332bd928c84"; + string resourceGroup = "testResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroup); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this IntegrationServiceEnvironmentResource + IntegrationServiceEnvironmentCollection collection = resourceGroupResource.GetIntegrationServiceEnvironments(); + + // invoke the operation + string integrationServiceEnvironmentName = "testIntegrationServiceEnvironment"; + NullableResponse response = await collection.GetIfExistsAsync(integrationServiceEnvironmentName); + IntegrationServiceEnvironmentResource 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 + IntegrationServiceEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update an integration service environment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationServiceEnvironmentManagedApiCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationServiceEnvironmentManagedApiCollection.cs index 6a31656872d9..279db59cf028 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationServiceEnvironmentManagedApiCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_IntegrationServiceEnvironmentManagedApiCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetsTheIntegrationServiceEnvironmentManagedApis() Console.WriteLine($"Succeeded: {result}"); } + // Gets the integration service environment managed Apis + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheIntegrationServiceEnvironmentManagedApis() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationServiceEnvironments_ManagedApis_Get.json + // this example is just showing the usage of "IntegrationServiceEnvironmentManagedApis_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 IntegrationServiceEnvironmentResource created on azure + // for more information of creating IntegrationServiceEnvironmentResource, please refer to the document of IntegrationServiceEnvironmentResource + string subscriptionId = "f34b22a3-2202-4fb1-b040-1332bd928c84"; + string resourceGroup = "testResourceGroup"; + string integrationServiceEnvironmentName = "testIntegrationServiceEnvironment"; + ResourceIdentifier integrationServiceEnvironmentResourceId = IntegrationServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroup, integrationServiceEnvironmentName); + IntegrationServiceEnvironmentResource integrationServiceEnvironment = client.GetIntegrationServiceEnvironmentResource(integrationServiceEnvironmentResourceId); + + // get the collection of this IntegrationServiceEnvironmentManagedApiResource + IntegrationServiceEnvironmentManagedApiCollection collection = integrationServiceEnvironment.GetIntegrationServiceEnvironmentManagedApis(); + + // invoke the operation + string apiName = "servicebus"; + NullableResponse response = await collection.GetIfExistsAsync(apiName); + IntegrationServiceEnvironmentManagedApiResource 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 + IntegrationServiceEnvironmentManagedApiData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets the integration service environment managed Apis [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowCollection.cs index 964dafe3a86d..7a2ae777603d 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetAWorkflow() Console.WriteLine($"Succeeded: {result}"); } + // Get a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflow() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/Workflows_Get.json + // this example is just showing the usage of "Workflows_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LogicWorkflowResource + LogicWorkflowCollection collection = resourceGroupResource.GetLogicWorkflows(); + + // invoke the operation + string workflowName = "test-workflow"; + NullableResponse response = await collection.GetIfExistsAsync(workflowName); + LogicWorkflowResource 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 + LogicWorkflowData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a workflow [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionCollection.cs index d20272033083..8acbd39ef4f1 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetAWorkflowRunAction() Console.WriteLine($"Succeeded: {result}"); } + + // Get a workflow run action + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflowRunAction() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowRunActions_Get.json + // this example is just showing the usage of "WorkflowRunActions_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 LogicWorkflowRunResource created on azure + // for more information of creating LogicWorkflowRunResource, please refer to the document of LogicWorkflowRunResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string workflowName = "test-workflow"; + string runName = "08586676746934337772206998657CU22"; + ResourceIdentifier logicWorkflowRunResourceId = LogicWorkflowRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName, runName); + LogicWorkflowRunResource logicWorkflowRun = client.GetLogicWorkflowRunResource(logicWorkflowRunResourceId); + + // get the collection of this LogicWorkflowRunActionResource + LogicWorkflowRunActionCollection collection = logicWorkflowRun.GetLogicWorkflowRunActions(); + + // invoke the operation + string actionName = "HTTP"; + NullableResponse response = await collection.GetIfExistsAsync(actionName); + LogicWorkflowRunActionResource 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 + LogicWorkflowRunActionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRepetitionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRepetitionCollection.cs index 73f4b558abd5..cbff1f872ed8 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRepetitionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRepetitionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetARepetition() Console.WriteLine($"Succeeded: {result}"); } + + // Get a repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARepetition() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowRunActionRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitions_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 LogicWorkflowRunActionResource created on azure + // for more information of creating LogicWorkflowRunActionResource, please refer to the document of LogicWorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "testAction"; + ResourceIdentifier logicWorkflowRunActionResourceId = LogicWorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName, runName, actionName); + LogicWorkflowRunActionResource logicWorkflowRunAction = client.GetLogicWorkflowRunActionResource(logicWorkflowRunActionResourceId); + + // get the collection of this LogicWorkflowRunActionRepetitionResource + LogicWorkflowRunActionRepetitionCollection collection = logicWorkflowRunAction.GetLogicWorkflowRunActionRepetitions(); + + // invoke the operation + string repetitionName = "000001"; + NullableResponse response = await collection.GetIfExistsAsync(repetitionName); + LogicWorkflowRunActionRepetitionResource 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 + LogicWorkflowRunActionRepetitionDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRepetitionRequestHistoryCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRepetitionRequestHistoryCollection.cs index 6c034e9bce56..d43b20a432e4 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRepetitionRequestHistoryCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRepetitionRequestHistoryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -127,5 +128,51 @@ public async Task Exists_GetARepetitionRequestHistory() Console.WriteLine($"Succeeded: {result}"); } + + // Get a repetition request history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARepetitionRequestHistory() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowRunActionRepetitionsRequestHistories_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitionsRequestHistories_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 LogicWorkflowRunActionRepetitionResource created on azure + // for more information of creating LogicWorkflowRunActionRepetitionResource, please refer to the document of LogicWorkflowRunActionRepetitionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string workflowName = "test-workflow"; + string runName = "08586776228332053161046300351"; + string actionName = "HTTP_Webhook"; + string repetitionName = "000001"; + ResourceIdentifier logicWorkflowRunActionRepetitionResourceId = LogicWorkflowRunActionRepetitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName, runName, actionName, repetitionName); + LogicWorkflowRunActionRepetitionResource logicWorkflowRunActionRepetition = client.GetLogicWorkflowRunActionRepetitionResource(logicWorkflowRunActionRepetitionResourceId); + + // get the collection of this LogicWorkflowRunActionRepetitionRequestHistoryResource + LogicWorkflowRunActionRepetitionRequestHistoryCollection collection = logicWorkflowRunActionRepetition.GetLogicWorkflowRunActionRepetitionRequestHistories(); + + // invoke the operation + string requestHistoryName = "08586611142732800686"; + NullableResponse response = await collection.GetIfExistsAsync(requestHistoryName); + LogicWorkflowRunActionRepetitionRequestHistoryResource 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 + LogicWorkflowRequestHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRequestHistoryCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRequestHistoryCollection.cs index ca636af57906..f4f6f95fbd1d 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRequestHistoryCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionRequestHistoryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetARequestHistory() Console.WriteLine($"Succeeded: {result}"); } + + // Get a request history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARequestHistory() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowRunActionRequestHistories_Get.json + // this example is just showing the usage of "WorkflowRunActionRequestHistories_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 LogicWorkflowRunActionResource created on azure + // for more information of creating LogicWorkflowRunActionResource, please refer to the document of LogicWorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string workflowName = "test-workflow"; + string runName = "08586776228332053161046300351"; + string actionName = "HTTP_Webhook"; + ResourceIdentifier logicWorkflowRunActionResourceId = LogicWorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName, runName, actionName); + LogicWorkflowRunActionResource logicWorkflowRunAction = client.GetLogicWorkflowRunActionResource(logicWorkflowRunActionResourceId); + + // get the collection of this LogicWorkflowRunActionRequestHistoryResource + LogicWorkflowRunActionRequestHistoryCollection collection = logicWorkflowRunAction.GetLogicWorkflowRunActionRequestHistories(); + + // invoke the operation + string requestHistoryName = "08586611142732800686"; + NullableResponse response = await collection.GetIfExistsAsync(requestHistoryName); + LogicWorkflowRunActionRequestHistoryResource 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 + LogicWorkflowRequestHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionScopeRepetitionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionScopeRepetitionCollection.cs index 91d7dfa9b55e..d5642eb6609b 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionScopeRepetitionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunActionScopeRepetitionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetAScopedRepetition() Console.WriteLine($"Succeeded: {result}"); } + + // Get a scoped repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAScopedRepetition() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowRunActionScopeRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionScopeRepetitions_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 LogicWorkflowRunActionResource created on azure + // for more information of creating LogicWorkflowRunActionResource, please refer to the document of LogicWorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "for_each"; + ResourceIdentifier logicWorkflowRunActionResourceId = LogicWorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName, runName, actionName); + LogicWorkflowRunActionResource logicWorkflowRunAction = client.GetLogicWorkflowRunActionResource(logicWorkflowRunActionResourceId); + + // get the collection of this LogicWorkflowRunActionScopeRepetitionResource + LogicWorkflowRunActionScopeRepetitionCollection collection = logicWorkflowRunAction.GetLogicWorkflowRunActionScopeRepetitions(); + + // invoke the operation + string repetitionName = "000000"; + NullableResponse response = await collection.GetIfExistsAsync(repetitionName); + LogicWorkflowRunActionScopeRepetitionResource 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 + LogicWorkflowRunActionRepetitionDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunCollection.cs index 8a2a29e1b850..01b536f9699f 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetARunForAWorkflow() Console.WriteLine($"Succeeded: {result}"); } + + // Get a run for a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARunForAWorkflow() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowRuns_Get.json + // this example is just showing the usage of "WorkflowRuns_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 LogicWorkflowResource created on azure + // for more information of creating LogicWorkflowResource, please refer to the document of LogicWorkflowResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string workflowName = "test-workflow"; + ResourceIdentifier logicWorkflowResourceId = LogicWorkflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName); + LogicWorkflowResource logicWorkflow = client.GetLogicWorkflowResource(logicWorkflowResourceId); + + // get the collection of this LogicWorkflowRunResource + LogicWorkflowRunCollection collection = logicWorkflow.GetLogicWorkflowRuns(); + + // invoke the operation + string runName = "08586676746934337772206998657CU22"; + NullableResponse response = await collection.GetIfExistsAsync(runName); + LogicWorkflowRunResource 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 + LogicWorkflowRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunOperationCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunOperationCollection.cs index 54023a3dfd12..a8400b0f03ae 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunOperationCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowRunOperationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -83,5 +84,49 @@ public async Task Exists_GetARunOperation() Console.WriteLine($"Succeeded: {result}"); } + + // Get a run operation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARunOperation() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowRunOperations_Get.json + // this example is just showing the usage of "WorkflowRunOperations_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 LogicWorkflowRunResource created on azure + // for more information of creating LogicWorkflowRunResource, please refer to the document of LogicWorkflowRunResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string workflowName = "testFlow"; + string runName = "08586774142730039209110422528"; + ResourceIdentifier logicWorkflowRunResourceId = LogicWorkflowRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName, runName); + LogicWorkflowRunResource logicWorkflowRun = client.GetLogicWorkflowRunResource(logicWorkflowRunResourceId); + + // get the collection of this LogicWorkflowRunOperationResource + LogicWorkflowRunOperationCollection collection = logicWorkflowRun.GetLogicWorkflowRunOperations(); + + // invoke the operation + string operationId = "ebdcbbde-c4db-43ec-987c-fd0f7726f43b"; + NullableResponse response = await collection.GetIfExistsAsync(operationId); + LogicWorkflowRunOperationResource 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 + LogicWorkflowRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowTriggerCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowTriggerCollection.cs index 5c0afea71a4c..5bdd167a360a 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowTriggerCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowTriggerCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetAWorkflowTrigger() Console.WriteLine($"Succeeded: {result}"); } + + // Get a workflow trigger + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflowTrigger() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowTriggers_Get.json + // this example is just showing the usage of "WorkflowTriggers_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 LogicWorkflowResource created on azure + // for more information of creating LogicWorkflowResource, please refer to the document of LogicWorkflowResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string workflowName = "test-workflow"; + ResourceIdentifier logicWorkflowResourceId = LogicWorkflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName); + LogicWorkflowResource logicWorkflow = client.GetLogicWorkflowResource(logicWorkflowResourceId); + + // get the collection of this LogicWorkflowTriggerResource + LogicWorkflowTriggerCollection collection = logicWorkflow.GetLogicWorkflowTriggers(); + + // invoke the operation + string triggerName = "manual"; + NullableResponse response = await collection.GetIfExistsAsync(triggerName); + LogicWorkflowTriggerResource 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 + LogicWorkflowTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowTriggerHistoryCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowTriggerHistoryCollection.cs index 8c744fe1cfd8..24252ebdec72 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowTriggerHistoryCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowTriggerHistoryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetAWorkflowTriggerHistory() Console.WriteLine($"Succeeded: {result}"); } + + // Get a workflow trigger history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflowTriggerHistory() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowTriggerHistories_Get.json + // this example is just showing the usage of "WorkflowTriggerHistories_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 LogicWorkflowTriggerResource created on azure + // for more information of creating LogicWorkflowTriggerResource, please refer to the document of LogicWorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string workflowName = "testWorkflowName"; + string triggerName = "testTriggerName"; + ResourceIdentifier logicWorkflowTriggerResourceId = LogicWorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName, triggerName); + LogicWorkflowTriggerResource logicWorkflowTrigger = client.GetLogicWorkflowTriggerResource(logicWorkflowTriggerResourceId); + + // get the collection of this LogicWorkflowTriggerHistoryResource + LogicWorkflowTriggerHistoryCollection collection = logicWorkflowTrigger.GetLogicWorkflowTriggerHistories(); + + // invoke the operation + string historyName = "08586676746934337772206998657CU22"; + NullableResponse response = await collection.GetIfExistsAsync(historyName); + LogicWorkflowTriggerHistoryResource 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 + LogicWorkflowTriggerHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowVersionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowVersionCollection.cs index 4417bd8b8b42..df036d9c83b0 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowVersionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/samples/Generated/Samples/Sample_LogicWorkflowVersionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetAWorkflowVersion() Console.WriteLine($"Succeeded: {result}"); } + + // Get a workflow version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflowVersion() + { + // Generated from example definition: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/WorkflowVersions_Get.json + // this example is just showing the usage of "WorkflowVersions_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 LogicWorkflowResource created on azure + // for more information of creating LogicWorkflowResource, please refer to the document of LogicWorkflowResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string workflowName = "test-workflow"; + ResourceIdentifier logicWorkflowResourceId = LogicWorkflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workflowName); + LogicWorkflowResource logicWorkflow = client.GetLogicWorkflowResource(logicWorkflowResourceId); + + // get the collection of this LogicWorkflowVersionResource + LogicWorkflowVersionCollection collection = logicWorkflow.GetLogicWorkflowVersions(); + + // invoke the operation + string versionId = "08586676824806722526"; + NullableResponse response = await collection.GetIfExistsAsync(versionId); + LogicWorkflowVersionResource 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 + LogicWorkflowVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAgreementCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAgreementCollection.cs index 08984f52f018..959987dbc4e5 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAgreementCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAgreementCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string agreementName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName} + /// + /// + /// Operation Id + /// IntegrationAccountAgreements_Get + /// + /// + /// + /// The integration account agreement name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string agreementName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agreementName, nameof(agreementName)); + + using var scope = _integrationAccountAgreementClientDiagnostics.CreateScope("IntegrationAccountAgreementCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountAgreementRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agreementName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountAgreementResource(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.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName} + /// + /// + /// Operation Id + /// IntegrationAccountAgreements_Get + /// + /// + /// + /// The integration account agreement name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agreementName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agreementName, nameof(agreementName)); + + using var scope = _integrationAccountAgreementClientDiagnostics.CreateScope("IntegrationAccountAgreementCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountAgreementRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agreementName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountAgreementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAssemblyDefinitionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAssemblyDefinitionCollection.cs index b7bd6c852bd1..155fd5ec763f 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAssemblyDefinitionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAssemblyDefinitionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string assemblyArtifactName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/assemblies/{assemblyArtifactName} + /// + /// + /// Operation Id + /// IntegrationAccountAssemblies_Get + /// + /// + /// + /// The assembly artifact name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assemblyArtifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assemblyArtifactName, nameof(assemblyArtifactName)); + + using var scope = _integrationAccountAssemblyDefinitionIntegrationAccountAssembliesClientDiagnostics.CreateScope("IntegrationAccountAssemblyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountAssemblyDefinitionIntegrationAccountAssembliesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, assemblyArtifactName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountAssemblyDefinitionResource(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.Logic/integrationAccounts/{integrationAccountName}/assemblies/{assemblyArtifactName} + /// + /// + /// Operation Id + /// IntegrationAccountAssemblies_Get + /// + /// + /// + /// The assembly artifact name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assemblyArtifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assemblyArtifactName, nameof(assemblyArtifactName)); + + using var scope = _integrationAccountAssemblyDefinitionIntegrationAccountAssembliesClientDiagnostics.CreateScope("IntegrationAccountAssemblyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountAssemblyDefinitionIntegrationAccountAssembliesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, assemblyArtifactName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountAssemblyDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountBatchConfigurationCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountBatchConfigurationCollection.cs index 728df591c061..a5fa4a2d0122 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountBatchConfigurationCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountBatchConfigurationCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string batchConfigurationName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/batchConfigurations/{batchConfigurationName} + /// + /// + /// Operation Id + /// IntegrationAccountBatchConfigurations_Get + /// + /// + /// + /// The batch configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string batchConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(batchConfigurationName, nameof(batchConfigurationName)); + + using var scope = _integrationAccountBatchConfigurationClientDiagnostics.CreateScope("IntegrationAccountBatchConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountBatchConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, batchConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountBatchConfigurationResource(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.Logic/integrationAccounts/{integrationAccountName}/batchConfigurations/{batchConfigurationName} + /// + /// + /// Operation Id + /// IntegrationAccountBatchConfigurations_Get + /// + /// + /// + /// The batch configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string batchConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(batchConfigurationName, nameof(batchConfigurationName)); + + using var scope = _integrationAccountBatchConfigurationClientDiagnostics.CreateScope("IntegrationAccountBatchConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountBatchConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, batchConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountBatchConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCertificateCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCertificateCollection.cs index d00509ce531c..ad9ae4d090ca 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCertificateCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCertificateCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// IntegrationAccountCertificates_Get + /// + /// + /// + /// The integration account certificate name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _integrationAccountCertificateClientDiagnostics.CreateScope("IntegrationAccountCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountCertificateResource(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.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// IntegrationAccountCertificates_Get + /// + /// + /// + /// The integration account certificate name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _integrationAccountCertificateClientDiagnostics.CreateScope("IntegrationAccountCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCollection.cs index fafbb07d89df..69d9bbc9dca2 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string integrationAccountName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName} + /// + /// + /// Operation Id + /// IntegrationAccounts_Get + /// + /// + /// + /// The integration account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string integrationAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(integrationAccountName, nameof(integrationAccountName)); + + using var scope = _integrationAccountClientDiagnostics.CreateScope("IntegrationAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, integrationAccountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountResource(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.Logic/integrationAccounts/{integrationAccountName} + /// + /// + /// Operation Id + /// IntegrationAccounts_Get + /// + /// + /// + /// The integration account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string integrationAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(integrationAccountName, nameof(integrationAccountName)); + + using var scope = _integrationAccountClientDiagnostics.CreateScope("IntegrationAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, integrationAccountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountMapCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountMapCollection.cs index 0bfc8e807df4..99547a039daf 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountMapCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountMapCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string mapName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName} + /// + /// + /// Operation Id + /// IntegrationAccountMaps_Get + /// + /// + /// + /// The integration account map name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var scope = _integrationAccountMapClientDiagnostics.CreateScope("IntegrationAccountMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountMapRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mapName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountMapResource(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.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName} + /// + /// + /// Operation Id + /// IntegrationAccountMaps_Get + /// + /// + /// + /// The integration account map name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string mapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mapName, nameof(mapName)); + + using var scope = _integrationAccountMapClientDiagnostics.CreateScope("IntegrationAccountMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountMapRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mapName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountMapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountPartnerCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountPartnerCollection.cs index ea812f9e3c1a..d8d692fe1e87 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountPartnerCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountPartnerCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string partnerName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName} + /// + /// + /// Operation Id + /// IntegrationAccountPartners_Get + /// + /// + /// + /// The integration account partner name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string partnerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerName, nameof(partnerName)); + + using var scope = _integrationAccountPartnerClientDiagnostics.CreateScope("IntegrationAccountPartnerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountPartnerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, partnerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountPartnerResource(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.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName} + /// + /// + /// Operation Id + /// IntegrationAccountPartners_Get + /// + /// + /// + /// The integration account partner name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string partnerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerName, nameof(partnerName)); + + using var scope = _integrationAccountPartnerClientDiagnostics.CreateScope("IntegrationAccountPartnerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountPartnerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, partnerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountPartnerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSchemaCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSchemaCollection.cs index 750ca5b6b535..b5adb4f42f33 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSchemaCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSchemaCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string schemaName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// IntegrationAccountSchemas_Get + /// + /// + /// + /// The integration account schema name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _integrationAccountSchemaClientDiagnostics.CreateScope("IntegrationAccountSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountSchemaResource(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.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// IntegrationAccountSchemas_Get + /// + /// + /// + /// The integration account schema name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _integrationAccountSchemaClientDiagnostics.CreateScope("IntegrationAccountSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSessionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSessionCollection.cs index 4eabaf56e9b0..47acd3a41636 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSessionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSessionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string sessionName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName} + /// + /// + /// Operation Id + /// IntegrationAccountSessions_Get + /// + /// + /// + /// The integration account session name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sessionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sessionName, nameof(sessionName)); + + using var scope = _integrationAccountSessionClientDiagnostics.CreateScope("IntegrationAccountSessionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationAccountSessionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sessionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountSessionResource(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.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName} + /// + /// + /// Operation Id + /// IntegrationAccountSessions_Get + /// + /// + /// + /// The integration account session name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sessionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sessionName, nameof(sessionName)); + + using var scope = _integrationAccountSessionClientDiagnostics.CreateScope("IntegrationAccountSessionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationAccountSessionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sessionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationAccountSessionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentCollection.cs index 0951dec78a2c..8815abebaff1 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string integrationServiceEnvironmentName, C } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName} + /// + /// + /// Operation Id + /// IntegrationServiceEnvironments_Get + /// + /// + /// + /// The integration service environment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string integrationServiceEnvironmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(integrationServiceEnvironmentName, nameof(integrationServiceEnvironmentName)); + + using var scope = _integrationServiceEnvironmentClientDiagnostics.CreateScope("IntegrationServiceEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationServiceEnvironmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, integrationServiceEnvironmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationServiceEnvironmentResource(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/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName} + /// + /// + /// Operation Id + /// IntegrationServiceEnvironments_Get + /// + /// + /// + /// The integration service environment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string integrationServiceEnvironmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(integrationServiceEnvironmentName, nameof(integrationServiceEnvironmentName)); + + using var scope = _integrationServiceEnvironmentClientDiagnostics.CreateScope("IntegrationServiceEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationServiceEnvironmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, integrationServiceEnvironmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationServiceEnvironmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentManagedApiCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentManagedApiCollection.cs index 95ed7a293782..e5478dbf4c7e 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentManagedApiCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentManagedApiCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string apiName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/managedApis/{apiName} + /// + /// + /// Operation Id + /// IntegrationServiceEnvironmentManagedApis_Get + /// + /// + /// + /// The api name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string apiName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiName, nameof(apiName)); + + using var scope = _integrationServiceEnvironmentManagedApiClientDiagnostics.CreateScope("IntegrationServiceEnvironmentManagedApiCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationServiceEnvironmentManagedApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationServiceEnvironmentManagedApiResource(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/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/managedApis/{apiName} + /// + /// + /// Operation Id + /// IntegrationServiceEnvironmentManagedApis_Get + /// + /// + /// + /// The api name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string apiName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiName, nameof(apiName)); + + using var scope = _integrationServiceEnvironmentManagedApiClientDiagnostics.CreateScope("IntegrationServiceEnvironmentManagedApiCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationServiceEnvironmentManagedApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationServiceEnvironmentManagedApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowCollection.cs index 2b0d9c2f258f..34eee9eabab9 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string workflowName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName} + /// + /// + /// Operation Id + /// Workflows_Get + /// + /// + /// + /// The workflow name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workflowName, nameof(workflowName)); + + using var scope = _logicWorkflowWorkflowsClientDiagnostics.CreateScope("LogicWorkflowCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowWorkflowsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workflowName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowResource(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.Logic/workflows/{workflowName} + /// + /// + /// Operation Id + /// Workflows_Get + /// + /// + /// + /// The workflow name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workflowName, nameof(workflowName)); + + using var scope = _logicWorkflowWorkflowsClientDiagnostics.CreateScope("LogicWorkflowCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowWorkflowsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workflowName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionCollection.cs index 45d359b64c16..78dec8ad69b9 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string actionName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName} + /// + /// + /// Operation Id + /// WorkflowRunActions_Get + /// + /// + /// + /// The workflow action name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string actionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); + + using var scope = _logicWorkflowRunActionWorkflowRunActionsClientDiagnostics.CreateScope("LogicWorkflowRunActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowRunActionWorkflowRunActionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, actionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionResource(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.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName} + /// + /// + /// Operation Id + /// WorkflowRunActions_Get + /// + /// + /// + /// The workflow action name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string actionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); + + using var scope = _logicWorkflowRunActionWorkflowRunActionsClientDiagnostics.CreateScope("LogicWorkflowRunActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowRunActionWorkflowRunActionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, actionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionCollection.cs index a262a7b14195..1d4e7f416400 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string repetitionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName} + /// + /// + /// Operation Id + /// WorkflowRunActionRepetitions_Get + /// + /// + /// + /// The workflow repetition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string repetitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(repetitionName, nameof(repetitionName)); + + using var scope = _logicWorkflowRunActionRepetitionWorkflowRunActionRepetitionsClientDiagnostics.CreateScope("LogicWorkflowRunActionRepetitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowRunActionRepetitionWorkflowRunActionRepetitionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, repetitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionRepetitionResource(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.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName} + /// + /// + /// Operation Id + /// WorkflowRunActionRepetitions_Get + /// + /// + /// + /// The workflow repetition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string repetitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(repetitionName, nameof(repetitionName)); + + using var scope = _logicWorkflowRunActionRepetitionWorkflowRunActionRepetitionsClientDiagnostics.CreateScope("LogicWorkflowRunActionRepetitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowRunActionRepetitionWorkflowRunActionRepetitionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, repetitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionRepetitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionRequestHistoryCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionRequestHistoryCollection.cs index 3e68dfecb887..a509261b0bf2 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionRequestHistoryCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionRequestHistoryCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string requestHistoryName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName}/requestHistories/{requestHistoryName} + /// + /// + /// Operation Id + /// WorkflowRunActionRepetitionsRequestHistories_Get + /// + /// + /// + /// The request history name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string requestHistoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestHistoryName, nameof(requestHistoryName)); + + using var scope = _logicWorkflowRunActionRepetitionRequestHistoryWorkflowRunActionRepetitionsRequestHistoriesClientDiagnostics.CreateScope("LogicWorkflowRunActionRepetitionRequestHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowRunActionRepetitionRequestHistoryWorkflowRunActionRepetitionsRequestHistoriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, requestHistoryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionRepetitionRequestHistoryResource(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.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName}/requestHistories/{requestHistoryName} + /// + /// + /// Operation Id + /// WorkflowRunActionRepetitionsRequestHistories_Get + /// + /// + /// + /// The request history name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string requestHistoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestHistoryName, nameof(requestHistoryName)); + + using var scope = _logicWorkflowRunActionRepetitionRequestHistoryWorkflowRunActionRepetitionsRequestHistoriesClientDiagnostics.CreateScope("LogicWorkflowRunActionRepetitionRequestHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowRunActionRepetitionRequestHistoryWorkflowRunActionRepetitionsRequestHistoriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, requestHistoryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionRepetitionRequestHistoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRequestHistoryCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRequestHistoryCollection.cs index 0338331e8f9a..05fb50e47da2 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRequestHistoryCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRequestHistoryCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string requestHistoryName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/requestHistories/{requestHistoryName} + /// + /// + /// Operation Id + /// WorkflowRunActionRequestHistories_Get + /// + /// + /// + /// The request history name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string requestHistoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestHistoryName, nameof(requestHistoryName)); + + using var scope = _logicWorkflowRunActionRequestHistoryWorkflowRunActionRequestHistoriesClientDiagnostics.CreateScope("LogicWorkflowRunActionRequestHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowRunActionRequestHistoryWorkflowRunActionRequestHistoriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, requestHistoryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionRequestHistoryResource(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.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/requestHistories/{requestHistoryName} + /// + /// + /// Operation Id + /// WorkflowRunActionRequestHistories_Get + /// + /// + /// + /// The request history name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string requestHistoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestHistoryName, nameof(requestHistoryName)); + + using var scope = _logicWorkflowRunActionRequestHistoryWorkflowRunActionRequestHistoriesClientDiagnostics.CreateScope("LogicWorkflowRunActionRequestHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowRunActionRequestHistoryWorkflowRunActionRequestHistoriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, requestHistoryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionRequestHistoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionScopeRepetitionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionScopeRepetitionCollection.cs index d5ec6b603850..82d530b5463e 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionScopeRepetitionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionScopeRepetitionCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string repetitionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/scopeRepetitions/{repetitionName} + /// + /// + /// Operation Id + /// WorkflowRunActionScopeRepetitions_Get + /// + /// + /// + /// The workflow repetition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string repetitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(repetitionName, nameof(repetitionName)); + + using var scope = _logicWorkflowRunActionScopeRepetitionWorkflowRunActionScopeRepetitionsClientDiagnostics.CreateScope("LogicWorkflowRunActionScopeRepetitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowRunActionScopeRepetitionWorkflowRunActionScopeRepetitionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, repetitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionScopeRepetitionResource(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.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/scopeRepetitions/{repetitionName} + /// + /// + /// Operation Id + /// WorkflowRunActionScopeRepetitions_Get + /// + /// + /// + /// The workflow repetition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string repetitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(repetitionName, nameof(repetitionName)); + + using var scope = _logicWorkflowRunActionScopeRepetitionWorkflowRunActionScopeRepetitionsClientDiagnostics.CreateScope("LogicWorkflowRunActionScopeRepetitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowRunActionScopeRepetitionWorkflowRunActionScopeRepetitionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, repetitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunActionScopeRepetitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunCollection.cs index 316d14cebbb3..0ac34d90dfdf 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string runName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName} + /// + /// + /// Operation Id + /// WorkflowRuns_Get + /// + /// + /// + /// The workflow run name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string runName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runName, nameof(runName)); + + using var scope = _logicWorkflowRunWorkflowRunsClientDiagnostics.CreateScope("LogicWorkflowRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowRunWorkflowRunsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunResource(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.Logic/workflows/{workflowName}/runs/{runName} + /// + /// + /// Operation Id + /// WorkflowRuns_Get + /// + /// + /// + /// The workflow run name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string runName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runName, nameof(runName)); + + using var scope = _logicWorkflowRunWorkflowRunsClientDiagnostics.CreateScope("LogicWorkflowRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowRunWorkflowRunsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunOperationCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunOperationCollection.cs index 96783696243e..997a1e23e017 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunOperationCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunOperationCollection.cs @@ -193,5 +193,79 @@ public virtual Response Exists(string operationId, CancellationToken cance throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkflowRunOperations_Get + /// + /// + /// + /// The workflow operation id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _logicWorkflowRunOperationWorkflowRunOperationsClientDiagnostics.CreateScope("LogicWorkflowRunOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowRunOperationWorkflowRunOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunOperationResource(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.Logic/workflows/{workflowName}/runs/{runName}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkflowRunOperations_Get + /// + /// + /// + /// The workflow operation id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _logicWorkflowRunOperationWorkflowRunOperationsClientDiagnostics.CreateScope("LogicWorkflowRunOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowRunOperationWorkflowRunOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowRunOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerCollection.cs index 6cdcd43ec6ce..9551e9cba105 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string triggerName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName} + /// + /// + /// Operation Id + /// WorkflowTriggers_Get + /// + /// + /// + /// The workflow trigger name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string triggerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); + + using var scope = _logicWorkflowTriggerWorkflowTriggersClientDiagnostics.CreateScope("LogicWorkflowTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowTriggerWorkflowTriggersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, triggerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowTriggerResource(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.Logic/workflows/{workflowName}/triggers/{triggerName} + /// + /// + /// Operation Id + /// WorkflowTriggers_Get + /// + /// + /// + /// The workflow trigger name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string triggerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); + + using var scope = _logicWorkflowTriggerWorkflowTriggersClientDiagnostics.CreateScope("LogicWorkflowTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowTriggerWorkflowTriggersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, triggerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowTriggerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerHistoryCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerHistoryCollection.cs index 1a09d64b1806..376cdbe7b7a1 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerHistoryCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerHistoryCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string historyName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName} + /// + /// + /// Operation Id + /// WorkflowTriggerHistories_Get + /// + /// + /// + /// The workflow trigger history name. Corresponds to the run name for triggers that resulted in a run. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string historyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(historyName, nameof(historyName)); + + using var scope = _logicWorkflowTriggerHistoryWorkflowTriggerHistoriesClientDiagnostics.CreateScope("LogicWorkflowTriggerHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowTriggerHistoryWorkflowTriggerHistoriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, historyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowTriggerHistoryResource(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.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName} + /// + /// + /// Operation Id + /// WorkflowTriggerHistories_Get + /// + /// + /// + /// The workflow trigger history name. Corresponds to the run name for triggers that resulted in a run. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string historyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(historyName, nameof(historyName)); + + using var scope = _logicWorkflowTriggerHistoryWorkflowTriggerHistoriesClientDiagnostics.CreateScope("LogicWorkflowTriggerHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowTriggerHistoryWorkflowTriggerHistoriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, historyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowTriggerHistoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowVersionCollection.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowVersionCollection.cs index 6e5bbe67841e..621642a04759 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowVersionCollection.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowVersionCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string versionId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId} + /// + /// + /// Operation Id + /// WorkflowVersions_Get + /// + /// + /// + /// The workflow versionId. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string versionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionId, nameof(versionId)); + + using var scope = _logicWorkflowVersionWorkflowVersionsClientDiagnostics.CreateScope("LogicWorkflowVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicWorkflowVersionWorkflowVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowVersionResource(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.Logic/workflows/{workflowName}/versions/{versionId} + /// + /// + /// Operation Id + /// WorkflowVersions_Get + /// + /// + /// + /// The workflow versionId. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionId, nameof(versionId)); + + using var scope = _logicWorkflowVersionWorkflowVersionsClientDiagnostics.CreateScope("LogicWorkflowVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicWorkflowVersionWorkflowVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicWorkflowVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/samples/Generated/Samples/Sample_OperationalizationClusterCollection.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/samples/Generated/Samples/Sample_OperationalizationClusterCollection.cs index a3fefdc37785..6b9f56109d6a 100644 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/samples/Generated/Samples/Sample_OperationalizationClusterCollection.cs +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/samples/Generated/Samples/Sample_OperationalizationClusterCollection.cs @@ -142,6 +142,48 @@ public async Task Exists_GETOperationalizationCluster() Console.WriteLine($"Succeeded: {result}"); } + // GET Operationalization Cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GETOperationalizationCluster() + { + // Generated from example definition: specification/machinelearningcompute/resource-manager/Microsoft.MachineLearningCompute/preview/2017-08-01-preview/examples/OperationalizationClusters_Get.json + // this example is just showing the usage of "OperationalizationClusters_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OperationalizationClusterResource + OperationalizationClusterCollection collection = resourceGroupResource.GetOperationalizationClusters(); + + // invoke the operation + string clusterName = "myCluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + OperationalizationClusterResource 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 + OperationalizationClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Operationalization Clusters by Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/OperationalizationClusterCollection.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/OperationalizationClusterCollection.cs index 271e6a065cff..9b40a47bc5e8 100644 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/OperationalizationClusterCollection.cs +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/OperationalizationClusterCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName} + /// + /// + /// Operation Id + /// OperationalizationClusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _operationalizationClusterClientDiagnostics.CreateScope("OperationalizationClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalizationClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalizationClusterResource(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.MachineLearningCompute/operationalizationClusters/{clusterName} + /// + /// + /// Operation Id + /// OperationalizationClusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _operationalizationClusterClientDiagnostics.CreateScope("OperationalizationClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalizationClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalizationClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningBatchDeploymentCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningBatchDeploymentCollection.cs index bd0214d21c04..1a158856d9e3 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningBatchDeploymentCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningBatchDeploymentCollection.cs @@ -129,6 +129,50 @@ public async Task Exists_GetBatchDeployment() Console.WriteLine($"Succeeded: {result}"); } + // Get Batch Deployment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBatchDeployment() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/BatchDeployment/get.json + // this example is just showing the usage of "BatchDeployments_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 MachineLearningBatchEndpointResource created on azure + // for more information of creating MachineLearningBatchEndpointResource, please refer to the document of MachineLearningBatchEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + string endpointName = "testEndpointName"; + ResourceIdentifier machineLearningBatchEndpointResourceId = MachineLearningBatchEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, endpointName); + MachineLearningBatchEndpointResource machineLearningBatchEndpoint = client.GetMachineLearningBatchEndpointResource(machineLearningBatchEndpointResourceId); + + // get the collection of this MachineLearningBatchDeploymentResource + MachineLearningBatchDeploymentCollection collection = machineLearningBatchEndpoint.GetMachineLearningBatchDeployments(); + + // invoke the operation + string deploymentName = "testDeploymentName"; + NullableResponse response = await collection.GetIfExistsAsync(deploymentName); + MachineLearningBatchDeploymentResource 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 + MachineLearningBatchDeploymentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Batch Deployment. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningBatchEndpointCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningBatchEndpointCollection.cs index 775e20763ee9..ce396a7f21fe 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningBatchEndpointCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningBatchEndpointCollection.cs @@ -123,6 +123,49 @@ public async Task Exists_GetBatchEndpoint() Console.WriteLine($"Succeeded: {result}"); } + // Get Batch Endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBatchEndpoint() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/BatchEndpoint/get.json + // this example is just showing the usage of "BatchEndpoints_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningBatchEndpointResource + MachineLearningBatchEndpointCollection collection = machineLearningWorkspace.GetMachineLearningBatchEndpoints(); + + // invoke the operation + string endpointName = "testEndpointName"; + NullableResponse response = await collection.GetIfExistsAsync(endpointName); + MachineLearningBatchEndpointResource 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 + MachineLearningBatchEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Batch Endpoint. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningCodeContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningCodeContainerCollection.cs index ce13f18be6a0..96de78d62c20 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningCodeContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningCodeContainerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetCodeContainer() Console.WriteLine($"Succeeded: {result}"); } + // Get Code Container. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCodeContainer() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/CodeContainer/get.json + // this example is just showing the usage of "CodeContainers_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg123"; + string workspaceName = "testworkspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningCodeContainerResource + MachineLearningCodeContainerCollection collection = machineLearningWorkspace.GetMachineLearningCodeContainers(); + + // invoke the operation + string name = "testContainer"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MachineLearningCodeContainerResource 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 + MachineLearningCodeContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Code Container. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningCodeVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningCodeVersionCollection.cs index 54de61933965..ca4879daf754 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningCodeVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningCodeVersionCollection.cs @@ -126,6 +126,50 @@ public async Task Exists_GetCodeVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get Code Version. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCodeVersion() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/CodeVersion/get.json + // this example is just showing the usage of "CodeVersions_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 MachineLearningCodeContainerResource created on azure + // for more information of creating MachineLearningCodeContainerResource, please refer to the document of MachineLearningCodeContainerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + string name = "string"; + ResourceIdentifier machineLearningCodeContainerResourceId = MachineLearningCodeContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, name); + MachineLearningCodeContainerResource machineLearningCodeContainer = client.GetMachineLearningCodeContainerResource(machineLearningCodeContainerResourceId); + + // get the collection of this MachineLearningCodeVersionResource + MachineLearningCodeVersionCollection collection = machineLearningCodeContainer.GetMachineLearningCodeVersions(); + + // invoke the operation + string version = "string"; + NullableResponse response = await collection.GetIfExistsAsync(version); + MachineLearningCodeVersionResource 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 + MachineLearningCodeVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Code Version. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComponentContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComponentContainerCollection.cs index 09ba4139c337..b03fc57e939f 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComponentContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComponentContainerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetComponentContainer() Console.WriteLine($"Succeeded: {result}"); } + // Get Component Container. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetComponentContainer() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/ComponentContainer/get.json + // this example is just showing the usage of "ComponentContainers_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningComponentContainerResource + MachineLearningComponentContainerCollection collection = machineLearningWorkspace.GetMachineLearningComponentContainers(); + + // invoke the operation + string name = "string"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MachineLearningComponentContainerResource 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 + MachineLearningComponentContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Component Container. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComponentVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComponentVersionCollection.cs index 7689c26649f3..1094c490e1dc 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComponentVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComponentVersionCollection.cs @@ -127,6 +127,50 @@ public async Task Exists_GetComponentVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get Component Version. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetComponentVersion() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/ComponentVersion/get.json + // this example is just showing the usage of "ComponentVersions_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 MachineLearningComponentContainerResource created on azure + // for more information of creating MachineLearningComponentContainerResource, please refer to the document of MachineLearningComponentContainerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + string name = "string"; + ResourceIdentifier machineLearningComponentContainerResourceId = MachineLearningComponentContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, name); + MachineLearningComponentContainerResource machineLearningComponentContainer = client.GetMachineLearningComponentContainerResource(machineLearningComponentContainerResourceId); + + // get the collection of this MachineLearningComponentVersionResource + MachineLearningComponentVersionCollection collection = machineLearningComponentContainer.GetMachineLearningComponentVersions(); + + // invoke the operation + string version = "string"; + NullableResponse response = await collection.GetIfExistsAsync(version); + MachineLearningComponentVersionResource 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 + MachineLearningComponentVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Component Version. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComputeCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComputeCollection.cs index f35a6dc9c5c3..e8d7c64048f8 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComputeCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningComputeCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetAAKSCompute() Console.WriteLine($"Succeeded: {result}"); } + // Get a AKS Compute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAAKSCompute() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/get/AKSCompute.json + // this example is just showing the usage of "Compute_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string workspaceName = "workspaces123"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningComputeResource + MachineLearningComputeCollection collection = machineLearningWorkspace.GetMachineLearningComputes(); + + // invoke the operation + string computeName = "compute123"; + NullableResponse response = await collection.GetIfExistsAsync(computeName); + MachineLearningComputeResource 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 + MachineLearningComputeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a AML Compute [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -188,6 +231,49 @@ public async Task Exists_GetAAMLCompute() Console.WriteLine($"Succeeded: {result}"); } + // Get a AML Compute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAAMLCompute() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/get/AmlCompute.json + // this example is just showing the usage of "Compute_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string workspaceName = "workspaces123"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningComputeResource + MachineLearningComputeCollection collection = machineLearningWorkspace.GetMachineLearningComputes(); + + // invoke the operation + string computeName = "compute123"; + NullableResponse response = await collection.GetIfExistsAsync(computeName); + MachineLearningComputeResource 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 + MachineLearningComputeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a Kubernetes Compute [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -254,6 +340,49 @@ public async Task Exists_GetAKubernetesCompute() Console.WriteLine($"Succeeded: {result}"); } + // Get a Kubernetes Compute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAKubernetesCompute() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/get/KubernetesCompute.json + // this example is just showing the usage of "Compute_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string workspaceName = "workspaces123"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningComputeResource + MachineLearningComputeCollection collection = machineLearningWorkspace.GetMachineLearningComputes(); + + // invoke the operation + string computeName = "compute123"; + NullableResponse response = await collection.GetIfExistsAsync(computeName); + MachineLearningComputeResource 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 + MachineLearningComputeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an ComputeInstance [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -320,6 +449,49 @@ public async Task Exists_GetAnComputeInstance() Console.WriteLine($"Succeeded: {result}"); } + // Get an ComputeInstance + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnComputeInstance() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/get/ComputeInstance.json + // this example is just showing the usage of "Compute_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string workspaceName = "workspaces123"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningComputeResource + MachineLearningComputeCollection collection = machineLearningWorkspace.GetMachineLearningComputes(); + + // invoke the operation + string computeName = "compute123"; + NullableResponse response = await collection.GetIfExistsAsync(computeName); + MachineLearningComputeResource 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 + MachineLearningComputeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Attach a Kubernetes Compute [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDataContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDataContainerCollection.cs index a820053e3a68..8c805bf0ef4c 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDataContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDataContainerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetDataContainer() Console.WriteLine($"Succeeded: {result}"); } + // Get Data Container. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDataContainer() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/DataContainer/get.json + // this example is just showing the usage of "DataContainers_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg123"; + string workspaceName = "workspace123"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningDataContainerResource + MachineLearningDataContainerCollection collection = machineLearningWorkspace.GetMachineLearningDataContainers(); + + // invoke the operation + string name = "datacontainer123"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MachineLearningDataContainerResource 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 + MachineLearningDataContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Data Container. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDataVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDataVersionCollection.cs index d46288514b4f..62a7fcb9a26c 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDataVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDataVersionCollection.cs @@ -127,6 +127,50 @@ public async Task Exists_GetDataVersionBase() Console.WriteLine($"Succeeded: {result}"); } + // Get Data Version Base. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDataVersionBase() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/DataVersionBase/get.json + // this example is just showing the usage of "DataVersions_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 MachineLearningDataContainerResource created on azure + // for more information of creating MachineLearningDataContainerResource, please refer to the document of MachineLearningDataContainerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + string name = "string"; + ResourceIdentifier machineLearningDataContainerResourceId = MachineLearningDataContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, name); + MachineLearningDataContainerResource machineLearningDataContainer = client.GetMachineLearningDataContainerResource(machineLearningDataContainerResourceId); + + // get the collection of this MachineLearningDataVersionResource + MachineLearningDataVersionCollection collection = machineLearningDataContainer.GetMachineLearningDataVersions(); + + // invoke the operation + string version = "string"; + NullableResponse response = await collection.GetIfExistsAsync(version); + MachineLearningDataVersionResource 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 + MachineLearningDataVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Data Version Base. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDatastoreCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDatastoreCollection.cs index 0d2db358e874..c6ea0567342d 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDatastoreCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningDatastoreCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetDatastore() Console.WriteLine($"Succeeded: {result}"); } + // Get datastore. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatastore() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Datastore/get.json + // this example is just showing the usage of "Datastores_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningDatastoreResource + MachineLearningDatastoreCollection collection = machineLearningWorkspace.GetMachineLearningDatastores(); + + // invoke the operation + string name = "string"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MachineLearningDatastoreResource 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 + MachineLearningDatastoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate datastore (Azure Data Lake Gen1 w/ ServicePrincipal). [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningEnvironmentContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningEnvironmentContainerCollection.cs index 97764ac20bee..93ee488f4697 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningEnvironmentContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningEnvironmentContainerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetEnvironmentContainer() Console.WriteLine($"Succeeded: {result}"); } + // Get Environment Container. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetEnvironmentContainer() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/EnvironmentContainer/get.json + // this example is just showing the usage of "EnvironmentContainers_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg123"; + string workspaceName = "testworkspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningEnvironmentContainerResource + MachineLearningEnvironmentContainerCollection collection = machineLearningWorkspace.GetMachineLearningEnvironmentContainers(); + + // invoke the operation + string name = "testEnvironment"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MachineLearningEnvironmentContainerResource 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 + MachineLearningEnvironmentContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Environment Container. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningEnvironmentVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningEnvironmentVersionCollection.cs index 5b210fe33db0..797614cb51ea 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningEnvironmentVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningEnvironmentVersionCollection.cs @@ -126,6 +126,50 @@ public async Task Exists_GetEnvironmentVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get Environment Version. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetEnvironmentVersion() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/EnvironmentVersion/get.json + // this example is just showing the usage of "EnvironmentVersions_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 MachineLearningEnvironmentContainerResource created on azure + // for more information of creating MachineLearningEnvironmentContainerResource, please refer to the document of MachineLearningEnvironmentContainerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + string name = "string"; + ResourceIdentifier machineLearningEnvironmentContainerResourceId = MachineLearningEnvironmentContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, name); + MachineLearningEnvironmentContainerResource machineLearningEnvironmentContainer = client.GetMachineLearningEnvironmentContainerResource(machineLearningEnvironmentContainerResourceId); + + // get the collection of this MachineLearningEnvironmentVersionResource + MachineLearningEnvironmentVersionCollection collection = machineLearningEnvironmentContainer.GetMachineLearningEnvironmentVersions(); + + // invoke the operation + string version = "string"; + NullableResponse response = await collection.GetIfExistsAsync(version); + MachineLearningEnvironmentVersionResource 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 + MachineLearningEnvironmentVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Environment Version. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningJobCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningJobCollection.cs index 49c84d6e9a86..728ba8bf3937 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningJobCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningJobCollection.cs @@ -240,6 +240,49 @@ public async Task Exists_GetAutoMLJob() Console.WriteLine($"Succeeded: {result}"); } + // Get AutoML Job. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAutoMLJob() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Job/AutoMLJob/get.json + // this example is just showing the usage of "Jobs_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningJobResource + MachineLearningJobCollection collection = machineLearningWorkspace.GetMachineLearningJobs(); + + // invoke the operation + string id = "string"; + NullableResponse response = await collection.GetIfExistsAsync(id); + MachineLearningJobResource 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 + MachineLearningJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Command Job. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -306,6 +349,49 @@ public async Task Exists_GetCommandJob() Console.WriteLine($"Succeeded: {result}"); } + // Get Command Job. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCommandJob() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Job/CommandJob/get.json + // this example is just showing the usage of "Jobs_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningJobResource + MachineLearningJobCollection collection = machineLearningWorkspace.GetMachineLearningJobs(); + + // invoke the operation + string id = "string"; + NullableResponse response = await collection.GetIfExistsAsync(id); + MachineLearningJobResource 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 + MachineLearningJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Pipeline Job. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -372,6 +458,49 @@ public async Task Exists_GetPipelineJob() Console.WriteLine($"Succeeded: {result}"); } + // Get Pipeline Job. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPipelineJob() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Job/PipelineJob/get.json + // this example is just showing the usage of "Jobs_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningJobResource + MachineLearningJobCollection collection = machineLearningWorkspace.GetMachineLearningJobs(); + + // invoke the operation + string id = "string"; + NullableResponse response = await collection.GetIfExistsAsync(id); + MachineLearningJobResource 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 + MachineLearningJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Sweep Job. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -438,6 +567,49 @@ public async Task Exists_GetSweepJob() Console.WriteLine($"Succeeded: {result}"); } + // Get Sweep Job. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSweepJob() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Job/SweepJob/get.json + // this example is just showing the usage of "Jobs_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningJobResource + MachineLearningJobCollection collection = machineLearningWorkspace.GetMachineLearningJobs(); + + // invoke the operation + string id = "string"; + NullableResponse response = await collection.GetIfExistsAsync(id); + MachineLearningJobResource 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 + MachineLearningJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate AutoML Job. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningModelContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningModelContainerCollection.cs index 68bc8f0d83d7..ba6e21d05fce 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningModelContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningModelContainerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetModelContainer() Console.WriteLine($"Succeeded: {result}"); } + // Get Model Container. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetModelContainer() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/ModelContainer/get.json + // this example is just showing the usage of "ModelContainers_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg123"; + string workspaceName = "workspace123"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningModelContainerResource + MachineLearningModelContainerCollection collection = machineLearningWorkspace.GetMachineLearningModelContainers(); + + // invoke the operation + string name = "testContainer"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MachineLearningModelContainerResource 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 + MachineLearningModelContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Model Container. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningModelVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningModelVersionCollection.cs index a068fc14948c..246d72911cdf 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningModelVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningModelVersionCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_GetModelVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get Model Version. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetModelVersion() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/ModelVersion/get.json + // this example is just showing the usage of "ModelVersions_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 MachineLearningModelContainerResource created on azure + // for more information of creating MachineLearningModelContainerResource, please refer to the document of MachineLearningModelContainerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + string name = "string"; + ResourceIdentifier machineLearningModelContainerResourceId = MachineLearningModelContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, name); + MachineLearningModelContainerResource machineLearningModelContainer = client.GetMachineLearningModelContainerResource(machineLearningModelContainerResourceId); + + // get the collection of this MachineLearningModelVersionResource + MachineLearningModelVersionCollection collection = machineLearningModelContainer.GetMachineLearningModelVersions(); + + // invoke the operation + string version = "string"; + NullableResponse response = await collection.GetIfExistsAsync(version); + MachineLearningModelVersionResource 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 + MachineLearningModelVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Model Version. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningOnlineDeploymentCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningOnlineDeploymentCollection.cs index 999b80fc5983..d4f4f570c778 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningOnlineDeploymentCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningOnlineDeploymentCollection.cs @@ -128,6 +128,50 @@ public async Task Exists_GetKubernetesOnlineDeployment() Console.WriteLine($"Succeeded: {result}"); } + // Get Kubernetes Online Deployment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetKubernetesOnlineDeployment() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/OnlineDeployment/KubernetesOnlineDeployment/get.json + // this example is just showing the usage of "OnlineDeployments_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 MachineLearningOnlineEndpointResource created on azure + // for more information of creating MachineLearningOnlineEndpointResource, please refer to the document of MachineLearningOnlineEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + string endpointName = "testEndpointName"; + ResourceIdentifier machineLearningOnlineEndpointResourceId = MachineLearningOnlineEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, endpointName); + MachineLearningOnlineEndpointResource machineLearningOnlineEndpoint = client.GetMachineLearningOnlineEndpointResource(machineLearningOnlineEndpointResourceId); + + // get the collection of this MachineLearningOnlineDeploymentResource + MachineLearningOnlineDeploymentCollection collection = machineLearningOnlineEndpoint.GetMachineLearningOnlineDeployments(); + + // invoke the operation + string deploymentName = "testDeploymentName"; + NullableResponse response = await collection.GetIfExistsAsync(deploymentName); + MachineLearningOnlineDeploymentResource 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 + MachineLearningOnlineDeploymentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Managed Online Deployment. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -196,6 +240,50 @@ public async Task Exists_GetManagedOnlineDeployment() Console.WriteLine($"Succeeded: {result}"); } + // Get Managed Online Deployment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedOnlineDeployment() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/OnlineDeployment/ManagedOnlineDeployment/get.json + // this example is just showing the usage of "OnlineDeployments_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 MachineLearningOnlineEndpointResource created on azure + // for more information of creating MachineLearningOnlineEndpointResource, please refer to the document of MachineLearningOnlineEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + string endpointName = "testEndpointName"; + ResourceIdentifier machineLearningOnlineEndpointResourceId = MachineLearningOnlineEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, endpointName); + MachineLearningOnlineEndpointResource machineLearningOnlineEndpoint = client.GetMachineLearningOnlineEndpointResource(machineLearningOnlineEndpointResourceId); + + // get the collection of this MachineLearningOnlineDeploymentResource + MachineLearningOnlineDeploymentCollection collection = machineLearningOnlineEndpoint.GetMachineLearningOnlineDeployments(); + + // invoke the operation + string deploymentName = "testDeploymentName"; + NullableResponse response = await collection.GetIfExistsAsync(deploymentName); + MachineLearningOnlineDeploymentResource 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 + MachineLearningOnlineDeploymentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Kubernetes Online Deployment. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningOnlineEndpointCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningOnlineEndpointCollection.cs index f502229a2f9a..7a27ea28177b 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningOnlineEndpointCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningOnlineEndpointCollection.cs @@ -123,6 +123,49 @@ public async Task Exists_GetOnlineEndpoint() Console.WriteLine($"Succeeded: {result}"); } + // Get Online Endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetOnlineEndpoint() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/OnlineEndpoint/get.json + // this example is just showing the usage of "OnlineEndpoints_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningOnlineEndpointResource + MachineLearningOnlineEndpointCollection collection = machineLearningWorkspace.GetMachineLearningOnlineEndpoints(); + + // invoke the operation + string endpointName = "testEndpointName"; + NullableResponse response = await collection.GetIfExistsAsync(endpointName); + MachineLearningOnlineEndpointResource 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 + MachineLearningOnlineEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Online Endpoint. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningPrivateEndpointConnectionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningPrivateEndpointConnectionCollection.cs index 80a3d5f7f6e7..e0b98c776873 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningPrivateEndpointConnectionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WorkspaceGetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // WorkspaceGetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkspaceGetPrivateEndpointConnection() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/PrivateEndpointConnection/get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg-1234"; + string workspaceName = "testworkspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningPrivateEndpointConnectionResource + MachineLearningPrivateEndpointConnectionCollection collection = machineLearningWorkspace.GetMachineLearningPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "{privateEndpointConnectionName}"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + MachineLearningPrivateEndpointConnectionResource 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 + MachineLearningPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkspacePutPrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningScheduleCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningScheduleCollection.cs index 8776ccd6ddf5..0fb6cab4ba23 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningScheduleCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningScheduleCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetSchedule() Console.WriteLine($"Succeeded: {result}"); } + // Get Schedule. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSchedule() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Schedule/get.json + // this example is just showing the usage of "Schedules_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "test-rg"; + string workspaceName = "my-aml-workspace"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningScheduleResource + MachineLearningScheduleCollection collection = machineLearningWorkspace.GetMachineLearningSchedules(); + + // invoke the operation + string name = "string"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MachineLearningScheduleResource 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 + MachineLearningScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate Schedule. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningWorkspaceCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningWorkspaceCollection.cs index b1da7289ae1a..5f299f24de64 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningWorkspaceCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningWorkspaceCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetWorkspace() Console.WriteLine($"Succeeded: {result}"); } + // Get Workspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspace() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/get.json + // this example is just showing the usage of "Workspaces_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-1111-2222-3333-444444444444"; + string resourceGroupName = "workspace-1234"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MachineLearningWorkspaceResource + MachineLearningWorkspaceCollection collection = resourceGroupResource.GetMachineLearningWorkspaces(); + + // invoke the operation + string workspaceName = "testworkspace"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + MachineLearningWorkspaceResource 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 + MachineLearningWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Workspace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningWorkspaceConnectionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningWorkspaceConnectionCollection.cs index e4aadbb7594c..2332d53c28a2 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningWorkspaceConnectionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/samples/Generated/Samples/Sample_MachineLearningWorkspaceConnectionCollection.cs @@ -125,6 +125,49 @@ public async Task Exists_GetWorkspaceConnection() Console.WriteLine($"Succeeded: {result}"); } + // GetWorkspaceConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspaceConnection() + { + // Generated from example definition: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/WorkspaceConnection/get.json + // this example is just showing the usage of "WorkspaceConnections_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 MachineLearningWorkspaceResource created on azure + // for more information of creating MachineLearningWorkspaceResource, please refer to the document of MachineLearningWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "resourceGroup-1"; + string workspaceName = "workspace-1"; + ResourceIdentifier machineLearningWorkspaceResourceId = MachineLearningWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + MachineLearningWorkspaceResource machineLearningWorkspace = client.GetMachineLearningWorkspaceResource(machineLearningWorkspaceResourceId); + + // get the collection of this MachineLearningWorkspaceConnectionResource + MachineLearningWorkspaceConnectionCollection collection = machineLearningWorkspace.GetMachineLearningWorkspaceConnections(); + + // invoke the operation + string connectionName = "connection-1"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + MachineLearningWorkspaceConnectionResource 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 + MachineLearningWorkspaceConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListWorkspaceConnections [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchDeploymentCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchDeploymentCollection.cs index 3b4b3f2331f7..758467815782 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchDeploymentCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchDeploymentCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string deploymentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// BatchDeployments_Get + /// + /// + /// + /// The identifier for the Batch deployments. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _machineLearningBatchDeploymentBatchDeploymentsClientDiagnostics.CreateScope("MachineLearningBatchDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningBatchDeploymentBatchDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningBatchDeploymentResource(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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// BatchDeployments_Get + /// + /// + /// + /// The identifier for the Batch deployments. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _machineLearningBatchDeploymentBatchDeploymentsClientDiagnostics.CreateScope("MachineLearningBatchDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningBatchDeploymentBatchDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningBatchDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointCollection.cs index f462fd295b24..a996cc06b16a 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string endpointName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName} + /// + /// + /// Operation Id + /// BatchEndpoints_Get + /// + /// + /// + /// Name for the Batch Endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _machineLearningBatchEndpointBatchEndpointsClientDiagnostics.CreateScope("MachineLearningBatchEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningBatchEndpointBatchEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningBatchEndpointResource(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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName} + /// + /// + /// Operation Id + /// BatchEndpoints_Get + /// + /// + /// + /// Name for the Batch Endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _machineLearningBatchEndpointBatchEndpointsClientDiagnostics.CreateScope("MachineLearningBatchEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningBatchEndpointBatchEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningBatchEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerCollection.cs index 22fa214ac73d..e9b130798551 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name} + /// + /// + /// Operation Id + /// CodeContainers_Get + /// + /// + /// + /// Container name. This is case-sensitive. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningCodeContainerCodeContainersClientDiagnostics.CreateScope("MachineLearningCodeContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningCodeContainerCodeContainersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningCodeContainerResource(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.MachineLearningServices/workspaces/{workspaceName}/codes/{name} + /// + /// + /// Operation Id + /// CodeContainers_Get + /// + /// + /// + /// Container name. This is case-sensitive. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningCodeContainerCodeContainersClientDiagnostics.CreateScope("MachineLearningCodeContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningCodeContainerCodeContainersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningCodeContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeVersionCollection.cs index f361e6e9d59b..39e6d0f3bb6e 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeVersionCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string version, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version} + /// + /// + /// Operation Id + /// CodeVersions_Get + /// + /// + /// + /// Version identifier. This is case-sensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningCodeVersionCodeVersionsClientDiagnostics.CreateScope("MachineLearningCodeVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningCodeVersionCodeVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningCodeVersionResource(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.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version} + /// + /// + /// Operation Id + /// CodeVersions_Get + /// + /// + /// + /// Version identifier. This is case-sensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningCodeVersionCodeVersionsClientDiagnostics.CreateScope("MachineLearningCodeVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningCodeVersionCodeVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningCodeVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerCollection.cs index 305a950b6319..dae276f799c6 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name} + /// + /// + /// Operation Id + /// ComponentContainers_Get + /// + /// + /// + /// Container name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningComponentContainerComponentContainersClientDiagnostics.CreateScope("MachineLearningComponentContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningComponentContainerComponentContainersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningComponentContainerResource(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.MachineLearningServices/workspaces/{workspaceName}/components/{name} + /// + /// + /// Operation Id + /// ComponentContainers_Get + /// + /// + /// + /// Container name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningComponentContainerComponentContainersClientDiagnostics.CreateScope("MachineLearningComponentContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningComponentContainerComponentContainersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningComponentContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentVersionCollection.cs index 638d2b0c793d..01f9663bcece 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentVersionCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string version, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version} + /// + /// + /// Operation Id + /// ComponentVersions_Get + /// + /// + /// + /// Version identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningComponentVersionComponentVersionsClientDiagnostics.CreateScope("MachineLearningComponentVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningComponentVersionComponentVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningComponentVersionResource(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.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version} + /// + /// + /// Operation Id + /// ComponentVersions_Get + /// + /// + /// + /// Version identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningComponentVersionComponentVersionsClientDiagnostics.CreateScope("MachineLearningComponentVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningComponentVersionComponentVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningComponentVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComputeCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComputeCollection.cs index 0411ed0cd337..2b8dd9f79c13 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComputeCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComputeCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string computeName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName} + /// + /// + /// Operation Id + /// Compute_Get + /// + /// + /// + /// Name of the Azure Machine Learning compute. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string computeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(computeName, nameof(computeName)); + + using var scope = _machineLearningComputeComputeClientDiagnostics.CreateScope("MachineLearningComputeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningComputeComputeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, computeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningComputeResource(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.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName} + /// + /// + /// Operation Id + /// Compute_Get + /// + /// + /// + /// Name of the Azure Machine Learning compute. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string computeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(computeName, nameof(computeName)); + + using var scope = _machineLearningComputeComputeClientDiagnostics.CreateScope("MachineLearningComputeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningComputeComputeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, computeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningComputeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerCollection.cs index 18f50c5f1757..26339f74f455 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name} + /// + /// + /// Operation Id + /// DataContainers_Get + /// + /// + /// + /// Container name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningDataContainerDataContainersClientDiagnostics.CreateScope("MachineLearningDataContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningDataContainerDataContainersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningDataContainerResource(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.MachineLearningServices/workspaces/{workspaceName}/data/{name} + /// + /// + /// Operation Id + /// DataContainers_Get + /// + /// + /// + /// Container name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningDataContainerDataContainersClientDiagnostics.CreateScope("MachineLearningDataContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningDataContainerDataContainersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningDataContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataVersionCollection.cs index bc30093ae82e..744e7cbf7c41 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataVersionCollection.cs @@ -340,6 +340,80 @@ public virtual Response Exists(string version, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version} + /// + /// + /// Operation Id + /// DataVersions_Get + /// + /// + /// + /// Version identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningDataVersionDataVersionsClientDiagnostics.CreateScope("MachineLearningDataVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningDataVersionDataVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningDataVersionResource(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.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version} + /// + /// + /// Operation Id + /// DataVersions_Get + /// + /// + /// + /// Version identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningDataVersionDataVersionsClientDiagnostics.CreateScope("MachineLearningDataVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningDataVersionDataVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningDataVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDatastoreCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDatastoreCollection.cs index c18cd4be3097..f754301e14ec 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDatastoreCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDatastoreCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name} + /// + /// + /// Operation Id + /// Datastores_Get + /// + /// + /// + /// Datastore name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningDatastoreDatastoresClientDiagnostics.CreateScope("MachineLearningDatastoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningDatastoreDatastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningDatastoreResource(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.MachineLearningServices/workspaces/{workspaceName}/datastores/{name} + /// + /// + /// Operation Id + /// Datastores_Get + /// + /// + /// + /// Datastore name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningDatastoreDatastoresClientDiagnostics.CreateScope("MachineLearningDatastoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningDatastoreDatastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningDatastoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerCollection.cs index 93f0b91b645d..55825ab3d4c0 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name} + /// + /// + /// Operation Id + /// EnvironmentContainers_Get + /// + /// + /// + /// Container name. This is case-sensitive. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningEnvironmentContainerEnvironmentContainersClientDiagnostics.CreateScope("MachineLearningEnvironmentContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningEnvironmentContainerEnvironmentContainersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningEnvironmentContainerResource(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.MachineLearningServices/workspaces/{workspaceName}/environments/{name} + /// + /// + /// Operation Id + /// EnvironmentContainers_Get + /// + /// + /// + /// Container name. This is case-sensitive. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningEnvironmentContainerEnvironmentContainersClientDiagnostics.CreateScope("MachineLearningEnvironmentContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningEnvironmentContainerEnvironmentContainersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningEnvironmentContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentVersionCollection.cs index 21f4b502070b..115252f3d0eb 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentVersionCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string version, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version} + /// + /// + /// Operation Id + /// EnvironmentVersions_Get + /// + /// + /// + /// Version identifier. This is case-sensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningEnvironmentVersionEnvironmentVersionsClientDiagnostics.CreateScope("MachineLearningEnvironmentVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningEnvironmentVersionEnvironmentVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningEnvironmentVersionResource(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.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version} + /// + /// + /// Operation Id + /// EnvironmentVersions_Get + /// + /// + /// + /// Version identifier. This is case-sensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningEnvironmentVersionEnvironmentVersionsClientDiagnostics.CreateScope("MachineLearningEnvironmentVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningEnvironmentVersionEnvironmentVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningEnvironmentVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningJobCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningJobCollection.cs index f714649a6ce5..1b5d2cb9e26c 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningJobCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningJobCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string id, CancellationToken cancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The name and identifier for the Job. This is case-sensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _machineLearningJobJobsClientDiagnostics.CreateScope("MachineLearningJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningJobJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningJobResource(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.MachineLearningServices/workspaces/{workspaceName}/jobs/{id} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The name and identifier for the Job. This is case-sensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _machineLearningJobJobsClientDiagnostics.CreateScope("MachineLearningJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningJobJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerCollection.cs index 1e6c3a9f5c19..055774282b38 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name} + /// + /// + /// Operation Id + /// ModelContainers_Get + /// + /// + /// + /// Container name. This is case-sensitive. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningModelContainerModelContainersClientDiagnostics.CreateScope("MachineLearningModelContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningModelContainerModelContainersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningModelContainerResource(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.MachineLearningServices/workspaces/{workspaceName}/models/{name} + /// + /// + /// Operation Id + /// ModelContainers_Get + /// + /// + /// + /// Container name. This is case-sensitive. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningModelContainerModelContainersClientDiagnostics.CreateScope("MachineLearningModelContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningModelContainerModelContainersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningModelContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelVersionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelVersionCollection.cs index 5868a3b07c89..89cd8a5ebb9a 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelVersionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelVersionCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string version, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version} + /// + /// + /// Operation Id + /// ModelVersions_Get + /// + /// + /// + /// Version identifier. This is case-sensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningModelVersionModelVersionsClientDiagnostics.CreateScope("MachineLearningModelVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningModelVersionModelVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningModelVersionResource(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.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version} + /// + /// + /// Operation Id + /// ModelVersions_Get + /// + /// + /// + /// Version identifier. This is case-sensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _machineLearningModelVersionModelVersionsClientDiagnostics.CreateScope("MachineLearningModelVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningModelVersionModelVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningModelVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineDeploymentCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineDeploymentCollection.cs index fe9a7d27d83d..6ac0c79f06ee 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineDeploymentCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineDeploymentCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string deploymentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// OnlineDeployments_Get + /// + /// + /// + /// Inference Endpoint Deployment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _machineLearningOnlineDeploymentOnlineDeploymentsClientDiagnostics.CreateScope("MachineLearningOnlineDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningOnlineDeploymentOnlineDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningOnlineDeploymentResource(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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// OnlineDeployments_Get + /// + /// + /// + /// Inference Endpoint Deployment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _machineLearningOnlineDeploymentOnlineDeploymentsClientDiagnostics.CreateScope("MachineLearningOnlineDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningOnlineDeploymentOnlineDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningOnlineDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointCollection.cs index da1cc2416f15..7954248796b3 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string endpointName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName} + /// + /// + /// Operation Id + /// OnlineEndpoints_Get + /// + /// + /// + /// Online Endpoint name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _machineLearningOnlineEndpointOnlineEndpointsClientDiagnostics.CreateScope("MachineLearningOnlineEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningOnlineEndpointOnlineEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningOnlineEndpointResource(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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName} + /// + /// + /// Operation Id + /// OnlineEndpoints_Get + /// + /// + /// + /// Online Endpoint name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _machineLearningOnlineEndpointOnlineEndpointsClientDiagnostics.CreateScope("MachineLearningOnlineEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningOnlineEndpointOnlineEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningOnlineEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningPrivateEndpointConnectionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningPrivateEndpointConnectionCollection.cs index a7f486015484..740303572373 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningPrivateEndpointConnectionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _machineLearningPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("MachineLearningPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningPrivateEndpointConnectionResource(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.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _machineLearningPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("MachineLearningPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningScheduleCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningScheduleCollection.cs index ec6251d493c0..9a4119955af2 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningScheduleCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningScheduleCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name} + /// + /// + /// Operation Id + /// Schedules_Get + /// + /// + /// + /// Schedule name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningScheduleSchedulesClientDiagnostics.CreateScope("MachineLearningScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningScheduleResource(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.MachineLearningServices/workspaces/{workspaceName}/schedules/{name} + /// + /// + /// Operation Id + /// Schedules_Get + /// + /// + /// + /// Schedule name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _machineLearningScheduleSchedulesClientDiagnostics.CreateScope("MachineLearningScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceCollection.cs index 1ba2b9200b16..d9e845e5e7f0 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// Name of Azure Machine Learning workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _machineLearningWorkspaceWorkspacesClientDiagnostics.CreateScope("MachineLearningWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningWorkspaceWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningWorkspaceResource(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.MachineLearningServices/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// Name of Azure Machine Learning workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _machineLearningWorkspaceWorkspacesClientDiagnostics.CreateScope("MachineLearningWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceConnectionCollection.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceConnectionCollection.cs index 45d050447d44..4b389d7481fe 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceConnectionCollection.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName} + /// + /// + /// Operation Id + /// WorkspaceConnections_Get + /// + /// + /// + /// Friendly name of the workspace connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _machineLearningWorkspaceConnectionWorkspaceConnectionsClientDiagnostics.CreateScope("MachineLearningWorkspaceConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineLearningWorkspaceConnectionWorkspaceConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningWorkspaceConnectionResource(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.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName} + /// + /// + /// Operation Id + /// WorkspaceConnections_Get + /// + /// + /// + /// Friendly name of the workspace connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _machineLearningWorkspaceConnectionWorkspaceConnectionsClientDiagnostics.CreateScope("MachineLearningWorkspaceConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineLearningWorkspaceConnectionWorkspaceConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineLearningWorkspaceConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateCollection.cs index ed0e66d546c5..c87dd776f072 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -86,5 +87,50 @@ public async Task Exists_ApplyUpdatesGet() Console.WriteLine($"Succeeded: {result}"); } + + // ApplyUpdates_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApplyUpdatesGet() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json + // this example is just showing the usage of "ApplyUpdates_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 = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MaintenanceApplyUpdateResource + MaintenanceApplyUpdateCollection collection = resourceGroupResource.GetMaintenanceApplyUpdates(); + + // invoke the operation + string providerName = "Microsoft.Compute"; + string resourceType = "virtualMachineScaleSets"; + string resourceName = "smdtest1"; + string applyUpdateName = "e9b9685d-78e4-44c4-a81c-64a14f9b87b6"; + NullableResponse response = await collection.GetIfExistsAsync(providerName, resourceType, resourceName, applyUpdateName); + MaintenanceApplyUpdateResource 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 + MaintenanceApplyUpdateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationCollection.cs index 1fc6ede572a8..dc8cecace5e7 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_MaintenanceConfigurationsGetForResource() Console.WriteLine($"Succeeded: {result}"); } + // MaintenanceConfigurations_GetForResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MaintenanceConfigurationsGetForResource() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json + // this example is just showing the usage of "MaintenanceConfigurations_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 = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MaintenanceConfigurationResource + MaintenanceConfigurationCollection collection = resourceGroupResource.GetMaintenanceConfigurations(); + + // invoke the operation + string resourceName = "configuration1"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + MaintenanceConfigurationResource 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 + MaintenanceConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MaintenanceConfigurations_GetForResource_GuestOSPatchLinux [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -147,6 +189,48 @@ public async Task Exists_MaintenanceConfigurationsGetForResourceGuestOSPatchLinu Console.WriteLine($"Succeeded: {result}"); } + // MaintenanceConfigurations_GetForResource_GuestOSPatchLinux + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MaintenanceConfigurationsGetForResourceGuestOSPatchLinux() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json + // this example is just showing the usage of "MaintenanceConfigurations_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 = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MaintenanceConfigurationResource + MaintenanceConfigurationCollection collection = resourceGroupResource.GetMaintenanceConfigurations(); + + // invoke the operation + string resourceName = "configuration1"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + MaintenanceConfigurationResource 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 + MaintenanceConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MaintenanceConfigurations_GetForResource_GuestOSPatchWindows [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -211,6 +295,48 @@ public async Task Exists_MaintenanceConfigurationsGetForResourceGuestOSPatchWind Console.WriteLine($"Succeeded: {result}"); } + // MaintenanceConfigurations_GetForResource_GuestOSPatchWindows + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MaintenanceConfigurationsGetForResourceGuestOSPatchWindows() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json + // this example is just showing the usage of "MaintenanceConfigurations_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 = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MaintenanceConfigurationResource + MaintenanceConfigurationCollection collection = resourceGroupResource.GetMaintenanceConfigurations(); + + // invoke the operation + string resourceName = "configuration1"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + MaintenanceConfigurationResource 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 + MaintenanceConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MaintenanceConfigurations_CreateOrUpdateForResource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationCollection.cs index c5f01e15a877..626979eba197 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_PublicMaintenanceConfigurationsGetForResource() Console.WriteLine($"Succeeded: {result}"); } + + // PublicMaintenanceConfigurations_GetForResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PublicMaintenanceConfigurationsGetForResource() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json + // this example is just showing the usage of "PublicMaintenanceConfigurations_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this MaintenancePublicConfigurationResource + MaintenancePublicConfigurationCollection collection = subscriptionResource.GetMaintenancePublicConfigurations(); + + // invoke the operation + string resourceName = "configuration1"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + MaintenancePublicConfigurationResource 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 + MaintenanceConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateCollection.cs index c92249e30043..b826253b54c2 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateCollection.cs @@ -218,5 +218,91 @@ public virtual Response Exists(string providerName, string resourceType, s throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_Get + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// applyUpdate Id. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual async Task> GetIfExistsAsync(string providerName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); + + using var scope = _maintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MaintenanceApplyUpdateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _maintenanceApplyUpdateApplyUpdatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, applyUpdateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MaintenanceApplyUpdateResource(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/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_Get + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// applyUpdate Id. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual NullableResponse GetIfExists(string providerName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); + + using var scope = _maintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MaintenanceApplyUpdateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _maintenanceApplyUpdateApplyUpdatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, applyUpdateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationCollection.cs index df910840b43e..5b1658abe586 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName} + /// + /// + /// Operation Id + /// MaintenanceConfigurations_Get + /// + /// + /// + /// Maintenance Configuration Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _maintenanceConfigurationClientDiagnostics.CreateScope("MaintenanceConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _maintenanceConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MaintenanceConfigurationResource(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.Maintenance/maintenanceConfigurations/{resourceName} + /// + /// + /// Operation Id + /// MaintenanceConfigurations_Get + /// + /// + /// + /// Maintenance Configuration Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _maintenanceConfigurationClientDiagnostics.CreateScope("MaintenanceConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _maintenanceConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MaintenanceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenancePublicConfigurationCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenancePublicConfigurationCollection.cs index 95231c72a3c6..92a0c0c70599 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenancePublicConfigurationCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenancePublicConfigurationCollection.cs @@ -240,6 +240,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName} + /// + /// + /// Operation Id + /// PublicMaintenanceConfigurations_Get + /// + /// + /// + /// Maintenance Configuration Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _maintenancePublicConfigurationPublicMaintenanceConfigurationsClientDiagnostics.CreateScope("MaintenancePublicConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _maintenancePublicConfigurationPublicMaintenanceConfigurationsRestClient.GetAsync(Id.SubscriptionId, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MaintenancePublicConfigurationResource(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}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName} + /// + /// + /// Operation Id + /// PublicMaintenanceConfigurations_Get + /// + /// + /// + /// Maintenance Configuration Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _maintenancePublicConfigurationPublicMaintenanceConfigurationsClientDiagnostics.CreateScope("MaintenancePublicConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _maintenancePublicConfigurationPublicMaintenanceConfigurationsRestClient.Get(Id.SubscriptionId, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MaintenancePublicConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkCollection.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkCollection.cs index a28ca738309f..e79e178617a7 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkCollection.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_ManagedNetworksGet() Console.WriteLine($"Succeeded: {result}"); } + // ManagedNetworksGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagedNetworksGet() + { + // Generated from example definition: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksGet.json + // this example is just showing the usage of "ManagedNetworks_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 = "subscriptionA"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedNetworkResource + ManagedNetworkCollection collection = resourceGroupResource.GetManagedNetworks(); + + // invoke the operation + string managedNetworkName = "myManagedNetwork"; + NullableResponse response = await collection.GetIfExistsAsync(managedNetworkName); + ManagedNetworkResource 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 + ManagedNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ManagedNetworksPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkGroupCollection.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkGroupCollection.cs index 8230797a06d7..73648ca190d0 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkGroupCollection.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkGroupCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ManagementNetworkGroupsGet() Console.WriteLine($"Succeeded: {result}"); } + // ManagementNetworkGroupsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagementNetworkGroupsGet() + { + // Generated from example definition: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsGet.json + // this example is just showing the usage of "ManagedNetworkGroups_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 ManagedNetworkResource created on azure + // for more information of creating ManagedNetworkResource, please refer to the document of ManagedNetworkResource + string subscriptionId = "subscriptionA"; + string resourceGroupName = "myResourceGroup"; + string managedNetworkName = "myManagedNetwork"; + ResourceIdentifier managedNetworkResourceId = ManagedNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedNetworkName); + ManagedNetworkResource managedNetwork = client.GetManagedNetworkResource(managedNetworkResourceId); + + // get the collection of this ManagedNetworkGroupResource + ManagedNetworkGroupCollection collection = managedNetwork.GetManagedNetworkGroups(); + + // invoke the operation + string managedNetworkGroupName = "myManagedNetworkGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(managedNetworkGroupName); + ManagedNetworkGroupResource 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 + ManagedNetworkGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ManagementNetworkGroupsPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkPeeringPolicyCollection.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkPeeringPolicyCollection.cs index 7ce20323c3d4..54fcc7d5428e 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkPeeringPolicyCollection.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ManagedNetworkPeeringPolicyCollection.cs @@ -85,6 +85,49 @@ public async Task Exists_ManagedNetworkPeeringPoliciesGet() Console.WriteLine($"Succeeded: {result}"); } + // ManagedNetworkPeeringPoliciesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagedNetworkPeeringPoliciesGet() + { + // Generated from example definition: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesGet.json + // this example is just showing the usage of "ManagedNetworkPeeringPolicies_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 ManagedNetworkResource created on azure + // for more information of creating ManagedNetworkResource, please refer to the document of ManagedNetworkResource + string subscriptionId = "subscriptionA"; + string resourceGroupName = "myResourceGroup"; + string managedNetworkName = "myManagedNetwork"; + ResourceIdentifier managedNetworkResourceId = ManagedNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedNetworkName); + ManagedNetworkResource managedNetwork = client.GetManagedNetworkResource(managedNetworkResourceId); + + // get the collection of this ManagedNetworkPeeringPolicyResource + ManagedNetworkPeeringPolicyCollection collection = managedNetwork.GetManagedNetworkPeeringPolicies(); + + // invoke the operation + string managedNetworkPeeringPolicyName = "myHubAndSpoke"; + NullableResponse response = await collection.GetIfExistsAsync(managedNetworkPeeringPolicyName); + ManagedNetworkPeeringPolicyResource 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 + ManagedNetworkPeeringPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ManagedNetworkPeeringPoliciesPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ScopeAssignmentCollection.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ScopeAssignmentCollection.cs index 226d05723941..dd9dbf9a28e9 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ScopeAssignmentCollection.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/samples/Generated/Samples/Sample_ScopeAssignmentCollection.cs @@ -77,6 +77,46 @@ public async Task Exists_ScopeAssignmentsGet() Console.WriteLine($"Succeeded: {result}"); } + // ScopeAssignmentsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ScopeAssignmentsGet() + { + // Generated from example definition: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsGet.json + // this example is just showing the usage of "ScopeAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ScopeAssignmentResource + string scope = "subscriptions/subscriptionC"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + ScopeAssignmentCollection collection = client.GetScopeAssignments(scopeId); + + // invoke the operation + string scopeAssignmentName = "subscriptionCAssignment"; + NullableResponse response = await collection.GetIfExistsAsync(scopeAssignmentName); + ScopeAssignmentResource 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 + ScopeAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ScopeAssignmentsPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkCollection.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkCollection.cs index 93e98655d406..ee1123e3abc8 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkCollection.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string managedNetworkName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName} + /// + /// + /// Operation Id + /// ManagedNetworks_Get + /// + /// + /// + /// The name of the Managed Network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedNetworkName, nameof(managedNetworkName)); + + using var scope = _managedNetworkClientDiagnostics.CreateScope("ManagedNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, managedNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedNetworkResource(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.ManagedNetwork/managedNetworks/{managedNetworkName} + /// + /// + /// Operation Id + /// ManagedNetworks_Get + /// + /// + /// + /// The name of the Managed Network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedNetworkName, nameof(managedNetworkName)); + + using var scope = _managedNetworkClientDiagnostics.CreateScope("ManagedNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, managedNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkGroupCollection.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkGroupCollection.cs index fa9fd6b784bd..0472c7d4a725 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkGroupCollection.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkGroupCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string managedNetworkGroupName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName} + /// + /// + /// Operation Id + /// ManagedNetworkGroups_Get + /// + /// + /// + /// The name of the Managed Network Group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedNetworkGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedNetworkGroupName, nameof(managedNetworkGroupName)); + + using var scope = _managedNetworkGroupClientDiagnostics.CreateScope("ManagedNetworkGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedNetworkGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedNetworkGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedNetworkGroupResource(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.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName} + /// + /// + /// Operation Id + /// ManagedNetworkGroups_Get + /// + /// + /// + /// The name of the Managed Network Group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedNetworkGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedNetworkGroupName, nameof(managedNetworkGroupName)); + + using var scope = _managedNetworkGroupClientDiagnostics.CreateScope("ManagedNetworkGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedNetworkGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedNetworkGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedNetworkGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkPeeringPolicyCollection.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkPeeringPolicyCollection.cs index 4a6396ff6a6e..a7fc146a754d 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkPeeringPolicyCollection.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkPeeringPolicyCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string managedNetworkPeeringPolicyName, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName} + /// + /// + /// Operation Id + /// ManagedNetworkPeeringPolicies_Get + /// + /// + /// + /// The name of the Managed Network Peering Policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedNetworkPeeringPolicyName, nameof(managedNetworkPeeringPolicyName)); + + using var scope = _managedNetworkPeeringPolicyClientDiagnostics.CreateScope("ManagedNetworkPeeringPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedNetworkPeeringPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedNetworkPeeringPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedNetworkPeeringPolicyResource(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.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName} + /// + /// + /// Operation Id + /// ManagedNetworkPeeringPolicies_Get + /// + /// + /// + /// The name of the Managed Network Peering Policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedNetworkPeeringPolicyName, nameof(managedNetworkPeeringPolicyName)); + + using var scope = _managedNetworkPeeringPolicyClientDiagnostics.CreateScope("ManagedNetworkPeeringPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedNetworkPeeringPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedNetworkPeeringPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedNetworkPeeringPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ScopeAssignmentCollection.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ScopeAssignmentCollection.cs index b39ae3dc149d..4d399ecf5650 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ScopeAssignmentCollection.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ScopeAssignmentCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string scopeAssignmentName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName} + /// + /// + /// Operation Id + /// ScopeAssignments_Get + /// + /// + /// + /// The name of the scope assignment to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scopeAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeAssignmentName, nameof(scopeAssignmentName)); + + using var scope = _scopeAssignmentClientDiagnostics.CreateScope("ScopeAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scopeAssignmentRestClient.GetAsync(Id, scopeAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScopeAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName} + /// + /// + /// Operation Id + /// ScopeAssignments_Get + /// + /// + /// + /// The name of the scope assignment to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scopeAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeAssignmentName, nameof(scopeAssignmentName)); + + using var scope = _scopeAssignmentClientDiagnostics.CreateScope("ScopeAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scopeAssignmentRestClient.Get(Id, scopeAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScopeAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceCollection.cs index 63c734cbe000..a15d87808295 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceCollection.cs @@ -128,6 +128,48 @@ public async Task Exists_NetworkDevicesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkDevices_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkDevicesGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkDevices_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkDevices_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkDeviceResource + NetworkDeviceCollection collection = resourceGroupResource.GetNetworkDevices(); + + // invoke the operation + string networkDeviceName = "example-device"; + NullableResponse response = await collection.GetIfExistsAsync(networkDeviceName); + NetworkDeviceResource 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 + NetworkDeviceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkDevices_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceInterfaceCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceInterfaceCollection.cs index 83eab6420920..294f4afeda2f 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceInterfaceCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceInterfaceCollection.cs @@ -123,6 +123,49 @@ public async Task Exists_NetworkInterfacesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkInterfaces_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkInterfacesGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkInterfaces_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkInterfaces_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 NetworkDeviceResource created on azure + // for more information of creating NetworkDeviceResource, please refer to the document of NetworkDeviceResource + string subscriptionId = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + string networkDeviceName = "example-device"; + ResourceIdentifier networkDeviceResourceId = NetworkDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkDeviceName); + NetworkDeviceResource networkDevice = client.GetNetworkDeviceResource(networkDeviceResourceId); + + // get the collection of this NetworkDeviceInterfaceResource + NetworkDeviceInterfaceCollection collection = networkDevice.GetNetworkDeviceInterfaces(); + + // invoke the operation + string networkInterfaceName = "example-interface"; + NullableResponse response = await collection.GetIfExistsAsync(networkInterfaceName); + NetworkDeviceInterfaceResource 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 + NetworkDeviceInterfaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkInterfaces_ListByNetworkDevice_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceSkuCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceSkuCollection.cs index ad3e42816a0e..cedcb6ec0c00 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceSkuCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkDeviceSkuCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -79,6 +80,47 @@ public async Task Exists_NetworkDeviceSkusGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkDeviceSkus_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkDeviceSkusGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkDeviceSkus_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkDeviceSkus_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this NetworkDeviceSkuResource + NetworkDeviceSkuCollection collection = subscriptionResource.GetNetworkDeviceSkus(); + + // invoke the operation + string networkDeviceSkuName = "example-deviceSku"; + NullableResponse response = await collection.GetIfExistsAsync(networkDeviceSkuName); + NetworkDeviceSkuResource 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 + NetworkDeviceSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkDeviceSkus_ListBySubscription_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricAccessControlListCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricAccessControlListCollection.cs index ade400154252..6d58e4e3c130 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricAccessControlListCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricAccessControlListCollection.cs @@ -260,6 +260,48 @@ public async Task Exists_AccessControlListsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // AccessControlLists_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AccessControlListsGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/AccessControlLists_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AccessControlLists_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricAccessControlListResource + NetworkFabricAccessControlListCollection collection = resourceGroupResource.GetNetworkFabricAccessControlLists(); + + // invoke the operation + string accessControlListName = "example-acl"; + NullableResponse response = await collection.GetIfExistsAsync(accessControlListName); + NetworkFabricAccessControlListResource 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 + NetworkFabricAccessControlListData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AccessControlLists_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricCollection.cs index bdd53f8e3167..e6a6e3a7e9b8 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricCollection.cs @@ -233,6 +233,48 @@ public async Task Exists_NetworkFabricsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkFabrics_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkFabricsGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkFabrics_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkFabrics_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricResource + NetworkFabricCollection collection = resourceGroupResource.GetNetworkFabrics(); + + // invoke the operation + string networkFabricName = "example-fabric"; + NullableResponse response = await collection.GetIfExistsAsync(networkFabricName); + NetworkFabricResource 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 + NetworkFabricData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkFabrics_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricControllerCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricControllerCollection.cs index 86981835ef98..f1e5621b3dff 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricControllerCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricControllerCollection.cs @@ -145,6 +145,48 @@ public async Task Exists_NetworkFabricControllersGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkFabricControllers_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkFabricControllersGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkFabricControllers_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkFabricControllers_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricControllerResource + NetworkFabricControllerCollection collection = resourceGroupResource.GetNetworkFabricControllers(); + + // invoke the operation + string networkFabricControllerName = "example-networkController"; + NullableResponse response = await collection.GetIfExistsAsync(networkFabricControllerName); + NetworkFabricControllerResource 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 + NetworkFabricControllerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkFabricControllers_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricExternalNetworkCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricExternalNetworkCollection.cs index 82d8cdd5bdcc..e00f9906754b 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricExternalNetworkCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricExternalNetworkCollection.cs @@ -183,6 +183,49 @@ public async Task Exists_ExternalNetworksGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // ExternalNetworks_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExternalNetworksGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/ExternalNetworks_Get_MaximumSet_Gen.json + // this example is just showing the usage of "ExternalNetworks_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 NetworkFabricL3IsolationDomainResource created on azure + // for more information of creating NetworkFabricL3IsolationDomainResource, please refer to the document of NetworkFabricL3IsolationDomainResource + string subscriptionId = "42EEDB3B-8E17-46E3-B0B4-B1CD9842D90D"; + string resourceGroupName = "rgL3IsolationDomains"; + string l3IsolationDomainName = "yhtr"; + ResourceIdentifier networkFabricL3IsolationDomainResourceId = NetworkFabricL3IsolationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, l3IsolationDomainName); + NetworkFabricL3IsolationDomainResource networkFabricL3IsolationDomain = client.GetNetworkFabricL3IsolationDomainResource(networkFabricL3IsolationDomainResourceId); + + // get the collection of this NetworkFabricExternalNetworkResource + NetworkFabricExternalNetworkCollection collection = networkFabricL3IsolationDomain.GetNetworkFabricExternalNetworks(); + + // invoke the operation + string externalNetworkName = "fltpszzikbalrzaqq"; + NullableResponse response = await collection.GetIfExistsAsync(externalNetworkName); + NetworkFabricExternalNetworkResource 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 + NetworkFabricExternalNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExternalNetworks_ListByL3IsolationDomain_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPCommunityCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPCommunityCollection.cs index 3a04f6959fb3..9d2b140ce7c8 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPCommunityCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPCommunityCollection.cs @@ -139,6 +139,48 @@ public async Task Exists_IpCommunitiesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // IpCommunities_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_IpCommunitiesGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/IpCommunities_Get_MaximumSet_Gen.json + // this example is just showing the usage of "IpCommunities_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricIPCommunityResource + NetworkFabricIPCommunityCollection collection = resourceGroupResource.GetNetworkFabricIPCommunities(); + + // invoke the operation + string ipCommunityName = "example-ipcommunity"; + NullableResponse response = await collection.GetIfExistsAsync(ipCommunityName); + NetworkFabricIPCommunityResource 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 + NetworkFabricIPCommunityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // IpCommunities_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPExtendedCommunityCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPExtendedCommunityCollection.cs index 11993f286853..d88edcdc8e61 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPExtendedCommunityCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPExtendedCommunityCollection.cs @@ -132,6 +132,48 @@ public async Task Exists_IpExtendedCommunitiesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // IpExtendedCommunities_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_IpExtendedCommunitiesGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/IpExtendedCommunities_Get_MaximumSet_Gen.json + // this example is just showing the usage of "IpExtendedCommunities_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricIPExtendedCommunityResource + NetworkFabricIPExtendedCommunityCollection collection = resourceGroupResource.GetNetworkFabricIPExtendedCommunities(); + + // invoke the operation + string ipExtendedCommunityName = "example-ipExtendedCommunity"; + NullableResponse response = await collection.GetIfExistsAsync(ipExtendedCommunityName); + NetworkFabricIPExtendedCommunityResource 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 + NetworkFabricIPExtendedCommunityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // IpExtendedCommunities_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPPrefixCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPPrefixCollection.cs index b79f04ca8c0f..9511e3447ed7 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPPrefixCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricIPPrefixCollection.cs @@ -134,6 +134,48 @@ public async Task Exists_IpPrefixesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // IpPrefixes_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_IpPrefixesGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/IpPrefixes_Get_MaximumSet_Gen.json + // this example is just showing the usage of "IpPrefixes_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricIPPrefixResource + NetworkFabricIPPrefixCollection collection = resourceGroupResource.GetNetworkFabricIPPrefixes(); + + // invoke the operation + string ipPrefixName = "example-ipPrefix"; + NullableResponse response = await collection.GetIfExistsAsync(ipPrefixName); + NetworkFabricIPPrefixResource 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 + NetworkFabricIPPrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // IpPrefixes_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternalNetworkCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternalNetworkCollection.cs index 1c1ae224bfe8..b50d60944ca3 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternalNetworkCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternalNetworkCollection.cs @@ -213,6 +213,49 @@ public async Task Exists_InternalNetworksGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // InternalNetworks_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_InternalNetworksGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/InternalNetworks_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InternalNetworks_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 NetworkFabricL3IsolationDomainResource created on azure + // for more information of creating NetworkFabricL3IsolationDomainResource, please refer to the document of NetworkFabricL3IsolationDomainResource + string subscriptionId = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + string l3IsolationDomainName = "example-l3domain"; + ResourceIdentifier networkFabricL3IsolationDomainResourceId = NetworkFabricL3IsolationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, l3IsolationDomainName); + NetworkFabricL3IsolationDomainResource networkFabricL3IsolationDomain = client.GetNetworkFabricL3IsolationDomainResource(networkFabricL3IsolationDomainResourceId); + + // get the collection of this NetworkFabricInternalNetworkResource + NetworkFabricInternalNetworkCollection collection = networkFabricL3IsolationDomain.GetNetworkFabricInternalNetworks(); + + // invoke the operation + string internalNetworkName = "example-internalnetwork"; + NullableResponse response = await collection.GetIfExistsAsync(internalNetworkName); + NetworkFabricInternalNetworkResource 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 + NetworkFabricInternalNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // InternalNetworks_ListByL3IsolationDomain_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternetGatewayCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternetGatewayCollection.cs index d73047218d13..f04a7f01f5f8 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternetGatewayCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternetGatewayCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -81,6 +82,48 @@ public async Task Exists_InternetGatewaysGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // InternetGateways_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_InternetGatewaysGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/InternetGateways_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InternetGateways_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricInternetGatewayResource + NetworkFabricInternetGatewayCollection collection = resourceGroupResource.GetNetworkFabricInternetGateways(); + + // invoke the operation + string internetGatewayName = "example-internetGateway"; + NullableResponse response = await collection.GetIfExistsAsync(internetGatewayName); + NetworkFabricInternetGatewayResource 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 + NetworkFabricInternetGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // InternetGateways_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternetGatewayRuleCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternetGatewayRuleCollection.cs index fccc39bf339a..3352f46d5393 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternetGatewayRuleCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricInternetGatewayRuleCollection.cs @@ -129,6 +129,48 @@ public async Task Exists_InternetGatewayRulesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // InternetGatewayRules_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_InternetGatewayRulesGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/InternetGatewayRules_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InternetGatewayRules_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricInternetGatewayRuleResource + NetworkFabricInternetGatewayRuleCollection collection = resourceGroupResource.GetNetworkFabricInternetGatewayRules(); + + // invoke the operation + string internetGatewayRuleName = "example-internetGatewayRule"; + NullableResponse response = await collection.GetIfExistsAsync(internetGatewayRuleName); + NetworkFabricInternetGatewayRuleResource 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 + NetworkFabricInternetGatewayRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // InternetGatewayRules_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricL2IsolationDomainCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricL2IsolationDomainCollection.cs index fc9c297f399e..4575b722e59f 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricL2IsolationDomainCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricL2IsolationDomainCollection.cs @@ -126,6 +126,48 @@ public async Task Exists_L2IsolationDomainsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // L2IsolationDomains_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_L2IsolationDomainsGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/L2IsolationDomains_Get_MaximumSet_Gen.json + // this example is just showing the usage of "L2IsolationDomains_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricL2IsolationDomainResource + NetworkFabricL2IsolationDomainCollection collection = resourceGroupResource.GetNetworkFabricL2IsolationDomains(); + + // invoke the operation + string l2IsolationDomainName = "example-l2Domain"; + NullableResponse response = await collection.GetIfExistsAsync(l2IsolationDomainName); + NetworkFabricL2IsolationDomainResource 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 + NetworkFabricL2IsolationDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // L2IsolationDomains_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricL3IsolationDomainCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricL3IsolationDomainCollection.cs index 02a16d017dbc..bdf90d5f00d1 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricL3IsolationDomainCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricL3IsolationDomainCollection.cs @@ -148,6 +148,48 @@ public async Task Exists_L3IsolationDomainsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // L3IsolationDomains_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_L3IsolationDomainsGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/L3IsolationDomains_Get_MaximumSet_Gen.json + // this example is just showing the usage of "L3IsolationDomains_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricL3IsolationDomainResource + NetworkFabricL3IsolationDomainCollection collection = resourceGroupResource.GetNetworkFabricL3IsolationDomains(); + + // invoke the operation + string l3IsolationDomainName = "example-l3domain"; + NullableResponse response = await collection.GetIfExistsAsync(l3IsolationDomainName); + NetworkFabricL3IsolationDomainResource 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 + NetworkFabricL3IsolationDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // L3IsolationDomains_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricNeighborGroupCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricNeighborGroupCollection.cs index 61eca599d223..08e389675bf4 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricNeighborGroupCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricNeighborGroupCollection.cs @@ -138,6 +138,48 @@ public async Task Exists_NeighborGroupsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NeighborGroups_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NeighborGroupsGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NeighborGroups_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NeighborGroups_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricNeighborGroupResource + NetworkFabricNeighborGroupCollection collection = resourceGroupResource.GetNetworkFabricNeighborGroups(); + + // invoke the operation + string neighborGroupName = "example-neighborGroup"; + NullableResponse response = await collection.GetIfExistsAsync(neighborGroupName); + NetworkFabricNeighborGroupResource 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 + NetworkFabricNeighborGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NeighborGroups_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricRoutePolicyCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricRoutePolicyCollection.cs index cc64b9cbcae4..76dc5f092b31 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricRoutePolicyCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricRoutePolicyCollection.cs @@ -180,6 +180,48 @@ public async Task Exists_RoutePoliciesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // RoutePolicies_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RoutePoliciesGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/RoutePolicies_Get_MaximumSet_Gen.json + // this example is just showing the usage of "RoutePolicies_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFabricRoutePolicyResource + NetworkFabricRoutePolicyCollection collection = resourceGroupResource.GetNetworkFabricRoutePolicies(); + + // invoke the operation + string routePolicyName = "example-routePolicy"; + NullableResponse response = await collection.GetIfExistsAsync(routePolicyName); + NetworkFabricRoutePolicyResource 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 + NetworkFabricRoutePolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RoutePolicies_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricSkuCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricSkuCollection.cs index c53fe42d3983..69cea65c16a8 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricSkuCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkFabricSkuCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -79,6 +80,47 @@ public async Task Exists_NetworkFabricSkusGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkFabricSkus_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkFabricSkusGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkFabricSkus_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkFabricSkus_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this NetworkFabricSkuResource + NetworkFabricSkuCollection collection = subscriptionResource.GetNetworkFabricSkus(); + + // invoke the operation + string networkFabricSkuName = "example-fabricsku"; + NullableResponse response = await collection.GetIfExistsAsync(networkFabricSkuName); + NetworkFabricSkuResource 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 + NetworkFabricSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkFabricSkus_ListBySubscription_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkPacketBrokerCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkPacketBrokerCollection.cs index e0953fd634ef..94b4d2a0ef9e 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkPacketBrokerCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkPacketBrokerCollection.cs @@ -124,6 +124,48 @@ public async Task Exists_NetworkPacketBrokersGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkPacketBrokers_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkPacketBrokersGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkPacketBrokers_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkPacketBrokers_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkPacketBrokerResource + NetworkPacketBrokerCollection collection = resourceGroupResource.GetNetworkPacketBrokers(); + + // invoke the operation + string networkPacketBrokerName = "example-networkPacketBroker"; + NullableResponse response = await collection.GetIfExistsAsync(networkPacketBrokerName); + NetworkPacketBrokerResource 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 + NetworkPacketBrokerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkPacketBrokers_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkRackCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkRackCollection.cs index 61fcb2662910..a99a15fc8b85 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkRackCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkRackCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_NetworkRacksGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkRacks_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkRacksGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkRacks_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkRacks_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkRackResource + NetworkRackCollection collection = resourceGroupResource.GetNetworkRacks(); + + // invoke the operation + string networkRackName = "example-rack"; + NullableResponse response = await collection.GetIfExistsAsync(networkRackName); + NetworkRackResource 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 + NetworkRackData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkRacks_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkTapCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkTapCollection.cs index db0cabbf6f27..63929c1c49f5 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkTapCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkTapCollection.cs @@ -144,6 +144,48 @@ public async Task Exists_NetworkTapsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkTaps_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkTapsGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkTaps_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkTaps_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkTapResource + NetworkTapCollection collection = resourceGroupResource.GetNetworkTaps(); + + // invoke the operation + string networkTapName = "example-networkTap"; + NullableResponse response = await collection.GetIfExistsAsync(networkTapName); + NetworkTapResource 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 + NetworkTapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkTaps_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkTapRuleCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkTapRuleCollection.cs index db4a83ae92ea..3864cc0fec29 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkTapRuleCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkTapRuleCollection.cs @@ -247,6 +247,48 @@ public async Task Exists_NetworkTapRulesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkTapRules_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkTapRulesGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkTapRules_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkTapRules_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 = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkTapRuleResource + NetworkTapRuleCollection collection = resourceGroupResource.GetNetworkTapRules(); + + // invoke the operation + string networkTapRuleName = "example-tapRule"; + NullableResponse response = await collection.GetIfExistsAsync(networkTapRuleName); + NetworkTapRuleResource 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 + NetworkTapRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkTapRules_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkToNetworkInterconnectCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkToNetworkInterconnectCollection.cs index 9ea0cf90dfe3..5b70036ea82d 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkToNetworkInterconnectCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/samples/Generated/Samples/Sample_NetworkToNetworkInterconnectCollection.cs @@ -176,6 +176,49 @@ public async Task Exists_NetworkToNetworkInterconnectsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // NetworkToNetworkInterconnects_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkToNetworkInterconnectsGetMaximumSetGen() + { + // Generated from example definition: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkToNetworkInterconnects_Get_MaximumSet_Gen.json + // this example is just showing the usage of "NetworkToNetworkInterconnects_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 NetworkFabricResource created on azure + // for more information of creating NetworkFabricResource, please refer to the document of NetworkFabricResource + string subscriptionId = "1234ABCD-0A1B-1234-5678-123456ABCDEF"; + string resourceGroupName = "example-rg"; + string networkFabricName = "example-fabric"; + ResourceIdentifier networkFabricResourceId = NetworkFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFabricName); + NetworkFabricResource networkFabric = client.GetNetworkFabricResource(networkFabricResourceId); + + // get the collection of this NetworkToNetworkInterconnectResource + NetworkToNetworkInterconnectCollection collection = networkFabric.GetNetworkToNetworkInterconnects(); + + // invoke the operation + string networkToNetworkInterconnectName = "example-nni"; + NullableResponse response = await collection.GetIfExistsAsync(networkToNetworkInterconnectName); + NetworkToNetworkInterconnectResource 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 + NetworkToNetworkInterconnectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkToNetworkInterconnects_ListByNetworkFabric_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceCollection.cs index dd9ab259039c..542804933196 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string networkDeviceName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName} + /// + /// + /// Operation Id + /// NetworkDevices_Get + /// + /// + /// + /// Name of the Network Device. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkDeviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkDeviceName, nameof(networkDeviceName)); + + using var scope = _networkDeviceClientDiagnostics.CreateScope("NetworkDeviceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkDeviceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkDeviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkDeviceResource(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.ManagedNetworkFabric/networkDevices/{networkDeviceName} + /// + /// + /// Operation Id + /// NetworkDevices_Get + /// + /// + /// + /// Name of the Network Device. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkDeviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkDeviceName, nameof(networkDeviceName)); + + using var scope = _networkDeviceClientDiagnostics.CreateScope("NetworkDeviceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkDeviceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkDeviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkDeviceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceInterfaceCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceInterfaceCollection.cs index 9ebe0c322fac..60a20ed42aca 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceInterfaceCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceInterfaceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string networkInterfaceName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName} + /// + /// + /// Operation Id + /// NetworkInterfaces_Get + /// + /// + /// + /// Name of the Network Interface. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkInterfaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkInterfaceName, nameof(networkInterfaceName)); + + using var scope = _networkDeviceInterfaceNetworkInterfacesClientDiagnostics.CreateScope("NetworkDeviceInterfaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkDeviceInterfaceNetworkInterfacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkInterfaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkDeviceInterfaceResource(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.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName} + /// + /// + /// Operation Id + /// NetworkInterfaces_Get + /// + /// + /// + /// Name of the Network Interface. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkInterfaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkInterfaceName, nameof(networkInterfaceName)); + + using var scope = _networkDeviceInterfaceNetworkInterfacesClientDiagnostics.CreateScope("NetworkDeviceInterfaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkDeviceInterfaceNetworkInterfacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkInterfaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkDeviceInterfaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceSkuCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceSkuCollection.cs index 44c40ee83e1f..852d1020b5fb 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceSkuCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceSkuCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string networkDeviceSkuName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus/{networkDeviceSkuName} + /// + /// + /// Operation Id + /// NetworkDeviceSkus_Get + /// + /// + /// + /// Name of the Network Device SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkDeviceSkuName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkDeviceSkuName, nameof(networkDeviceSkuName)); + + using var scope = _networkDeviceSkuClientDiagnostics.CreateScope("NetworkDeviceSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkDeviceSkuRestClient.GetAsync(Id.SubscriptionId, networkDeviceSkuName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkDeviceSkuResource(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}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus/{networkDeviceSkuName} + /// + /// + /// Operation Id + /// NetworkDeviceSkus_Get + /// + /// + /// + /// Name of the Network Device SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkDeviceSkuName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkDeviceSkuName, nameof(networkDeviceSkuName)); + + using var scope = _networkDeviceSkuClientDiagnostics.CreateScope("NetworkDeviceSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkDeviceSkuRestClient.Get(Id.SubscriptionId, networkDeviceSkuName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkDeviceSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricAccessControlListCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricAccessControlListCollection.cs index d930b05a4de4..3b6495eb5707 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricAccessControlListCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricAccessControlListCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string accessControlListName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName} + /// + /// + /// Operation Id + /// AccessControlLists_Get + /// + /// + /// + /// Name of the Access Control List. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string accessControlListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessControlListName, nameof(accessControlListName)); + + using var scope = _networkFabricAccessControlListAccessControlListsClientDiagnostics.CreateScope("NetworkFabricAccessControlListCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricAccessControlListAccessControlListsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accessControlListName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricAccessControlListResource(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.ManagedNetworkFabric/accessControlLists/{accessControlListName} + /// + /// + /// Operation Id + /// AccessControlLists_Get + /// + /// + /// + /// Name of the Access Control List. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accessControlListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessControlListName, nameof(accessControlListName)); + + using var scope = _networkFabricAccessControlListAccessControlListsClientDiagnostics.CreateScope("NetworkFabricAccessControlListCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricAccessControlListAccessControlListsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accessControlListName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricAccessControlListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricCollection.cs index e2019bb1ccac..468ba17a983a 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string networkFabricName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName} + /// + /// + /// Operation Id + /// NetworkFabrics_Get + /// + /// + /// + /// Name of the Network Fabric. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFabricName, nameof(networkFabricName)); + + using var scope = _networkFabricClientDiagnostics.CreateScope("NetworkFabricCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFabricName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricResource(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.ManagedNetworkFabric/networkFabrics/{networkFabricName} + /// + /// + /// Operation Id + /// NetworkFabrics_Get + /// + /// + /// + /// Name of the Network Fabric. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFabricName, nameof(networkFabricName)); + + using var scope = _networkFabricClientDiagnostics.CreateScope("NetworkFabricCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkFabricName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricControllerCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricControllerCollection.cs index b8a926eae3eb..277b3af90cd5 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricControllerCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricControllerCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string networkFabricControllerName, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName} + /// + /// + /// Operation Id + /// NetworkFabricControllers_Get + /// + /// + /// + /// Name of the Network Fabric Controller. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFabricControllerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFabricControllerName, nameof(networkFabricControllerName)); + + using var scope = _networkFabricControllerClientDiagnostics.CreateScope("NetworkFabricControllerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricControllerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFabricControllerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricControllerResource(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.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName} + /// + /// + /// Operation Id + /// NetworkFabricControllers_Get + /// + /// + /// + /// Name of the Network Fabric Controller. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFabricControllerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFabricControllerName, nameof(networkFabricControllerName)); + + using var scope = _networkFabricControllerClientDiagnostics.CreateScope("NetworkFabricControllerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricControllerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkFabricControllerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricControllerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricExternalNetworkCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricExternalNetworkCollection.cs index a89ee0f760d1..16fff871e771 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricExternalNetworkCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricExternalNetworkCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string externalNetworkName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName} + /// + /// + /// Operation Id + /// ExternalNetworks_Get + /// + /// + /// + /// Name of the External Network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string externalNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalNetworkName, nameof(externalNetworkName)); + + using var scope = _networkFabricExternalNetworkExternalNetworksClientDiagnostics.CreateScope("NetworkFabricExternalNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricExternalNetworkExternalNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, externalNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricExternalNetworkResource(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.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName} + /// + /// + /// Operation Id + /// ExternalNetworks_Get + /// + /// + /// + /// Name of the External Network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string externalNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalNetworkName, nameof(externalNetworkName)); + + using var scope = _networkFabricExternalNetworkExternalNetworksClientDiagnostics.CreateScope("NetworkFabricExternalNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricExternalNetworkExternalNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, externalNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricExternalNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPCommunityCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPCommunityCollection.cs index dd34b9fa6ac4..791dde90f4b9 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPCommunityCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPCommunityCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string ipCommunityName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName} + /// + /// + /// Operation Id + /// IpCommunities_Get + /// + /// + /// + /// Name of the IP Community. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ipCommunityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipCommunityName, nameof(ipCommunityName)); + + using var scope = _networkFabricIPCommunityIPCommunitiesClientDiagnostics.CreateScope("NetworkFabricIPCommunityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricIPCommunityIPCommunitiesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ipCommunityName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricIPCommunityResource(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.ManagedNetworkFabric/ipCommunities/{ipCommunityName} + /// + /// + /// Operation Id + /// IpCommunities_Get + /// + /// + /// + /// Name of the IP Community. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ipCommunityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipCommunityName, nameof(ipCommunityName)); + + using var scope = _networkFabricIPCommunityIPCommunitiesClientDiagnostics.CreateScope("NetworkFabricIPCommunityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricIPCommunityIPCommunitiesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ipCommunityName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricIPCommunityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPExtendedCommunityCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPExtendedCommunityCollection.cs index 0738c20b9914..a80465ce24af 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPExtendedCommunityCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPExtendedCommunityCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string ipExtendedCommunityName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName} + /// + /// + /// Operation Id + /// IpExtendedCommunities_Get + /// + /// + /// + /// Name of the IP Extended Community. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ipExtendedCommunityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipExtendedCommunityName, nameof(ipExtendedCommunityName)); + + using var scope = _networkFabricIPExtendedCommunityIPExtendedCommunitiesClientDiagnostics.CreateScope("NetworkFabricIPExtendedCommunityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricIPExtendedCommunityIPExtendedCommunitiesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ipExtendedCommunityName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricIPExtendedCommunityResource(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.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName} + /// + /// + /// Operation Id + /// IpExtendedCommunities_Get + /// + /// + /// + /// Name of the IP Extended Community. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ipExtendedCommunityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipExtendedCommunityName, nameof(ipExtendedCommunityName)); + + using var scope = _networkFabricIPExtendedCommunityIPExtendedCommunitiesClientDiagnostics.CreateScope("NetworkFabricIPExtendedCommunityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricIPExtendedCommunityIPExtendedCommunitiesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ipExtendedCommunityName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricIPExtendedCommunityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPPrefixCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPPrefixCollection.cs index 29d4c4d68e42..906184c4828c 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPPrefixCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPPrefixCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string ipPrefixName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName} + /// + /// + /// Operation Id + /// IpPrefixes_Get + /// + /// + /// + /// Name of the IP Prefix. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ipPrefixName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipPrefixName, nameof(ipPrefixName)); + + using var scope = _networkFabricIPPrefixIPPrefixesClientDiagnostics.CreateScope("NetworkFabricIPPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricIPPrefixIPPrefixesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ipPrefixName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricIPPrefixResource(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.ManagedNetworkFabric/ipPrefixes/{ipPrefixName} + /// + /// + /// Operation Id + /// IpPrefixes_Get + /// + /// + /// + /// Name of the IP Prefix. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ipPrefixName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipPrefixName, nameof(ipPrefixName)); + + using var scope = _networkFabricIPPrefixIPPrefixesClientDiagnostics.CreateScope("NetworkFabricIPPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricIPPrefixIPPrefixesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ipPrefixName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricIPPrefixResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternalNetworkCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternalNetworkCollection.cs index 0a26743d28fb..422682450479 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternalNetworkCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternalNetworkCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string internalNetworkName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName} + /// + /// + /// Operation Id + /// InternalNetworks_Get + /// + /// + /// + /// Name of the Internal Network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string internalNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(internalNetworkName, nameof(internalNetworkName)); + + using var scope = _networkFabricInternalNetworkInternalNetworksClientDiagnostics.CreateScope("NetworkFabricInternalNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricInternalNetworkInternalNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, internalNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricInternalNetworkResource(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.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName} + /// + /// + /// Operation Id + /// InternalNetworks_Get + /// + /// + /// + /// Name of the Internal Network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string internalNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(internalNetworkName, nameof(internalNetworkName)); + + using var scope = _networkFabricInternalNetworkInternalNetworksClientDiagnostics.CreateScope("NetworkFabricInternalNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricInternalNetworkInternalNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, internalNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricInternalNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayCollection.cs index 4825569c2644..1fa78c6039b2 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string internetGatewayName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGateways/{internetGatewayName} + /// + /// + /// Operation Id + /// InternetGateways_Get + /// + /// + /// + /// Name of the Internet Gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string internetGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(internetGatewayName, nameof(internetGatewayName)); + + using var scope = _networkFabricInternetGatewayInternetGatewaysClientDiagnostics.CreateScope("NetworkFabricInternetGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricInternetGatewayInternetGatewaysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, internetGatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricInternetGatewayResource(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.ManagedNetworkFabric/internetGateways/{internetGatewayName} + /// + /// + /// Operation Id + /// InternetGateways_Get + /// + /// + /// + /// Name of the Internet Gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string internetGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(internetGatewayName, nameof(internetGatewayName)); + + using var scope = _networkFabricInternetGatewayInternetGatewaysClientDiagnostics.CreateScope("NetworkFabricInternetGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricInternetGatewayInternetGatewaysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, internetGatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricInternetGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayRuleCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayRuleCollection.cs index 1cf12a5c918f..924f3734d656 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayRuleCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string internetGatewayRuleName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGatewayRules/{internetGatewayRuleName} + /// + /// + /// Operation Id + /// InternetGatewayRules_Get + /// + /// + /// + /// Name of the Internet Gateway rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string internetGatewayRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(internetGatewayRuleName, nameof(internetGatewayRuleName)); + + using var scope = _networkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics.CreateScope("NetworkFabricInternetGatewayRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricInternetGatewayRuleInternetGatewayRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, internetGatewayRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricInternetGatewayRuleResource(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.ManagedNetworkFabric/internetGatewayRules/{internetGatewayRuleName} + /// + /// + /// Operation Id + /// InternetGatewayRules_Get + /// + /// + /// + /// Name of the Internet Gateway rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string internetGatewayRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(internetGatewayRuleName, nameof(internetGatewayRuleName)); + + using var scope = _networkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics.CreateScope("NetworkFabricInternetGatewayRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricInternetGatewayRuleInternetGatewayRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, internetGatewayRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricInternetGatewayRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL2IsolationDomainCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL2IsolationDomainCollection.cs index 82b2a43b1ad5..f0f66da31307 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL2IsolationDomainCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL2IsolationDomainCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string l2IsolationDomainName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName} + /// + /// + /// Operation Id + /// L2IsolationDomains_Get + /// + /// + /// + /// Name of the L2 Isolation Domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string l2IsolationDomainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(l2IsolationDomainName, nameof(l2IsolationDomainName)); + + using var scope = _networkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics.CreateScope("NetworkFabricL2IsolationDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricL2IsolationDomainL2IsolationDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, l2IsolationDomainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricL2IsolationDomainResource(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.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName} + /// + /// + /// Operation Id + /// L2IsolationDomains_Get + /// + /// + /// + /// Name of the L2 Isolation Domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string l2IsolationDomainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(l2IsolationDomainName, nameof(l2IsolationDomainName)); + + using var scope = _networkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics.CreateScope("NetworkFabricL2IsolationDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricL2IsolationDomainL2IsolationDomainsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, l2IsolationDomainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricL2IsolationDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainCollection.cs index a837fb633d93..60fc966f8990 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string l3IsolationDomainName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName} + /// + /// + /// Operation Id + /// L3IsolationDomains_Get + /// + /// + /// + /// Name of the L3 Isolation Domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string l3IsolationDomainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(l3IsolationDomainName, nameof(l3IsolationDomainName)); + + using var scope = _networkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics.CreateScope("NetworkFabricL3IsolationDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricL3IsolationDomainL3IsolationDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, l3IsolationDomainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricL3IsolationDomainResource(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.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName} + /// + /// + /// Operation Id + /// L3IsolationDomains_Get + /// + /// + /// + /// Name of the L3 Isolation Domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string l3IsolationDomainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(l3IsolationDomainName, nameof(l3IsolationDomainName)); + + using var scope = _networkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics.CreateScope("NetworkFabricL3IsolationDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricL3IsolationDomainL3IsolationDomainsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, l3IsolationDomainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricL3IsolationDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricNeighborGroupCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricNeighborGroupCollection.cs index a6a0c10ec25a..c0f0300c8dfb 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricNeighborGroupCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricNeighborGroupCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string neighborGroupName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/neighborGroups/{neighborGroupName} + /// + /// + /// Operation Id + /// NeighborGroups_Get + /// + /// + /// + /// Name of the Neighbor Group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string neighborGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(neighborGroupName, nameof(neighborGroupName)); + + using var scope = _networkFabricNeighborGroupNeighborGroupsClientDiagnostics.CreateScope("NetworkFabricNeighborGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricNeighborGroupNeighborGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, neighborGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricNeighborGroupResource(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.ManagedNetworkFabric/neighborGroups/{neighborGroupName} + /// + /// + /// Operation Id + /// NeighborGroups_Get + /// + /// + /// + /// Name of the Neighbor Group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string neighborGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(neighborGroupName, nameof(neighborGroupName)); + + using var scope = _networkFabricNeighborGroupNeighborGroupsClientDiagnostics.CreateScope("NetworkFabricNeighborGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricNeighborGroupNeighborGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, neighborGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricNeighborGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricRoutePolicyCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricRoutePolicyCollection.cs index 111f7cb15365..995fad947e76 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricRoutePolicyCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricRoutePolicyCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string routePolicyName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName} + /// + /// + /// Operation Id + /// RoutePolicies_Get + /// + /// + /// + /// Name of the Route Policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routePolicyName, nameof(routePolicyName)); + + using var scope = _networkFabricRoutePolicyRoutePoliciesClientDiagnostics.CreateScope("NetworkFabricRoutePolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricRoutePolicyRoutePoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, routePolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricRoutePolicyResource(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.ManagedNetworkFabric/routePolicies/{routePolicyName} + /// + /// + /// Operation Id + /// RoutePolicies_Get + /// + /// + /// + /// Name of the Route Policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routePolicyName, nameof(routePolicyName)); + + using var scope = _networkFabricRoutePolicyRoutePoliciesClientDiagnostics.CreateScope("NetworkFabricRoutePolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricRoutePolicyRoutePoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, routePolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricRoutePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricSkuCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricSkuCollection.cs index 7ed0e316fe97..73e476649413 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricSkuCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricSkuCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string networkFabricSkuName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus/{networkFabricSkuName} + /// + /// + /// Operation Id + /// NetworkFabricSkus_Get + /// + /// + /// + /// Name of the Network Fabric SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFabricSkuName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFabricSkuName, nameof(networkFabricSkuName)); + + using var scope = _networkFabricSkuClientDiagnostics.CreateScope("NetworkFabricSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFabricSkuRestClient.GetAsync(Id.SubscriptionId, networkFabricSkuName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricSkuResource(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}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus/{networkFabricSkuName} + /// + /// + /// Operation Id + /// NetworkFabricSkus_Get + /// + /// + /// + /// Name of the Network Fabric SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFabricSkuName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFabricSkuName, nameof(networkFabricSkuName)); + + using var scope = _networkFabricSkuClientDiagnostics.CreateScope("NetworkFabricSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFabricSkuRestClient.Get(Id.SubscriptionId, networkFabricSkuName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFabricSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkPacketBrokerCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkPacketBrokerCollection.cs index 82eb024769ea..4254c9e20412 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkPacketBrokerCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkPacketBrokerCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string networkPacketBrokerName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers/{networkPacketBrokerName} + /// + /// + /// Operation Id + /// NetworkPacketBrokers_Get + /// + /// + /// + /// Name of the Network Packet 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 networkPacketBrokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkPacketBrokerName, nameof(networkPacketBrokerName)); + + using var scope = _networkPacketBrokerClientDiagnostics.CreateScope("NetworkPacketBrokerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkPacketBrokerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkPacketBrokerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkPacketBrokerResource(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.ManagedNetworkFabric/networkPacketBrokers/{networkPacketBrokerName} + /// + /// + /// Operation Id + /// NetworkPacketBrokers_Get + /// + /// + /// + /// Name of the Network Packet Broker. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkPacketBrokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkPacketBrokerName, nameof(networkPacketBrokerName)); + + using var scope = _networkPacketBrokerClientDiagnostics.CreateScope("NetworkPacketBrokerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkPacketBrokerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkPacketBrokerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkPacketBrokerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkRackCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkRackCollection.cs index e499ac0a0976..8354fb13d037 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkRackCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkRackCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string networkRackName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName} + /// + /// + /// Operation Id + /// NetworkRacks_Get + /// + /// + /// + /// Name of the Network Rack. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkRackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkRackName, nameof(networkRackName)); + + using var scope = _networkRackClientDiagnostics.CreateScope("NetworkRackCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkRackRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkRackName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkRackResource(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.ManagedNetworkFabric/networkRacks/{networkRackName} + /// + /// + /// Operation Id + /// NetworkRacks_Get + /// + /// + /// + /// Name of the Network Rack. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkRackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkRackName, nameof(networkRackName)); + + using var scope = _networkRackClientDiagnostics.CreateScope("NetworkRackCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkRackRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkRackName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkRackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapCollection.cs index 6641a8bd74a8..b552059230c0 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string networkTapName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTaps/{networkTapName} + /// + /// + /// Operation Id + /// NetworkTaps_Get + /// + /// + /// + /// Name of the Network Tap. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkTapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkTapName, nameof(networkTapName)); + + using var scope = _networkTapClientDiagnostics.CreateScope("NetworkTapCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkTapRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkTapName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkTapResource(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.ManagedNetworkFabric/networkTaps/{networkTapName} + /// + /// + /// Operation Id + /// NetworkTaps_Get + /// + /// + /// + /// Name of the Network Tap. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkTapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkTapName, nameof(networkTapName)); + + using var scope = _networkTapClientDiagnostics.CreateScope("NetworkTapCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkTapRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkTapName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkTapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapRuleCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapRuleCollection.cs index a925a365bf4b..cc7ab25e5217 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapRuleCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string networkTapRuleName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTapRules/{networkTapRuleName} + /// + /// + /// Operation Id + /// NetworkTapRules_Get + /// + /// + /// + /// Name of the Network Tap Rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkTapRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkTapRuleName, nameof(networkTapRuleName)); + + using var scope = _networkTapRuleClientDiagnostics.CreateScope("NetworkTapRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkTapRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkTapRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkTapRuleResource(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.ManagedNetworkFabric/networkTapRules/{networkTapRuleName} + /// + /// + /// Operation Id + /// NetworkTapRules_Get + /// + /// + /// + /// Name of the Network Tap Rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkTapRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkTapRuleName, nameof(networkTapRuleName)); + + using var scope = _networkTapRuleClientDiagnostics.CreateScope("NetworkTapRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkTapRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkTapRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkTapRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkToNetworkInterconnectCollection.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkToNetworkInterconnectCollection.cs index f6b0b9774531..9327602ff33a 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkToNetworkInterconnectCollection.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkToNetworkInterconnectCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string networkToNetworkInterconnectName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName} + /// + /// + /// Operation Id + /// NetworkToNetworkInterconnects_Get + /// + /// + /// + /// Name of the Network to Network Interconnect. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkToNetworkInterconnectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkToNetworkInterconnectName, nameof(networkToNetworkInterconnectName)); + + using var scope = _networkToNetworkInterconnectClientDiagnostics.CreateScope("NetworkToNetworkInterconnectCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkToNetworkInterconnectRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkToNetworkInterconnectName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkToNetworkInterconnectResource(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.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName} + /// + /// + /// Operation Id + /// NetworkToNetworkInterconnects_Get + /// + /// + /// + /// Name of the Network to Network Interconnect. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkToNetworkInterconnectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkToNetworkInterconnectName, nameof(networkToNetworkInterconnectName)); + + using var scope = _networkToNetworkInterconnectClientDiagnostics.CreateScope("NetworkToNetworkInterconnectCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkToNetworkInterconnectRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkToNetworkInterconnectName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkToNetworkInterconnectResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/samples/Generated/Samples/Sample_FederatedIdentityCredentialCollection.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/samples/Generated/Samples/Sample_FederatedIdentityCredentialCollection.cs index b1cd03029740..c46be5e3f0f9 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/samples/Generated/Samples/Sample_FederatedIdentityCredentialCollection.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/samples/Generated/Samples/Sample_FederatedIdentityCredentialCollection.cs @@ -164,5 +164,48 @@ public async Task Exists_FederatedIdentityCredentialGet() Console.WriteLine($"Succeeded: {result}"); } + + // FederatedIdentityCredentialGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FederatedIdentityCredentialGet() + { + // Generated from example definition: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialGet.json + // this example is just showing the usage of "FederatedIdentityCredentials_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 UserAssignedIdentityResource created on azure + // for more information of creating UserAssignedIdentityResource, please refer to the document of UserAssignedIdentityResource + string subscriptionId = "c267c0e7-0a73-4789-9e17-d26aeb0904e5"; + string resourceGroupName = "rgName"; + string resourceName = "resourceName"; + ResourceIdentifier userAssignedIdentityResourceId = UserAssignedIdentityResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + UserAssignedIdentityResource userAssignedIdentity = client.GetUserAssignedIdentityResource(userAssignedIdentityResourceId); + + // get the collection of this FederatedIdentityCredentialResource + FederatedIdentityCredentialCollection collection = userAssignedIdentity.GetFederatedIdentityCredentials(); + + // invoke the operation + string federatedIdentityCredentialResourceName = "ficResourceName"; + NullableResponse response = await collection.GetIfExistsAsync(federatedIdentityCredentialResourceName); + FederatedIdentityCredentialResource 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 + FederatedIdentityCredentialData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/samples/Generated/Samples/Sample_UserAssignedIdentityCollection.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/samples/Generated/Samples/Sample_UserAssignedIdentityCollection.cs index beeb5419213a..d64a1308e771 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/samples/Generated/Samples/Sample_UserAssignedIdentityCollection.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/samples/Generated/Samples/Sample_UserAssignedIdentityCollection.cs @@ -160,5 +160,47 @@ public async Task Exists_IdentityGet() Console.WriteLine($"Succeeded: {result}"); } + + // IdentityGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_IdentityGet() + { + // Generated from example definition: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json + // this example is just showing the usage of "UserAssignedIdentities_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 = "subid"; + string resourceGroupName = "rgName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this UserAssignedIdentityResource + UserAssignedIdentityCollection collection = resourceGroupResource.GetUserAssignedIdentities(); + + // invoke the operation + string resourceName = "resourceName"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + UserAssignedIdentityResource 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 + UserAssignedIdentityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/FederatedIdentityCredentialCollection.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/FederatedIdentityCredentialCollection.cs index 9e13980cca8c..0164319b3927 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/FederatedIdentityCredentialCollection.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/FederatedIdentityCredentialCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string federatedIdentityCredentialResourceN } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}/federatedIdentityCredentials/{federatedIdentityCredentialResourceName} + /// + /// + /// Operation Id + /// FederatedIdentityCredentials_Get + /// + /// + /// + /// The name of the federated identity credential 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 federatedIdentityCredentialResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(federatedIdentityCredentialResourceName, nameof(federatedIdentityCredentialResourceName)); + + using var scope = _federatedIdentityCredentialClientDiagnostics.CreateScope("FederatedIdentityCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _federatedIdentityCredentialRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, federatedIdentityCredentialResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FederatedIdentityCredentialResource(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.ManagedIdentity/userAssignedIdentities/{resourceName}/federatedIdentityCredentials/{federatedIdentityCredentialResourceName} + /// + /// + /// Operation Id + /// FederatedIdentityCredentials_Get + /// + /// + /// + /// The name of the federated identity credential resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string federatedIdentityCredentialResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(federatedIdentityCredentialResourceName, nameof(federatedIdentityCredentialResourceName)); + + using var scope = _federatedIdentityCredentialClientDiagnostics.CreateScope("FederatedIdentityCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = _federatedIdentityCredentialRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, federatedIdentityCredentialResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FederatedIdentityCredentialResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityCollection.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityCollection.cs index 47b557ddb869..de0c0107364c 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityCollection.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName} + /// + /// + /// Operation Id + /// UserAssignedIdentities_Get + /// + /// + /// + /// The name of the identity 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _userAssignedIdentityClientDiagnostics.CreateScope("UserAssignedIdentityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _userAssignedIdentityRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UserAssignedIdentityResource(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.ManagedIdentity/userAssignedIdentities/{resourceName} + /// + /// + /// Operation Id + /// UserAssignedIdentities_Get + /// + /// + /// + /// The name of the identity resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _userAssignedIdentityClientDiagnostics.CreateScope("UserAssignedIdentityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _userAssignedIdentityRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UserAssignedIdentityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesMarketplaceRegistrationCollection.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesMarketplaceRegistrationCollection.cs index 2ff5eb88e766..50eba5eb09af 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesMarketplaceRegistrationCollection.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesMarketplaceRegistrationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -110,5 +111,45 @@ public async Task Exists_GetRegistrationDefinitions() Console.WriteLine($"Succeeded: {result}"); } + + // Get Registration Definitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRegistrationDefinitions() + { + // Generated from example definition: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinition.json + // this example is just showing the usage of "MarketplaceRegistrationDefinitions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ManagedServicesMarketplaceRegistrationResource + string scope = "subscription/0afefe50-734e-4610-8a82-a144ahf49dea"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + ManagedServicesMarketplaceRegistrationCollection collection = client.GetManagedServicesMarketplaceRegistrations(scopeId); + + // invoke the operation + string marketplaceIdentifier = "publisher.product.planName.version"; + NullableResponse response = await collection.GetIfExistsAsync(marketplaceIdentifier); + ManagedServicesMarketplaceRegistrationResource 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 + ManagedServicesMarketplaceRegistrationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesRegistrationAssignmentCollection.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesRegistrationAssignmentCollection.cs index 20a5a604ec87..1991acfc548d 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesRegistrationAssignmentCollection.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesRegistrationAssignmentCollection.cs @@ -78,6 +78,46 @@ public async Task Exists_GetRegistrationAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get Registration Assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRegistrationAssignment() + { + // Generated from example definition: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignment.json + // this example is just showing the usage of "RegistrationAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ManagedServicesRegistrationAssignmentResource + string scope = "subscription/0afefe50-734e-4610-8a82-a144ahf49dea"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + ManagedServicesRegistrationAssignmentCollection collection = client.GetManagedServicesRegistrationAssignments(scopeId); + + // invoke the operation + string registrationAssignmentId = "26c128c2-fefa-4340-9bb1-6e081c90ada2"; + NullableResponse response = await collection.GetIfExistsAsync(registrationAssignmentId); + ManagedServicesRegistrationAssignmentResource 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 + ManagedServicesRegistrationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put Registration Assignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesRegistrationCollection.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesRegistrationCollection.cs index 00396f05eb22..bf91ac82d6dd 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesRegistrationCollection.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/samples/Generated/Samples/Sample_ManagedServicesRegistrationCollection.cs @@ -79,6 +79,46 @@ public async Task Exists_GetRegistrationDefinition() Console.WriteLine($"Succeeded: {result}"); } + // Get Registration Definition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRegistrationDefinition() + { + // Generated from example definition: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinition.json + // this example is just showing the usage of "RegistrationDefinitions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ManagedServicesRegistrationResource + string scope = "subscription/0afefe50-734e-4610-8a82-a144ahf49dea"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + ManagedServicesRegistrationCollection collection = client.GetManagedServicesRegistrations(scopeId); + + // invoke the operation + string registrationId = "26c128c2-fefa-4340-9bb1-6e081c90ada2"; + NullableResponse response = await collection.GetIfExistsAsync(registrationId); + ManagedServicesRegistrationResource 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 + ManagedServicesRegistrationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put Registration Definition [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesMarketplaceRegistrationCollection.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesMarketplaceRegistrationCollection.cs index 54614c8e5a5f..d5c1b87ce026 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesMarketplaceRegistrationCollection.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesMarketplaceRegistrationCollection.cs @@ -233,6 +233,80 @@ public virtual Response Exists(string marketplaceIdentifier, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier} + /// + /// + /// Operation Id + /// MarketplaceRegistrationDefinitions_Get + /// + /// + /// + /// The Azure Marketplace identifier. Expected formats: {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or {publisher}.{product[-preview]} or {publisher}). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string marketplaceIdentifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(marketplaceIdentifier, nameof(marketplaceIdentifier)); + + using var scope = _managedServicesMarketplaceRegistrationMarketplaceRegistrationDefinitionsClientDiagnostics.CreateScope("ManagedServicesMarketplaceRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedServicesMarketplaceRegistrationMarketplaceRegistrationDefinitionsRestClient.GetAsync(Id, marketplaceIdentifier, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServicesMarketplaceRegistrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier} + /// + /// + /// Operation Id + /// MarketplaceRegistrationDefinitions_Get + /// + /// + /// + /// The Azure Marketplace identifier. Expected formats: {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or {publisher}.{product[-preview]} or {publisher}). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string marketplaceIdentifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(marketplaceIdentifier, nameof(marketplaceIdentifier)); + + using var scope = _managedServicesMarketplaceRegistrationMarketplaceRegistrationDefinitionsClientDiagnostics.CreateScope("ManagedServicesMarketplaceRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedServicesMarketplaceRegistrationMarketplaceRegistrationDefinitionsRestClient.Get(Id, marketplaceIdentifier, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServicesMarketplaceRegistrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationAssignmentCollection.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationAssignmentCollection.cs index 30fa3bd643dd..7bfa8e65ccdf 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationAssignmentCollection.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationAssignmentCollection.cs @@ -321,6 +321,82 @@ public virtual Response Exists(string registrationAssignmentId, bool? expa } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId} + /// + /// + /// Operation Id + /// RegistrationAssignments_Get + /// + /// + /// + /// The GUID of the registration assignment. + /// The flag indicating whether to return the registration definition details along with the registration assignment details. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string registrationAssignmentId, bool? expandRegistrationDefinition = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registrationAssignmentId, nameof(registrationAssignmentId)); + + using var scope = _managedServicesRegistrationAssignmentRegistrationAssignmentsClientDiagnostics.CreateScope("ManagedServicesRegistrationAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedServicesRegistrationAssignmentRegistrationAssignmentsRestClient.GetAsync(Id, registrationAssignmentId, expandRegistrationDefinition, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServicesRegistrationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId} + /// + /// + /// Operation Id + /// RegistrationAssignments_Get + /// + /// + /// + /// The GUID of the registration assignment. + /// The flag indicating whether to return the registration definition details along with the registration assignment details. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string registrationAssignmentId, bool? expandRegistrationDefinition = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registrationAssignmentId, nameof(registrationAssignmentId)); + + using var scope = _managedServicesRegistrationAssignmentRegistrationAssignmentsClientDiagnostics.CreateScope("ManagedServicesRegistrationAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedServicesRegistrationAssignmentRegistrationAssignmentsRestClient.Get(Id, registrationAssignmentId, expandRegistrationDefinition, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServicesRegistrationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationCollection.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationCollection.cs index 919f294ee27c..90cbaf71c5b5 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationCollection.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationCollection.cs @@ -315,6 +315,80 @@ public virtual Response Exists(string registrationId, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId} + /// + /// + /// Operation Id + /// RegistrationDefinitions_Get + /// + /// + /// + /// The GUID of the registration definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string registrationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registrationId, nameof(registrationId)); + + using var scope = _managedServicesRegistrationRegistrationDefinitionsClientDiagnostics.CreateScope("ManagedServicesRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedServicesRegistrationRegistrationDefinitionsRestClient.GetAsync(Id, registrationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServicesRegistrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId} + /// + /// + /// Operation Id + /// RegistrationDefinitions_Get + /// + /// + /// + /// The GUID of the registration definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string registrationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registrationId, nameof(registrationId)); + + using var scope = _managedServicesRegistrationRegistrationDefinitionsClientDiagnostics.CreateScope("ManagedServicesRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedServicesRegistrationRegistrationDefinitionsRestClient.Get(Id, registrationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServicesRegistrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/samples/Generated/Samples/Sample_PartnerResponseCollection.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/samples/Generated/Samples/Sample_PartnerResponseCollection.cs index bc4b9f5db88a..d78d5d29bc59 100644 --- a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/samples/Generated/Samples/Sample_PartnerResponseCollection.cs +++ b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/samples/Generated/Samples/Sample_PartnerResponseCollection.cs @@ -75,6 +75,45 @@ public async Task Exists_GetPartnerDetails() Console.WriteLine($"Succeeded: {result}"); } + // GetPartnerDetails + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPartnerDetails() + { + // Generated from example definition: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetails.json + // this example is just showing the usage of "Partner_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this PartnerResponseResource + PartnerResponseCollection collection = tenantResource.GetPartnerResponses(); + + // invoke the operation + string partnerId = "123456"; + NullableResponse response = await collection.GetIfExistsAsync(partnerId); + PartnerResponseResource 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 + PartnerResponseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutPartnerDetails [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/PartnerResponseCollection.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/PartnerResponseCollection.cs index c539be4654bd..a57e3d819091 100644 --- a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/PartnerResponseCollection.cs +++ b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/PartnerResponseCollection.cs @@ -272,5 +272,79 @@ public virtual Response Exists(string partnerId, CancellationToken cancell throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ManagementPartner/partners/{partnerId} + /// + /// + /// Operation Id + /// Partner_Get + /// + /// + /// + /// Id of the Partner. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string partnerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerId, nameof(partnerId)); + + using var scope = _partnerResponsePartnerClientDiagnostics.CreateScope("PartnerResponseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _partnerResponsePartnerRestClient.GetAsync(partnerId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerResponseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ManagementPartner/partners/{partnerId} + /// + /// + /// Operation Id + /// Partner_Get + /// + /// + /// + /// Id of the Partner. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string partnerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerId, nameof(partnerId)); + + using var scope = _partnerResponsePartnerClientDiagnostics.CreateScope("PartnerResponseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _partnerResponsePartnerRestClient.Get(partnerId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerResponseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/maps/Azure.ResourceManager.Maps/samples/Generated/Samples/Sample_MapsAccountCollection.cs b/sdk/maps/Azure.ResourceManager.Maps/samples/Generated/Samples/Sample_MapsAccountCollection.cs index 57029f088012..1c4f2f8db61f 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/samples/Generated/Samples/Sample_MapsAccountCollection.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/samples/Generated/Samples/Sample_MapsAccountCollection.cs @@ -250,6 +250,48 @@ public async Task Exists_GetAccount() Console.WriteLine($"Succeeded: {result}"); } + // GetAccount + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAccount() + { + // Generated from example definition: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetAccount.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 = "21a9967a-e8a9-4656-a70b-96ff1c4d05a0"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MapsAccountResource + MapsAccountCollection collection = resourceGroupResource.GetMapsAccounts(); + + // invoke the operation + string accountName = "myMapsAccount"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + MapsAccountResource 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 + MapsAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Accounts By Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/maps/Azure.ResourceManager.Maps/samples/Generated/Samples/Sample_MapsCreatorCollection.cs b/sdk/maps/Azure.ResourceManager.Maps/samples/Generated/Samples/Sample_MapsCreatorCollection.cs index 32c4ededd585..93f301c94367 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/samples/Generated/Samples/Sample_MapsCreatorCollection.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/samples/Generated/Samples/Sample_MapsCreatorCollection.cs @@ -163,5 +163,48 @@ public async Task Exists_GetCreatorResource() Console.WriteLine($"Succeeded: {result}"); } + + // Get Creator Resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCreatorResource() + { + // Generated from example definition: specification/maps/resource-manager/Microsoft.Maps/preview/2021-12-01-preview/examples/GetMapsCreator.json + // this example is just showing the usage of "Creators_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 MapsAccountResource created on azure + // for more information of creating MapsAccountResource, please refer to the document of MapsAccountResource + string subscriptionId = "21a9967a-e8a9-4656-a70b-96ff1c4d05a0"; + string resourceGroupName = "myResourceGroup"; + string accountName = "myMapsAccount"; + ResourceIdentifier mapsAccountResourceId = MapsAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MapsAccountResource mapsAccount = client.GetMapsAccountResource(mapsAccountResourceId); + + // get the collection of this MapsCreatorResource + MapsCreatorCollection collection = mapsAccount.GetMapsCreators(); + + // invoke the operation + string creatorName = "myCreator"; + NullableResponse response = await collection.GetIfExistsAsync(creatorName); + MapsCreatorResource 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 + MapsCreatorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountCollection.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountCollection.cs index e21a77837d3a..e5b7104635ca 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountCollection.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Maps 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _mapsAccountAccountsClientDiagnostics.CreateScope("MapsAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mapsAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MapsAccountResource(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.Maps/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Maps Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _mapsAccountAccountsClientDiagnostics.CreateScope("MapsAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mapsAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MapsAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsCreatorCollection.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsCreatorCollection.cs index ac38dc2fc0ee..0bad35289d39 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsCreatorCollection.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsCreatorCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string creatorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/creators/{creatorName} + /// + /// + /// Operation Id + /// Creators_Get + /// + /// + /// + /// The name of the Maps Creator 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 creatorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(creatorName, nameof(creatorName)); + + using var scope = _mapsCreatorCreatorsClientDiagnostics.CreateScope("MapsCreatorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mapsCreatorCreatorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, creatorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MapsCreatorResource(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.Maps/accounts/{accountName}/creators/{creatorName} + /// + /// + /// Operation Id + /// Creators_Get + /// + /// + /// + /// The name of the Maps Creator instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string creatorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(creatorName, nameof(creatorName)); + + using var scope = _mapsCreatorCreatorsClientDiagnostics.CreateScope("MapsCreatorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mapsCreatorCreatorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, creatorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MapsCreatorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_MarketplaceAdminApprovalRequestCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_MarketplaceAdminApprovalRequestCollection.cs index 53aeed647bf6..d153d8588db0 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_MarketplaceAdminApprovalRequestCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_MarketplaceAdminApprovalRequestCollection.cs @@ -117,6 +117,48 @@ public async Task Exists_GetAdminRequestApproval() Console.WriteLine($"Succeeded: {result}"); } + // GetAdminRequestApproval + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAdminRequestApproval() + { + // Generated from example definition: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2023-01-01/examples/GetAdminRequestApproval.json + // this example is just showing the usage of "PrivateStore_GetAdminRequestApproval" 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 PrivateStoreResource created on azure + // for more information of creating PrivateStoreResource, please refer to the document of PrivateStoreResource + Guid privateStoreId = Guid.Parse("a0e28e55-90c4-41d8-8e34-bb7ef7775406"); + ResourceIdentifier privateStoreResourceId = PrivateStoreResource.CreateResourceIdentifier(privateStoreId); + PrivateStoreResource privateStore = client.GetPrivateStoreResource(privateStoreResourceId); + + // get the collection of this MarketplaceAdminApprovalRequestResource + MarketplaceAdminApprovalRequestCollection collection = privateStore.GetMarketplaceAdminApprovalRequests(); + + // invoke the operation + string adminRequestApprovalId = "marketplacetestthirdparty.md-test-third-party-2"; + string publisherId = "marketplacetestthirdparty"; + NullableResponse response = await collection.GetIfExistsAsync(adminRequestApprovalId, publisherId); + MarketplaceAdminApprovalRequestResource 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 + MarketplaceAdminApprovalRequestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // UpdateAdminRequestApproval [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_MarketplaceApprovalRequestCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_MarketplaceApprovalRequestCollection.cs index cb812551441d..5ad9491f3eba 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_MarketplaceApprovalRequestCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_MarketplaceApprovalRequestCollection.cs @@ -114,6 +114,47 @@ public async Task Exists_GetApprovalRequest() Console.WriteLine($"Succeeded: {result}"); } + // GetApprovalRequest + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetApprovalRequest() + { + // Generated from example definition: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2023-01-01/examples/GetRequestApproval.json + // this example is just showing the usage of "PrivateStore_GetRequestApproval" 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 PrivateStoreResource created on azure + // for more information of creating PrivateStoreResource, please refer to the document of PrivateStoreResource + Guid privateStoreId = Guid.Parse("a0e28e55-90c4-41d8-8e34-bb7ef7775406"); + ResourceIdentifier privateStoreResourceId = PrivateStoreResource.CreateResourceIdentifier(privateStoreId); + PrivateStoreResource privateStore = client.GetPrivateStoreResource(privateStoreResourceId); + + // get the collection of this MarketplaceApprovalRequestResource + MarketplaceApprovalRequestCollection collection = privateStore.GetMarketplaceApprovalRequests(); + + // invoke the operation + string requestApprovalId = "marketplacetestthirdparty.md-test-third-party-2"; + NullableResponse response = await collection.GetIfExistsAsync(requestApprovalId); + MarketplaceApprovalRequestResource 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 + MarketplaceApprovalRequestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateApprovalRequest [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreCollection.cs index c5388139669f..abc80b0f1bab 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreCollection.cs @@ -109,6 +109,45 @@ public async Task Exists_GetPrivateStore() Console.WriteLine($"Succeeded: {result}"); } + // GetPrivateStore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateStore() + { + // Generated from example definition: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2023-01-01/examples/GetPrivateStore.json + // this example is just showing the usage of "PrivateStore_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this PrivateStoreResource + PrivateStoreCollection collection = tenantResource.GetPrivateStores(); + + // invoke the operation + Guid privateStoreId = Guid.Parse("a0e28e55-90c4-41d8-8e34-bb7ef7775406"); + NullableResponse response = await collection.GetIfExistsAsync(privateStoreId); + PrivateStoreResource 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 + PrivateStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateStores_update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreCollectionInfoCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreCollectionInfoCollection.cs index 7c493d3090f7..9bda28d30509 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreCollectionInfoCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreCollectionInfoCollection.cs @@ -114,6 +114,47 @@ public async Task Exists_GetPrivateStoreCollection() Console.WriteLine($"Succeeded: {result}"); } + // GetPrivateStoreCollection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateStoreCollection() + { + // Generated from example definition: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2023-01-01/examples/GetPrivateStoreCollection.json + // this example is just showing the usage of "PrivateStoreCollection_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 PrivateStoreResource created on azure + // for more information of creating PrivateStoreResource, please refer to the document of PrivateStoreResource + Guid privateStoreId = Guid.Parse("a0e28e55-90c4-41d8-8e34-bb7ef7775406"); + ResourceIdentifier privateStoreResourceId = PrivateStoreResource.CreateResourceIdentifier(privateStoreId); + PrivateStoreResource privateStore = client.GetPrivateStoreResource(privateStoreResourceId); + + // get the collection of this PrivateStoreCollectionInfoResource + PrivateStoreCollectionInfoCollection collection = privateStore.GetPrivateStoreCollectionInfos(); + + // invoke the operation + Guid collectionId = Guid.Parse("56a1a02d-8cf8-45df-bf37-d5f7120fcb3d"); + NullableResponse response = await collection.GetIfExistsAsync(collectionId); + PrivateStoreCollectionInfoResource 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 + PrivateStoreCollectionInfoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreatePrivateStoreCollection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreOfferCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreOfferCollection.cs index 546a508c4b80..a47efb808e28 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreOfferCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/samples/Generated/Samples/Sample_PrivateStoreOfferCollection.cs @@ -117,6 +117,48 @@ public async Task Exists_GetPrivateStoreCollectionOffer() Console.WriteLine($"Succeeded: {result}"); } + // GetPrivateStoreCollectionOffer + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateStoreCollectionOffer() + { + // Generated from example definition: specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2023-01-01/examples/GetPrivateStoreCollectionOffer.json + // this example is just showing the usage of "PrivateStoreCollectionOffer_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 PrivateStoreCollectionInfoResource created on azure + // for more information of creating PrivateStoreCollectionInfoResource, please refer to the document of PrivateStoreCollectionInfoResource + Guid privateStoreId = Guid.Parse("a0e28e55-90c4-41d8-8e34-bb7ef7775406"); + Guid collectionId = Guid.Parse("56a1a02d-8cf8-45df-bf37-d5f7120fcb3d"); + ResourceIdentifier privateStoreCollectionInfoResourceId = PrivateStoreCollectionInfoResource.CreateResourceIdentifier(privateStoreId, collectionId); + PrivateStoreCollectionInfoResource privateStoreCollectionInfo = client.GetPrivateStoreCollectionInfoResource(privateStoreCollectionInfoResourceId); + + // get the collection of this PrivateStoreOfferResource + PrivateStoreOfferCollection collection = privateStoreCollectionInfo.GetPrivateStoreOffers(); + + // invoke the operation + string offerId = "marketplacetestthirdparty.md-test-third-party-2"; + NullableResponse response = await collection.GetIfExistsAsync(offerId); + PrivateStoreOfferResource 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 + PrivateStoreOfferData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateStoreOffer_update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceAdminApprovalRequestCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceAdminApprovalRequestCollection.cs index 080f7a3fe185..99d4494db382 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceAdminApprovalRequestCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceAdminApprovalRequestCollection.cs @@ -329,6 +329,84 @@ public virtual Response Exists(string adminRequestApprovalId, string publi } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId} + /// + /// + /// Operation Id + /// PrivateStore_GetAdminRequestApproval + /// + /// + /// + /// The admin request approval ID to get create or update. + /// The publisher id of this offer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string adminRequestApprovalId, string publisherId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(adminRequestApprovalId, nameof(adminRequestApprovalId)); + Argument.AssertNotNull(publisherId, nameof(publisherId)); + + using var scope = _marketplaceAdminApprovalRequestPrivateStoreClientDiagnostics.CreateScope("MarketplaceAdminApprovalRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _marketplaceAdminApprovalRequestPrivateStoreRestClient.GetAdminRequestApprovalAsync(Guid.Parse(Id.Name), adminRequestApprovalId, publisherId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MarketplaceAdminApprovalRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId} + /// + /// + /// Operation Id + /// PrivateStore_GetAdminRequestApproval + /// + /// + /// + /// The admin request approval ID to get create or update. + /// The publisher id of this offer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string adminRequestApprovalId, string publisherId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(adminRequestApprovalId, nameof(adminRequestApprovalId)); + Argument.AssertNotNull(publisherId, nameof(publisherId)); + + using var scope = _marketplaceAdminApprovalRequestPrivateStoreClientDiagnostics.CreateScope("MarketplaceAdminApprovalRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _marketplaceAdminApprovalRequestPrivateStoreRestClient.GetAdminRequestApproval(Guid.Parse(Id.Name), adminRequestApprovalId, publisherId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MarketplaceAdminApprovalRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceApprovalRequestCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceApprovalRequestCollection.cs index 3cee6c7c81c8..14141dc7a809 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceApprovalRequestCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceApprovalRequestCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string requestApprovalId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId} + /// + /// + /// Operation Id + /// PrivateStore_GetRequestApproval + /// + /// + /// + /// The request approval ID to get create or update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string requestApprovalId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestApprovalId, nameof(requestApprovalId)); + + using var scope = _marketplaceApprovalRequestPrivateStoreClientDiagnostics.CreateScope("MarketplaceApprovalRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _marketplaceApprovalRequestPrivateStoreRestClient.GetRequestApprovalAsync(Guid.Parse(Id.Name), requestApprovalId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MarketplaceApprovalRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId} + /// + /// + /// Operation Id + /// PrivateStore_GetRequestApproval + /// + /// + /// + /// The request approval ID to get create or update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string requestApprovalId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(requestApprovalId, nameof(requestApprovalId)); + + using var scope = _marketplaceApprovalRequestPrivateStoreClientDiagnostics.CreateScope("MarketplaceApprovalRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _marketplaceApprovalRequestPrivateStoreRestClient.GetRequestApproval(Guid.Parse(Id.Name), requestApprovalId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MarketplaceApprovalRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollection.cs index 34925f5c0592..19f52c35b39c 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollection.cs @@ -306,6 +306,72 @@ public virtual Response Exists(Guid privateStoreId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId} + /// + /// + /// Operation Id + /// PrivateStore_Get + /// + /// + /// + /// The store ID - must use the tenant ID. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid privateStoreId, CancellationToken cancellationToken = default) + { + using var scope = _privateStoreClientDiagnostics.CreateScope("PrivateStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateStoreRestClient.GetAsync(privateStoreId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId} + /// + /// + /// Operation Id + /// PrivateStore_Get + /// + /// + /// + /// The store ID - must use the tenant ID. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid privateStoreId, CancellationToken cancellationToken = default) + { + using var scope = _privateStoreClientDiagnostics.CreateScope("PrivateStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateStoreRestClient.Get(privateStoreId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoCollection.cs index 87a0585add54..c2088dadad01 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoCollection.cs @@ -301,6 +301,72 @@ public virtual Response Exists(Guid collectionId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId} + /// + /// + /// Operation Id + /// PrivateStoreCollection_Get + /// + /// + /// + /// The collection ID. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid collectionId, CancellationToken cancellationToken = default) + { + using var scope = _privateStoreCollectionInfoPrivateStoreCollectionClientDiagnostics.CreateScope("PrivateStoreCollectionInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateStoreCollectionInfoPrivateStoreCollectionRestClient.GetAsync(Guid.Parse(Id.Name), collectionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateStoreCollectionInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId} + /// + /// + /// Operation Id + /// PrivateStoreCollection_Get + /// + /// + /// + /// The collection ID. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid collectionId, CancellationToken cancellationToken = default) + { + using var scope = _privateStoreCollectionInfoPrivateStoreCollectionClientDiagnostics.CreateScope("PrivateStoreCollectionInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateStoreCollectionInfoPrivateStoreCollectionRestClient.Get(Guid.Parse(Id.Name), collectionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateStoreCollectionInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreOfferCollection.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreOfferCollection.cs index f282e6e58900..43f22dcbfdd1 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreOfferCollection.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreOfferCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string offerId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId} + /// + /// + /// Operation Id + /// PrivateStoreCollectionOffer_Get + /// + /// + /// + /// The offer ID to update or delete. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string offerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + using var scope = _privateStoreOfferPrivateStoreCollectionOfferClientDiagnostics.CreateScope("PrivateStoreOfferCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateStoreOfferPrivateStoreCollectionOfferRestClient.GetAsync(Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name), offerId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateStoreOfferResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId} + /// + /// + /// Operation Id + /// PrivateStoreCollectionOffer_Get + /// + /// + /// + /// The offer ID to update or delete. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string offerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + using var scope = _privateStoreOfferPrivateStoreCollectionOfferClientDiagnostics.CreateScope("PrivateStoreOfferCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateStoreOfferPrivateStoreCollectionOfferRestClient.Get(Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name), offerId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateStoreOfferResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/samples/Generated/Samples/Sample_MarketplaceAgreementCollection.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/samples/Generated/Samples/Sample_MarketplaceAgreementCollection.cs index aab6f4858d2d..9994b79c41e3 100644 --- a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/samples/Generated/Samples/Sample_MarketplaceAgreementCollection.cs +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/samples/Generated/Samples/Sample_MarketplaceAgreementCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,5 +83,48 @@ public async Task Exists_SetMarketplaceTerms() Console.WriteLine($"Succeeded: {result}"); } + + // SetMarketplaceTerms + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SetMarketplaceTerms() + { + // Generated from example definition: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/GetAgreementMarketplaceTerms.json + // this example is just showing the usage of "MarketplaceAgreements_GetAgreement" 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 = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this MarketplaceAgreementResource + MarketplaceAgreementCollection collection = subscriptionResource.GetMarketplaceAgreements(); + + // invoke the operation + string publisherId = "pubid"; + string offerId = "offid"; + string planId = "planid"; + NullableResponse response = await collection.GetIfExistsAsync(publisherId, offerId, planId); + MarketplaceAgreementResource 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 + MarketplaceAgreementTermData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/samples/Generated/Samples/Sample_MarketplaceAgreementTermCollection.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/samples/Generated/Samples/Sample_MarketplaceAgreementTermCollection.cs index fc30e7294015..d9b922c05345 100644 --- a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/samples/Generated/Samples/Sample_MarketplaceAgreementTermCollection.cs +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/samples/Generated/Samples/Sample_MarketplaceAgreementTermCollection.cs @@ -87,6 +87,50 @@ public async Task Exists_GetMarketplaceTerms() Console.WriteLine($"Succeeded: {result}"); } + // GetMarketplaceTerms + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMarketplaceTerms() + { + // Generated from example definition: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/GetMarketplaceTerms.json + // this example is just showing the usage of "MarketplaceAgreements_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this MarketplaceAgreementTermResource + MarketplaceAgreementTermCollection collection = subscriptionResource.GetMarketplaceAgreementTerms(); + + // invoke the operation + AgreementOfferType offerType = AgreementOfferType.Virtualmachine; + string publisherId = "pubid"; + string offerId = "offid"; + string planId = "planid"; + NullableResponse response = await collection.GetIfExistsAsync(offerType, publisherId, offerId, planId); + MarketplaceAgreementTermResource 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 + MarketplaceAgreementTermData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SetMarketplaceTerms [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementTermCollection.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementTermCollection.cs index 38b0db4afdae..879f5f037a62 100644 --- a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementTermCollection.cs +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementTermCollection.cs @@ -307,5 +307,89 @@ public virtual Response Exists(AgreementOfferType offerType, string publis throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current + /// + /// + /// Operation Id + /// MarketplaceAgreements_Get + /// + /// + /// + /// Offer Type, currently only virtualmachine type is supported. + /// Publisher identifier string of image being deployed. + /// Offer identifier string of image being deployed. + /// Plan identifier string of image being deployed. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GetIfExistsAsync(AgreementOfferType offerType, string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherId, nameof(publisherId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + Argument.AssertNotNullOrEmpty(planId, nameof(planId)); + + using var scope = _marketplaceAgreementTermMarketplaceAgreementsClientDiagnostics.CreateScope("MarketplaceAgreementTermCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _marketplaceAgreementTermMarketplaceAgreementsRestClient.GetAsync(Id.SubscriptionId, offerType, publisherId, offerId, planId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MarketplaceAgreementTermResource(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}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current + /// + /// + /// Operation Id + /// MarketplaceAgreements_Get + /// + /// + /// + /// Offer Type, currently only virtualmachine type is supported. + /// Publisher identifier string of image being deployed. + /// Offer identifier string of image being deployed. + /// Plan identifier string of image being deployed. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual NullableResponse GetIfExists(AgreementOfferType offerType, string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherId, nameof(publisherId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + Argument.AssertNotNullOrEmpty(planId, nameof(planId)); + + using var scope = _marketplaceAgreementTermMarketplaceAgreementsClientDiagnostics.CreateScope("MarketplaceAgreementTermCollection.GetIfExists"); + scope.Start(); + try + { + var response = _marketplaceAgreementTermMarketplaceAgreementsRestClient.Get(Id.SubscriptionId, offerType, publisherId, offerId, planId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MarketplaceAgreementTermResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_ContentKeyPolicyCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_ContentKeyPolicyCollection.cs index f4f0f670d5b2..a44453d9ff97 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_ContentKeyPolicyCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_ContentKeyPolicyCollection.cs @@ -197,6 +197,49 @@ public async Task Exists_GetAContentKeyPolicyByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a Content Key Policy by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAContentKeyPolicyByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2023-01-01/examples/content-key-policies-get-by-name.json + // this example is just showing the usage of "ContentKeyPolicies_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contosomedia"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this ContentKeyPolicyResource + ContentKeyPolicyCollection collection = mediaServicesAccount.GetContentKeyPolicies(); + + // invoke the operation + string contentKeyPolicyName = "PolicyWithMultipleOptions"; + NullableResponse response = await collection.GetIfExistsAsync(contentKeyPolicyName); + ContentKeyPolicyResource 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 + ContentKeyPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates a Content Key Policy with ClearKey option and Token Restriction [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetCollection.cs index 9418b7debc8a..2bed660672c0 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetCollection.cs @@ -197,6 +197,49 @@ public async Task Exists_GetAnAssetByName() Console.WriteLine($"Succeeded: {result}"); } + // Get an Asset by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAssetByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2023-01-01/examples/assets-get-by-name.json + // this example is just showing the usage of "Assets_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contosomedia"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this MediaAssetResource + MediaAssetCollection collection = mediaServicesAccount.GetMediaAssets(); + + // invoke the operation + string assetName = "ClimbingMountAdams"; + NullableResponse response = await collection.GetIfExistsAsync(assetName); + MediaAssetResource 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 + MediaAssetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create an Asset [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetFilterCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetFilterCollection.cs index b2d2138f26be..023a95400f82 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetFilterCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetFilterCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetAnAssetFilterByName() Console.WriteLine($"Succeeded: {result}"); } + // Get an Asset Filter by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAssetFilterByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2023-01-01/examples/assetFilters-get-by-name.json + // this example is just showing the usage of "AssetFilters_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 MediaAssetResource created on azure + // for more information of creating MediaAssetResource, please refer to the document of MediaAssetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contosomedia"; + string assetName = "ClimbingMountRainer"; + ResourceIdentifier mediaAssetResourceId = MediaAssetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, assetName); + MediaAssetResource mediaAsset = client.GetMediaAssetResource(mediaAssetResourceId); + + // get the collection of this MediaAssetFilterResource + MediaAssetFilterCollection collection = mediaAsset.GetMediaAssetFilters(); + + // invoke the operation + string filterName = "assetFilterWithTimeWindowAndTrack"; + NullableResponse response = await collection.GetIfExistsAsync(filterName); + MediaAssetFilterResource 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 + MediaAssetFilterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create an Asset Filter [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetTrackCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetTrackCollection.cs index 417da2880956..893787d8728c 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetTrackCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaAssetTrackCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetATrackByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a Track by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetATrackByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2023-01-01/examples/asset-tracks-get-by-name.json + // this example is just showing the usage of "Tracks_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 MediaAssetResource created on azure + // for more information of creating MediaAssetResource, please refer to the document of MediaAssetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contosomedia"; + string assetName = "ClimbingMountRainer"; + ResourceIdentifier mediaAssetResourceId = MediaAssetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, assetName); + MediaAssetResource mediaAsset = client.GetMediaAssetResource(mediaAssetResourceId); + + // get the collection of this MediaAssetTrackResource + MediaAssetTrackCollection collection = mediaAsset.GetMediaAssetTracks(); + + // invoke the operation + string trackName = "text1"; + NullableResponse response = await collection.GetIfExistsAsync(trackName); + MediaAssetTrackResource 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 + MediaAssetTrackData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates a Track [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaJobCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaJobCollection.cs index 253db39ea064..1de1e41f7bb3 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaJobCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaJobCollection.cs @@ -361,6 +361,50 @@ public async Task Exists_GetAJobByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a Job by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAJobByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-get-by-name.json + // this example is just showing the usage of "Jobs_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 MediaTransformResource created on azure + // for more information of creating MediaTransformResource, please refer to the document of MediaTransformResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosoresources"; + string accountName = "contosomedia"; + string transformName = "exampleTransform"; + ResourceIdentifier mediaTransformResourceId = MediaTransformResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, transformName); + MediaTransformResource mediaTransform = client.GetMediaTransformResource(mediaTransformResourceId); + + // get the collection of this MediaJobResource + MediaJobCollection collection = mediaTransform.GetMediaJobs(); + + // invoke the operation + string jobName = "job1"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + MediaJobResource 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 + MediaJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a Job [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaLiveEventCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaLiveEventCollection.cs index 5af44ba4b57d..59f6c9c5b6a1 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaLiveEventCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaLiveEventCollection.cs @@ -123,6 +123,49 @@ public async Task Exists_GetALiveEventByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a LiveEvent by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetALiveEventByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-list-by-name.json + // this example is just showing the usage of "LiveEvents_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "0a6ec948-5a62-437d-b9df-934dc7c1b722"; + string resourceGroupName = "mediaresources"; + string accountName = "slitestmedia10"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this MediaLiveEventResource + MediaLiveEventCollection collection = mediaServicesAccount.GetMediaLiveEvents(); + + // invoke the operation + string liveEventName = "myLiveEvent1"; + NullableResponse response = await collection.GetIfExistsAsync(liveEventName); + MediaLiveEventResource 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 + MediaLiveEventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a LiveEvent [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaLiveOutputCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaLiveOutputCollection.cs index f3c76f08a63a..4cb022025e41 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaLiveOutputCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaLiveOutputCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetALiveOutputByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a LiveOutput by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetALiveOutputByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveoutput-list-by-name.json + // this example is just showing the usage of "LiveOutputs_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 MediaLiveEventResource created on azure + // for more information of creating MediaLiveEventResource, please refer to the document of MediaLiveEventResource + string subscriptionId = "0a6ec948-5a62-437d-b9df-934dc7c1b722"; + string resourceGroupName = "mediaresources"; + string accountName = "slitestmedia10"; + string liveEventName = "myLiveEvent1"; + ResourceIdentifier mediaLiveEventResourceId = MediaLiveEventResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, liveEventName); + MediaLiveEventResource mediaLiveEvent = client.GetMediaLiveEventResource(mediaLiveEventResourceId); + + // get the collection of this MediaLiveOutputResource + MediaLiveOutputCollection collection = mediaLiveEvent.GetMediaLiveOutputs(); + + // invoke the operation + string liveOutputName = "myLiveOutput1"; + NullableResponse response = await collection.GetIfExistsAsync(liveOutputName); + MediaLiveOutputResource 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 + MediaLiveOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a LiveOutput [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesAccountCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesAccountCollection.cs index 1737115e90fc..97ca640137b6 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesAccountCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesAccountCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetAMediaServicesAccountByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a Media Services account by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAMediaServicesAccountByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2023-01-01/examples/accounts-get-by-name.json + // this example is just showing the usage of "Mediaservices_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 = "contosorg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MediaServicesAccountResource + MediaServicesAccountCollection collection = resourceGroupResource.GetMediaServicesAccounts(); + + // invoke the operation + string accountName = "contosotv"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + MediaServicesAccountResource 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 + MediaServicesAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a Media Services account [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesAccountFilterCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesAccountFilterCollection.cs index 8839d788dc17..0578ce04c275 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesAccountFilterCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesAccountFilterCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAnAccountFilterByName() Console.WriteLine($"Succeeded: {result}"); } + // Get an Account Filter by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAccountFilterByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2023-01-01/examples/accountFilters-get-by-name.json + // this example is just showing the usage of "AccountFilters_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contosomedia"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this MediaServicesAccountFilterResource + MediaServicesAccountFilterCollection collection = mediaServicesAccount.GetMediaServicesAccountFilters(); + + // invoke the operation + string filterName = "accountFilterWithTrack"; + NullableResponse response = await collection.GetIfExistsAsync(filterName); + MediaServicesAccountFilterResource 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 + MediaServicesAccountFilterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create an Account Filter [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesPrivateEndpointConnectionCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesPrivateEndpointConnectionCollection.cs index 7e14f53b0426..df3f91d514ee 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpointConnection() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2023-01-01/examples/private-endpoint-connection-get-by-name.json + // this example is just showing the usage of "PrivateEndpointConnections_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contososports"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this MediaServicesPrivateEndpointConnectionResource + MediaServicesPrivateEndpointConnectionCollection collection = mediaServicesAccount.GetMediaServicesPrivateEndpointConnections(); + + // invoke the operation + string name = "connectionName1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MediaServicesPrivateEndpointConnectionResource 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 + MediaServicesPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update private endpoint connection. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesPrivateLinkResourceCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesPrivateLinkResourceCollection.cs index dfe259756ee9..366701efbe22 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesPrivateLinkResourceCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaServicesPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetDetailsOfAGroupID() Console.WriteLine($"Succeeded: {result}"); } + + // Get details of a group ID. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsOfAGroupID() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2023-01-01/examples/private-link-resources-get-by-name.json + // this example is just showing the usage of "PrivateLinkResources_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contososports"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this MediaServicesPrivateLinkResource + MediaServicesPrivateLinkResourceCollection collection = mediaServicesAccount.GetMediaServicesPrivateLinkResources(); + + // invoke the operation + string name = "keydelivery"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MediaServicesPrivateLinkResource 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 + MediaServicesPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaTransformCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaTransformCollection.cs index 01dcf3f69597..621ace11d3cb 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaTransformCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_MediaTransformCollection.cs @@ -238,6 +238,49 @@ public async Task Exists_GetATransformByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a Transform by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetATransformByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-get-by-name.json + // this example is just showing the usage of "Transforms_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosoresources"; + string accountName = "contosomedia"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this MediaTransformResource + MediaTransformCollection collection = mediaServicesAccount.GetMediaTransforms(); + + // invoke the operation + string transformName = "sampleTransform"; + NullableResponse response = await collection.GetIfExistsAsync(transformName); + MediaTransformResource 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 + MediaTransformData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a Transform [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingEndpointCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingEndpointCollection.cs index 45fedde04153..40d04b86a435 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingEndpointCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingEndpointCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetAStreamingEndpointByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a streaming endpoint by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStreamingEndpointByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-list-by-name.json + // this example is just showing the usage of "StreamingEndpoints_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "0a6ec948-5a62-437d-b9df-934dc7c1b722"; + string resourceGroupName = "mediaresources"; + string accountName = "slitestmedia10"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this StreamingEndpointResource + StreamingEndpointCollection collection = mediaServicesAccount.GetStreamingEndpoints(); + + // invoke the operation + string streamingEndpointName = "myStreamingEndpoint1"; + NullableResponse response = await collection.GetIfExistsAsync(streamingEndpointName); + StreamingEndpointResource 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 + StreamingEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a streaming endpoint [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingLocatorCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingLocatorCollection.cs index 0cdb4fce3492..0ba5e0bf5c2f 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingLocatorCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingLocatorCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAStreamingLocatorByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a Streaming Locator by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStreamingLocatorByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2023-01-01/examples/streaming-locators-get-by-name.json + // this example is just showing the usage of "StreamingLocators_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contosomedia"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this StreamingLocatorResource + StreamingLocatorCollection collection = mediaServicesAccount.GetStreamingLocators(); + + // invoke the operation + string streamingLocatorName = "clearStreamingLocator"; + NullableResponse response = await collection.GetIfExistsAsync(streamingLocatorName); + StreamingLocatorResource 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 + StreamingLocatorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates a Streaming Locator with clear streaming [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingPolicyCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingPolicyCollection.cs index 46ee1860fba7..3363829ff533 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingPolicyCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/samples/Generated/Samples/Sample_StreamingPolicyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAStreamingPolicyByName() Console.WriteLine($"Succeeded: {result}"); } + // Get a Streaming Policy by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStreamingPolicyByName() + { + // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2023-01-01/examples/streaming-policy-get-by-name.json + // this example is just showing the usage of "StreamingPolicies_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 MediaServicesAccountResource created on azure + // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosorg"; + string accountName = "contosomedia"; + ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); + + // get the collection of this StreamingPolicyResource + StreamingPolicyCollection collection = mediaServicesAccount.GetStreamingPolicies(); + + // invoke the operation + string streamingPolicyName = "clearStreamingPolicy"; + NullableResponse response = await collection.GetIfExistsAsync(streamingPolicyName); + StreamingPolicyResource 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 + StreamingPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates a Streaming Policy with ClearKey encryption in commonEncryptionCbcs. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/ContentKeyPolicyCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/ContentKeyPolicyCollection.cs index a495188e6046..18fc71e5db30 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/ContentKeyPolicyCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/ContentKeyPolicyCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string contentKeyPolicyName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName} + /// + /// + /// Operation Id + /// ContentKeyPolicies_Get + /// + /// + /// + /// The Content Key Policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string contentKeyPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(contentKeyPolicyName, nameof(contentKeyPolicyName)); + + using var scope = _contentKeyPolicyClientDiagnostics.CreateScope("ContentKeyPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _contentKeyPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentKeyPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContentKeyPolicyResource(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.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName} + /// + /// + /// Operation Id + /// ContentKeyPolicies_Get + /// + /// + /// + /// The Content Key Policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string contentKeyPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(contentKeyPolicyName, nameof(contentKeyPolicyName)); + + using var scope = _contentKeyPolicyClientDiagnostics.CreateScope("ContentKeyPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _contentKeyPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentKeyPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContentKeyPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetCollection.cs index c4c5be7c1b19..0c32d3ac127f 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string assetName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName} + /// + /// + /// Operation Id + /// Assets_Get + /// + /// + /// + /// The Asset name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assetName, nameof(assetName)); + + using var scope = _mediaAssetAssetsClientDiagnostics.CreateScope("MediaAssetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaAssetAssetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, assetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaAssetResource(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.Media/mediaServices/{accountName}/assets/{assetName} + /// + /// + /// Operation Id + /// Assets_Get + /// + /// + /// + /// The Asset name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assetName, nameof(assetName)); + + using var scope = _mediaAssetAssetsClientDiagnostics.CreateScope("MediaAssetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaAssetAssetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, assetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaAssetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetFilterCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetFilterCollection.cs index 6a0cb84d2c68..816d2534e228 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetFilterCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetFilterCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string filterName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName} + /// + /// + /// Operation Id + /// AssetFilters_Get + /// + /// + /// + /// The Asset Filter name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _mediaAssetFilterAssetFiltersClientDiagnostics.CreateScope("MediaAssetFilterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaAssetFilterAssetFiltersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaAssetFilterResource(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.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName} + /// + /// + /// Operation Id + /// AssetFilters_Get + /// + /// + /// + /// The Asset Filter name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _mediaAssetFilterAssetFiltersClientDiagnostics.CreateScope("MediaAssetFilterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaAssetFilterAssetFiltersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaAssetFilterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetTrackCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetTrackCollection.cs index 9f559200e79c..13b6d7172553 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetTrackCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetTrackCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string trackName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName} + /// + /// + /// Operation Id + /// Tracks_Get + /// + /// + /// + /// The Asset Track name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string trackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trackName, nameof(trackName)); + + using var scope = _mediaAssetTrackTracksClientDiagnostics.CreateScope("MediaAssetTrackCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaAssetTrackTracksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, trackName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaAssetTrackResource(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.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName} + /// + /// + /// Operation Id + /// Tracks_Get + /// + /// + /// + /// The Asset Track name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string trackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trackName, nameof(trackName)); + + using var scope = _mediaAssetTrackTracksClientDiagnostics.CreateScope("MediaAssetTrackCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaAssetTrackTracksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, trackName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaAssetTrackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaJobCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaJobCollection.cs index c91a1466c4df..0b3508892580 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaJobCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaJobCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string jobName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The Job name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _mediaJobJobsClientDiagnostics.CreateScope("MediaJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaJobJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, jobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaJobResource(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.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The Job name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _mediaJobJobsClientDiagnostics.CreateScope("MediaJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaJobJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, jobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventCollection.cs index 881e20389b1c..52f66b3beedc 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string liveEventName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName} + /// + /// + /// Operation Id + /// LiveEvents_Get + /// + /// + /// + /// The name of the live event, maximum length is 32. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string liveEventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(liveEventName, nameof(liveEventName)); + + using var scope = _mediaLiveEventLiveEventsClientDiagnostics.CreateScope("MediaLiveEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaLiveEventLiveEventsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, liveEventName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaLiveEventResource(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.Media/mediaservices/{accountName}/liveEvents/{liveEventName} + /// + /// + /// Operation Id + /// LiveEvents_Get + /// + /// + /// + /// The name of the live event, maximum length is 32. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string liveEventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(liveEventName, nameof(liveEventName)); + + using var scope = _mediaLiveEventLiveEventsClientDiagnostics.CreateScope("MediaLiveEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaLiveEventLiveEventsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, liveEventName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaLiveEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveOutputCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveOutputCollection.cs index 5b97c65eb504..43799471c2cc 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveOutputCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveOutputCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string liveOutputName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName} + /// + /// + /// Operation Id + /// LiveOutputs_Get + /// + /// + /// + /// The name of the live output. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string liveOutputName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(liveOutputName, nameof(liveOutputName)); + + using var scope = _mediaLiveOutputLiveOutputsClientDiagnostics.CreateScope("MediaLiveOutputCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaLiveOutputLiveOutputsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, liveOutputName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaLiveOutputResource(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.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName} + /// + /// + /// Operation Id + /// LiveOutputs_Get + /// + /// + /// + /// The name of the live output. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string liveOutputName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(liveOutputName, nameof(liveOutputName)); + + using var scope = _mediaLiveOutputLiveOutputsClientDiagnostics.CreateScope("MediaLiveOutputCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaLiveOutputLiveOutputsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, liveOutputName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaLiveOutputResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountCollection.cs index b3de8dbfa852..cecce0881c5b 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName} + /// + /// + /// Operation Id + /// Mediaservices_Get + /// + /// + /// + /// The Media Services account name. + /// The cancellation token to use. + /// 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(accountName, nameof(accountName)); + + using var scope = _mediaServicesAccountMediaservicesClientDiagnostics.CreateScope("MediaServicesAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaServicesAccountMediaservicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaServicesAccountResource(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.Media/mediaservices/{accountName} + /// + /// + /// Operation Id + /// Mediaservices_Get + /// + /// + /// + /// The Media Services account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _mediaServicesAccountMediaservicesClientDiagnostics.CreateScope("MediaServicesAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaServicesAccountMediaservicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaServicesAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountFilterCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountFilterCollection.cs index e75e305b80b1..d90d4418db31 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountFilterCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountFilterCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string filterName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName} + /// + /// + /// Operation Id + /// AccountFilters_Get + /// + /// + /// + /// The Account Filter name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _mediaServicesAccountFilterAccountFiltersClientDiagnostics.CreateScope("MediaServicesAccountFilterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaServicesAccountFilterAccountFiltersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaServicesAccountFilterResource(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.Media/mediaServices/{accountName}/accountFilters/{filterName} + /// + /// + /// Operation Id + /// AccountFilters_Get + /// + /// + /// + /// The Account Filter name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _mediaServicesAccountFilterAccountFiltersClientDiagnostics.CreateScope("MediaServicesAccountFilterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaServicesAccountFilterAccountFiltersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaServicesAccountFilterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateEndpointConnectionCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateEndpointConnectionCollection.cs index 460ae1537184..c741db61116e 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The String to use. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _mediaServicesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("MediaServicesPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaServicesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaServicesPrivateEndpointConnectionResource(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.Media/mediaservices/{accountName}/privateEndpointConnections/{name} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The String to use. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _mediaServicesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("MediaServicesPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaServicesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaServicesPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateLinkResourceCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateLinkResourceCollection.cs index 7a85bb4fded2..9953f734d4e5 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateLinkResourceCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources/{name} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The String to use. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _mediaServicesPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("MediaServicesPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaServicesPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaServicesPrivateLinkResource(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.Media/mediaservices/{accountName}/privateLinkResources/{name} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The String to use. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _mediaServicesPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("MediaServicesPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaServicesPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaServicesPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformCollection.cs index d9f10bdc4532..4bdec61f4aab 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string transformName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName} + /// + /// + /// Operation Id + /// Transforms_Get + /// + /// + /// + /// The Transform name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string transformName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(transformName, nameof(transformName)); + + using var scope = _mediaTransformTransformsClientDiagnostics.CreateScope("MediaTransformCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mediaTransformTransformsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, transformName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaTransformResource(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.Media/mediaServices/{accountName}/transforms/{transformName} + /// + /// + /// Operation Id + /// Transforms_Get + /// + /// + /// + /// The Transform name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string transformName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(transformName, nameof(transformName)); + + using var scope = _mediaTransformTransformsClientDiagnostics.CreateScope("MediaTransformCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mediaTransformTransformsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, transformName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MediaTransformResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingEndpointCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingEndpointCollection.cs index e046e8e0ff3c..b6491d386fe9 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingEndpointCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingEndpointCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string streamingEndpointName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName} + /// + /// + /// Operation Id + /// StreamingEndpoints_Get + /// + /// + /// + /// The name of the streaming endpoint, maximum length is 24. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string streamingEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(streamingEndpointName, nameof(streamingEndpointName)); + + using var scope = _streamingEndpointClientDiagnostics.CreateScope("StreamingEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamingEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, streamingEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingEndpointResource(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.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName} + /// + /// + /// Operation Id + /// StreamingEndpoints_Get + /// + /// + /// + /// The name of the streaming endpoint, maximum length is 24. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string streamingEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(streamingEndpointName, nameof(streamingEndpointName)); + + using var scope = _streamingEndpointClientDiagnostics.CreateScope("StreamingEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamingEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, streamingEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingLocatorCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingLocatorCollection.cs index a6b2502f7aa6..2a021c2a8eb6 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingLocatorCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingLocatorCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string streamingLocatorName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName} + /// + /// + /// Operation Id + /// StreamingLocators_Get + /// + /// + /// + /// The Streaming Locator name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string streamingLocatorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(streamingLocatorName, nameof(streamingLocatorName)); + + using var scope = _streamingLocatorClientDiagnostics.CreateScope("StreamingLocatorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamingLocatorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, streamingLocatorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingLocatorResource(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.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName} + /// + /// + /// Operation Id + /// StreamingLocators_Get + /// + /// + /// + /// The Streaming Locator name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string streamingLocatorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(streamingLocatorName, nameof(streamingLocatorName)); + + using var scope = _streamingLocatorClientDiagnostics.CreateScope("StreamingLocatorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamingLocatorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, streamingLocatorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingLocatorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingPolicyCollection.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingPolicyCollection.cs index cec3db62276f..0b29c033e1a8 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingPolicyCollection.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingPolicyCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string streamingPolicyName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName} + /// + /// + /// Operation Id + /// StreamingPolicies_Get + /// + /// + /// + /// The Streaming Policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string streamingPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(streamingPolicyName, nameof(streamingPolicyName)); + + using var scope = _streamingPolicyClientDiagnostics.CreateScope("StreamingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamingPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, streamingPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingPolicyResource(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.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName} + /// + /// + /// Operation Id + /// StreamingPolicies_Get + /// + /// + /// + /// The Streaming Policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string streamingPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(streamingPolicyName, nameof(streamingPolicyName)); + + using var scope = _streamingPolicyClientDiagnostics.CreateScope("StreamingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamingPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, streamingPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); From 7daaa7ca99585d22cfc87f42d2b37dcb998e25dd Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 21 Sep 2023 08:41:07 +0000 Subject: [PATCH 3/8] Update SDK codes --- .../DataProtectionBackupInstanceCollection.cs | 74 +++ .../DataProtectionBackupJobCollection.cs | 74 +++ .../DataProtectionBackupPolicyCollection.cs | 74 +++ ...ProtectionBackupRecoveryPointCollection.cs | 74 +++ .../DataProtectionBackupVaultCollection.cs | 74 +++ ...dDataProtectionBackupInstanceCollection.cs | 74 +++ .../src/Generated/ResourceGuardCollection.cs | 74 +++ ...esourceGuardProxyBaseResourceCollection.cs | 74 +++ .../Sample_DataShareAccountCollection.cs | 42 ++ .../Samples/Sample_DataShareCollection.cs | 43 ++ ...e_DataShareConsumerInvitationCollection.cs | 41 ++ .../Sample_DataShareInvitationCollection.cs | 44 ++ ...taShareSynchronizationSettingCollection.cs | 44 ++ .../Sample_DataShareTriggerCollection.cs | 44 ++ ...ple_ProviderShareSubscriptionCollection.cs | 45 ++ .../Samples/Sample_ShareDataSetCollection.cs | 44 ++ .../Sample_ShareDataSetMappingCollection.cs | 44 ++ .../Sample_ShareSubscriptionCollection.cs | 43 ++ .../Generated/DataShareAccountCollection.cs | 74 +++ .../src/Generated/DataShareCollection.cs | 74 +++ .../DataShareConsumerInvitationCollection.cs | 68 +++ .../DataShareInvitationCollection.cs | 74 +++ ...taShareSynchronizationSettingCollection.cs | 74 +++ .../Generated/DataShareTriggerCollection.cs | 74 +++ .../ProviderShareSubscriptionCollection.cs | 74 +++ .../src/Generated/ShareDataSetCollection.cs | 74 +++ .../ShareDataSetMappingCollection.cs | 74 +++ .../Generated/ShareSubscriptionCollection.cs | 74 +++ .../Samples/Sample_EasmLabelCollection.cs | 43 ++ .../Samples/Sample_EasmWorkspaceCollection.cs | 42 ++ .../src/Generated/EasmLabelCollection.cs | 74 +++ .../src/Generated/EasmWorkspaceCollection.cs | 74 +++ .../Sample_ArtifactSourceCollection.cs | 42 ++ .../Samples/Sample_RolloutCollection.cs | 43 ++ .../Sample_ServiceResourceCollection.cs | 43 ++ ...ample_ServiceTopologyResourceCollection.cs | 42 ++ .../Sample_ServiceUnitResourceCollection.cs | 44 ++ .../Samples/Sample_StepResourceCollection.cs | 42 ++ .../src/Generated/ArtifactSourceCollection.cs | 74 +++ .../src/Generated/RolloutCollection.cs | 76 +++ .../Generated/ServiceResourceCollection.cs | 74 +++ .../ServiceTopologyResourceCollection.cs | 74 +++ .../ServiceUnitResourceCollection.cs | 74 +++ .../src/Generated/StepResourceCollection.cs | 74 +++ .../Samples/Sample_HostPoolCollection.cs | 42 ++ .../Samples/Sample_MsixPackageCollection.cs | 43 ++ .../Samples/Sample_ScalingPlanCollection.cs | 42 ++ ...ple_ScalingPlanPooledScheduleCollection.cs | 43 ++ .../Samples/Sample_SessionHostCollection.cs | 44 ++ .../Samples/Sample_UserSessionCollection.cs | 45 ++ .../Sample_VirtualApplicationCollection.cs | 43 ++ ...ample_VirtualApplicationGroupCollection.cs | 42 ++ .../Sample_VirtualDesktopCollection.cs | 44 ++ .../Sample_VirtualWorkspaceCollection.cs | 42 ++ .../src/Generated/HostPoolCollection.cs | 74 +++ .../src/Generated/MsixPackageCollection.cs | 74 +++ .../src/Generated/ScalingPlanCollection.cs | 74 +++ .../ScalingPlanPooledScheduleCollection.cs | 74 +++ .../src/Generated/SessionHostCollection.cs | 74 +++ .../src/Generated/UserSessionCollection.cs | 74 +++ .../Generated/VirtualApplicationCollection.cs | 74 +++ .../VirtualApplicationGroupCollection.cs | 74 +++ .../src/Generated/VirtualDesktopCollection.cs | 74 +++ .../Generated/VirtualWorkspaceCollection.cs | 74 +++ ...Sample_AllowedEnvironmentTypeCollection.cs | 44 ++ ...ple_AttachedNetworkConnectionCollection.cs | 43 ++ .../Sample_DevBoxDefinitionCollection.cs | 43 ++ .../Sample_DevCenterCatalogCollection.cs | 43 ++ .../Samples/Sample_DevCenterCollection.cs | 42 ++ ...mple_DevCenterEnvironmentTypeCollection.cs | 43 ++ .../Sample_DevCenterGalleryCollection.cs | 43 ++ .../Sample_DevCenterImageCollection.cs | 45 ++ ...le_DevCenterNetworkConnectionCollection.cs | 42 ++ .../Samples/Sample_DevCenterPoolCollection.cs | 86 ++++ .../Sample_DevCenterProjectCollection.cs | 42 ++ ...e_DevCenterProjectEnvironmentCollection.cs | 43 ++ .../Sample_DevCenterScheduleCollection.cs | 44 ++ .../Samples/Sample_ImageVersionCollection.cs | 46 ++ ...jectAttachedNetworkConnectionCollection.cs | 44 ++ ...ample_ProjectDevBoxDefinitionCollection.cs | 44 ++ .../AllowedEnvironmentTypeCollection.cs | 74 +++ .../AttachedNetworkConnectionCollection.cs | 74 +++ .../Generated/DevBoxDefinitionCollection.cs | 74 +++ .../Generated/DevCenterCatalogCollection.cs | 74 +++ .../src/Generated/DevCenterCollection.cs | 74 +++ .../DevCenterEnvironmentTypeCollection.cs | 74 +++ .../Generated/DevCenterGalleryCollection.cs | 74 +++ .../src/Generated/DevCenterImageCollection.cs | 74 +++ .../DevCenterNetworkConnectionCollection.cs | 74 +++ .../src/Generated/DevCenterPoolCollection.cs | 74 +++ .../Generated/DevCenterProjectCollection.cs | 74 +++ .../DevCenterProjectEnvironmentCollection.cs | 74 +++ .../Generated/DevCenterScheduleCollection.cs | 76 +++ .../src/Generated/ImageVersionCollection.cs | 74 +++ ...jectAttachedNetworkConnectionCollection.cs | 74 +++ .../ProjectDevBoxDefinitionCollection.cs | 74 +++ ...ple_DeviceProvisioningServiceCollection.cs | 42 ++ ...ovisioningServicesCertificateCollection.cs | 43 ++ ...icesPrivateEndpointConnectionCollection.cs | 43 ++ ...ngServicesPrivateLinkResourceCollection.cs | 44 ++ .../DeviceProvisioningServiceCollection.cs | 74 +++ ...ovisioningServicesCertificateCollection.cs | 76 +++ ...icesPrivateEndpointConnectionCollection.cs | 74 +++ ...ngServicesPrivateLinkResourceCollection.cs | 74 +++ .../Sample_DeviceUpdateAccountCollection.cs | 42 ++ .../Sample_DeviceUpdateInstanceCollection.cs | 43 ++ ...datePrivateEndpointConnectionCollection.cs | 43 ++ ...rivateEndpointConnectionProxyCollection.cs | 43 ++ .../Samples/Sample_PrivateLinkCollection.cs | 44 ++ .../DeviceUpdateAccountCollection.cs | 74 +++ .../DeviceUpdateInstanceCollection.cs | 74 +++ ...datePrivateEndpointConnectionCollection.cs | 74 +++ ...rivateEndpointConnectionProxyCollection.cs | 74 +++ .../src/Generated/PrivateLinkCollection.cs | 74 +++ .../Samples/Sample_ControllerCollection.cs | 42 ++ .../src/Generated/ControllerCollection.cs | 74 +++ .../Sample_DevTestLabArmTemplateCollection.cs | 45 ++ .../Sample_DevTestLabArtifactCollection.cs | 45 ++ ...mple_DevTestLabArtifactSourceCollection.cs | 43 ++ .../Samples/Sample_DevTestLabCollection.cs | 42 ++ .../Sample_DevTestLabCostCollection.cs | 43 ++ .../Sample_DevTestLabCustomImageCollection.cs | 43 ++ .../Sample_DevTestLabDiskCollection.cs | 44 ++ .../Sample_DevTestLabEnvironmentCollection.cs | 44 ++ .../Sample_DevTestLabFormulaCollection.cs | 43 ++ ...mple_DevTestLabGlobalScheduleCollection.cs | 42 ++ ...DevTestLabNotificationChannelCollection.cs | 43 ++ .../Sample_DevTestLabPolicyCollection.cs | 44 ++ .../Sample_DevTestLabScheduleCollection.cs | 43 ++ .../Sample_DevTestLabSecretCollection.cs | 44 ++ ...ample_DevTestLabServiceFabricCollection.cs | 44 ++ ...vTestLabServiceFabricScheduleCollection.cs | 45 ++ ...ample_DevTestLabServiceRunnerCollection.cs | 43 ++ .../Sample_DevTestLabUserCollection.cs | 43 ++ ...mple_DevTestLabVirtualNetworkCollection.cs | 43 ++ .../Samples/Sample_DevTestLabVmCollection.cs | 43 ++ .../Sample_DevTestLabVmScheduleCollection.cs | 44 ++ .../DevTestLabArmTemplateCollection.cs | 76 +++ .../Generated/DevTestLabArtifactCollection.cs | 76 +++ .../DevTestLabArtifactSourceCollection.cs | 76 +++ .../src/Generated/DevTestLabCollection.cs | 76 +++ .../src/Generated/DevTestLabCostCollection.cs | 76 +++ .../DevTestLabCustomImageCollection.cs | 76 +++ .../src/Generated/DevTestLabDiskCollection.cs | 76 +++ .../DevTestLabEnvironmentCollection.cs | 76 +++ .../Generated/DevTestLabFormulaCollection.cs | 76 +++ .../DevTestLabGlobalScheduleCollection.cs | 76 +++ ...DevTestLabNotificationChannelCollection.cs | 76 +++ .../Generated/DevTestLabPolicyCollection.cs | 76 +++ .../Generated/DevTestLabScheduleCollection.cs | 76 +++ .../Generated/DevTestLabSecretCollection.cs | 76 +++ .../DevTestLabServiceFabricCollection.cs | 76 +++ ...vTestLabServiceFabricScheduleCollection.cs | 76 +++ .../DevTestLabServiceRunnerCollection.cs | 74 +++ .../src/Generated/DevTestLabUserCollection.cs | 76 +++ .../DevTestLabVirtualNetworkCollection.cs | 76 +++ .../src/Generated/DevTestLabVmCollection.cs | 76 +++ .../DevTestLabVmScheduleCollection.cs | 76 +++ ...ample_DigitalTwinsDescriptionCollection.cs | 126 +++++ ..._DigitalTwinsEndpointResourceCollection.cs | 86 ++++ ...winsPrivateEndpointConnectionCollection.cs | 43 ++ ...gitalTwinsPrivateLinkResourceCollection.cs | 44 ++ ..._TimeSeriesDatabaseConnectionCollection.cs | 43 ++ .../DigitalTwinsDescriptionCollection.cs | 74 +++ .../DigitalTwinsEndpointResourceCollection.cs | 74 +++ ...winsPrivateEndpointConnectionCollection.cs | 74 +++ ...gitalTwinsPrivateLinkResourceCollection.cs | 74 +++ .../TimeSeriesDatabaseConnectionCollection.cs | 74 +++ .../src/Generated/DnsZoneCollection.cs | 74 +++ .../Generated/DnsForwardingRuleCollection.cs | 74 +++ .../DnsForwardingRulesetCollection.cs | 74 +++ ...dingRulesetVirtualNetworkLinkCollection.cs | 74 +++ .../src/Generated/DnsResolverCollection.cs | 74 +++ .../DnsResolverInboundEndpointCollection.cs | 74 +++ .../DnsResolverOutboundEndpointCollection.cs | 74 +++ .../Generated/DynatraceMonitorCollection.cs | 74 +++ .../DynatraceSingleSignOnCollection.cs | 74 +++ .../Generated/DynatraceTagRuleCollection.cs | 74 +++ .../Sample_EdgeOrderAddressCollection.cs | 42 ++ .../Samples/Sample_EdgeOrderCollection.cs | 44 ++ .../Samples/Sample_EdgeOrderItemCollection.cs | 42 ++ .../Generated/EdgeOrderAddressCollection.cs | 74 +++ .../src/Generated/EdgeOrderCollection.cs | 76 +++ .../src/Generated/EdgeOrderItemCollection.cs | 76 +++ ...Sample_ElasticMonitorResourceCollection.cs | 42 ++ .../Sample_MonitoringTagRuleCollection.cs | 43 ++ .../ElasticMonitorResourceCollection.cs | 74 +++ .../Generated/MonitoringTagRuleCollection.cs | 74 +++ .../Samples/Sample_ElasticSanCollection.cs | 84 ++++ ...cSanPrivateEndpointConnectionCollection.cs | 86 ++++ .../Sample_ElasticSanVolumeCollection.cs | 88 ++++ .../Sample_ElasticSanVolumeGroupCollection.cs | 86 ++++ .../src/Generated/ElasticSanCollection.cs | 74 +++ ...cSanPrivateEndpointConnectionCollection.cs | 74 +++ .../Generated/ElasticSanVolumeCollection.cs | 74 +++ .../ElasticSanVolumeGroupCollection.cs | 74 +++ .../Samples/Sample_CaCertificateCollection.cs | 43 ++ ...ample_DomainEventSubscriptionCollection.cs | 43 ++ .../Samples/Sample_DomainTopicCollection.cs | 43 ++ ..._DomainTopicEventSubscriptionCollection.cs | 44 ++ .../Sample_EventGridDomainCollection.cs | 42 ++ ...mainPrivateEndpointConnectionCollection.cs | 43 ++ ...GridDomainPrivateLinkResourceCollection.cs | 44 ++ ...mple_EventGridNamespaceClientCollection.cs | 43 ++ ...EventGridNamespaceClientGroupCollection.cs | 43 ++ .../Sample_EventGridNamespaceCollection.cs | 42 ++ ...ridNamespacePermissionBindingCollection.cs | 43 ++ ...pacePrivateEndpointConnectionCollection.cs | 43 ++ .../Sample_EventGridTopicCollection.cs | 42 ++ ...opicPrivateEndpointConnectionCollection.cs | 43 ++ ...tGridTopicPrivateLinkResourceCollection.cs | 44 ++ .../Sample_EventSubscriptionCollection.cs | 440 ++++++++++++++++++ .../Sample_NamespaceTopicCollection.cs | 43 ++ ...mespaceTopicEventSubscriptionCollection.cs | 44 ++ .../Sample_PartnerDestinationCollection.cs | 42 ++ ...ample_PartnerNamespaceChannelCollection.cs | 43 ++ .../Sample_PartnerNamespaceCollection.cs | 42 ++ ...rNamespacePrivateLinkResourceCollection.cs | 44 ++ .../Sample_PartnerRegistrationCollection.cs | 42 ++ .../Samples/Sample_PartnerTopicCollection.cs | 42 ++ ...PartnerTopicEventSubscriptionCollection.cs | 43 ++ .../Samples/Sample_SystemTopicCollection.cs | 42 ++ ..._SystemTopicEventSubscriptionCollection.cs | 43 ++ ...Sample_TopicEventSubscriptionCollection.cs | 43 ++ .../Samples/Sample_TopicSpaceCollection.cs | 43 ++ .../Samples/Sample_TopicTypeCollection.cs | 40 ++ .../Sample_VerifiedPartnerCollection.cs | 40 ++ .../src/Generated/CaCertificateCollection.cs | 74 +++ .../DomainEventSubscriptionCollection.cs | 74 +++ .../src/Generated/DomainTopicCollection.cs | 74 +++ .../DomainTopicEventSubscriptionCollection.cs | 74 +++ .../Generated/EventGridDomainCollection.cs | 74 +++ ...mainPrivateEndpointConnectionCollection.cs | 74 +++ ...GridDomainPrivateLinkResourceCollection.cs | 74 +++ .../EventGridNamespaceClientCollection.cs | 74 +++ ...EventGridNamespaceClientGroupCollection.cs | 74 +++ .../Generated/EventGridNamespaceCollection.cs | 74 +++ ...ridNamespacePermissionBindingCollection.cs | 74 +++ ...pacePrivateEndpointConnectionCollection.cs | 74 +++ .../src/Generated/EventGridTopicCollection.cs | 74 +++ ...opicPrivateEndpointConnectionCollection.cs | 74 +++ ...tGridTopicPrivateLinkResourceCollection.cs | 74 +++ .../Generated/EventSubscriptionCollection.cs | 74 +++ .../src/Generated/NamespaceTopicCollection.cs | 74 +++ ...mespaceTopicEventSubscriptionCollection.cs | 74 +++ .../Generated/PartnerDestinationCollection.cs | 74 +++ .../PartnerNamespaceChannelCollection.cs | 74 +++ .../Generated/PartnerNamespaceCollection.cs | 74 +++ ...rNamespacePrivateLinkResourceCollection.cs | 74 +++ .../PartnerRegistrationCollection.cs | 74 +++ .../src/Generated/PartnerTopicCollection.cs | 74 +++ ...PartnerTopicEventSubscriptionCollection.cs | 74 +++ .../src/Generated/SystemTopicCollection.cs | 74 +++ .../SystemTopicEventSubscriptionCollection.cs | 74 +++ .../TopicEventSubscriptionCollection.cs | 74 +++ .../src/Generated/TopicSpaceCollection.cs | 74 +++ .../src/Generated/TopicTypeCollection.cs | 74 +++ .../Generated/VerifiedPartnerCollection.cs | 74 +++ ...ple_EventHubAuthorizationRuleCollection.cs | 44 ++ .../Samples/Sample_EventHubCollection.cs | 43 ++ ...ple_EventHubsApplicationGroupCollection.cs | 43 ++ .../Sample_EventHubsClusterCollection.cs | 42 ++ ...Sample_EventHubsConsumerGroupCollection.cs | 44 ++ ...sterRecoveryAuthorizationRuleCollection.cs | 45 ++ ...ple_EventHubsDisasterRecoveryCollection.cs | 43 ++ ...ubsNamespaceAuthorizationRuleCollection.cs | 43 ++ .../Sample_EventHubsNamespaceCollection.cs | 42 ++ ...HubsPrivateEndpointConnectionCollection.cs | 43 ++ .../Sample_EventHubsSchemaGroupCollection.cs | 43 ++ .../EventHubAuthorizationRuleCollection.cs | 74 +++ .../src/Generated/EventHubCollection.cs | 74 +++ .../EventHubsApplicationGroupCollection.cs | 74 +++ .../Generated/EventHubsClusterCollection.cs | 74 +++ .../EventHubsConsumerGroupCollection.cs | 74 +++ ...sterRecoveryAuthorizationRuleCollection.cs | 74 +++ .../EventHubsDisasterRecoveryCollection.cs | 74 +++ ...ubsNamespaceAuthorizationRuleCollection.cs | 74 +++ .../Generated/EventHubsNamespaceCollection.cs | 74 +++ ...HubsPrivateEndpointConnectionCollection.cs | 74 +++ .../EventHubsSchemaGroupCollection.cs | 74 +++ .../Sample_CustomLocationCollection.cs | 42 ++ .../src/Generated/CustomLocationCollection.cs | 74 +++ .../Sample_FluidRelayContainerCollection.cs | 44 ++ .../Sample_FluidRelayServerCollection.cs | 42 ++ .../FluidRelayContainerCollection.cs | 74 +++ .../Generated/FluidRelayServerCollection.cs | 74 +++ .../Samples/Sample_FrontDoorCollection.cs | 42 ++ .../Sample_FrontDoorExperimentCollection.cs | 43 ++ ...tDoorNetworkExperimentProfileCollection.cs | 42 ++ .../Sample_FrontDoorRulesEngineCollection.cs | 43 ++ ...rWebApplicationFirewallPolicyCollection.cs | 42 ++ .../Sample_FrontendEndpointCollection.cs | 44 ++ .../src/Generated/FrontDoorCollection.cs | 74 +++ .../FrontDoorExperimentCollection.cs | 74 +++ ...tDoorNetworkExperimentProfileCollection.cs | 74 +++ .../FrontDoorRulesEngineCollection.cs | 74 +++ ...rWebApplicationFirewallPolicyCollection.cs | 74 +++ .../Generated/FrontendEndpointCollection.cs | 74 +++ ...fanaPrivateEndpointConnectionCollection.cs | 43 ++ ...le_GrafanaPrivateLinkResourceCollection.cs | 44 ++ .../Sample_ManagedGrafanaCollection.cs | 42 ++ ...fanaPrivateEndpointConnectionCollection.cs | 74 +++ .../GrafanaPrivateLinkResourceCollection.cs | 74 +++ .../src/Generated/ManagedGrafanaCollection.cs | 74 +++ ..._GraphServicesAccountResourceCollection.cs | 42 ++ .../GraphServicesAccountResourceCollection.cs | 74 +++ ...stConfigurationHcrpAssignmentCollection.cs | 42 ++ ...uestConfigurationVmAssignmentCollection.cs | 42 ++ ...stConfigurationVmssAssignmentCollection.cs | 43 ++ ...stConfigurationHcrpAssignmentCollection.cs | 74 +++ ...uestConfigurationVmAssignmentCollection.cs | 74 +++ ...stConfigurationVmssAssignmentCollection.cs | 74 +++ .../Sample_CloudHsmClusterCollection.cs | 42 ++ .../Samples/Sample_DedicatedHsmCollection.cs | 126 +++++ ...ulesPrivateEndpointConnectionCollection.cs | 43 ++ .../Generated/CloudHsmClusterCollection.cs | 74 +++ .../src/Generated/DedicatedHsmCollection.cs | 74 +++ ...ulesPrivateEndpointConnectionCollection.cs | 74 +++ .../Sample_HDInsightClusterCollection.cs | 43 ++ .../Sample_HDInsightClusterPoolCollection.cs | 42 ++ .../Generated/HDInsightClusterCollection.cs | 74 +++ .../HDInsightClusterPoolCollection.cs | 74 +++ .../Sample_HDInsightApplicationCollection.cs | 86 ++++ .../Sample_HDInsightClusterCollection.cs | 84 ++++ ...ightPrivateEndpointConnectionCollection.cs | 43 ++ ..._HDInsightPrivateLinkResourceCollection.cs | 44 ++ .../HDInsightApplicationCollection.cs | 74 +++ .../Generated/HDInsightClusterCollection.cs | 74 +++ ...ightPrivateEndpointConnectionCollection.cs | 74 +++ .../HDInsightPrivateLinkResourceCollection.cs | 74 +++ .../Samples/Sample_HealthBotCollection.cs | 42 ++ .../src/Generated/HealthBotCollection.cs | 74 +++ .../Samples/Sample_DicomServiceCollection.cs | 43 ++ .../Samples/Sample_FhirServiceCollection.cs | 43 ++ ...le_HealthcareApisIotConnectorCollection.cs | 43 ++ ...lthcareApisIotFhirDestinationCollection.cs | 44 ++ .../Sample_HealthcareApisServiceCollection.cs | 42 ++ ...vicePrivateEndpointConnectionCollection.cs | 43 ++ ...pisServicePrivateLinkResourceCollection.cs | 44 ++ ...ample_HealthcareApisWorkspaceCollection.cs | 42 ++ ...pacePrivateEndpointConnectionCollection.cs | 43 ++ ...sWorkspacePrivateLinkResourceCollection.cs | 44 ++ .../src/Generated/DicomServiceCollection.cs | 74 +++ .../src/Generated/FhirServiceCollection.cs | 74 +++ .../HealthcareApisIotConnectorCollection.cs | 74 +++ ...lthcareApisIotFhirDestinationCollection.cs | 74 +++ .../HealthcareApisServiceCollection.cs | 74 +++ ...vicePrivateEndpointConnectionCollection.cs | 74 +++ ...pisServicePrivateLinkResourceCollection.cs | 74 +++ .../HealthcareApisWorkspaceCollection.cs | 74 +++ ...pacePrivateEndpointConnectionCollection.cs | 74 +++ ...sWorkspacePrivateLinkResourceCollection.cs | 74 +++ 352 files changed, 21821 insertions(+) diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceCollection.cs index a8fc692a7df7..8afb45bcf06e 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceCollection.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string backupInstanceName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName} + /// + /// + /// Operation Id + /// BackupInstances_Get + /// + /// + /// + /// The name of the backup 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 backupInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupInstanceName, nameof(backupInstanceName)); + + using var scope = _dataProtectionBackupInstanceBackupInstancesClientDiagnostics.CreateScope("DataProtectionBackupInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataProtectionBackupInstanceBackupInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupInstanceResource(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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName} + /// + /// + /// Operation Id + /// BackupInstances_Get + /// + /// + /// + /// The name of the backup instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupInstanceName, nameof(backupInstanceName)); + + using var scope = _dataProtectionBackupInstanceBackupInstancesClientDiagnostics.CreateScope("DataProtectionBackupInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataProtectionBackupInstanceBackupInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupJobCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupJobCollection.cs index caea804192ff..c63616312f27 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupJobCollection.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupJobCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string jobId, CancellationToken cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using var scope = _dataProtectionBackupJobJobsClientDiagnostics.CreateScope("DataProtectionBackupJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataProtectionBackupJobJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupJobResource(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.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using var scope = _dataProtectionBackupJobJobsClientDiagnostics.CreateScope("DataProtectionBackupJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataProtectionBackupJobJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupPolicyCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupPolicyCollection.cs index a673baa0bcf7..3c8b3fef226f 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupPolicyCollection.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupPolicyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string backupPolicyName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName} + /// + /// + /// Operation Id + /// BackupPolicies_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using var scope = _dataProtectionBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("DataProtectionBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataProtectionBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupPolicyResource(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.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName} + /// + /// + /// Operation Id + /// BackupPolicies_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using var scope = _dataProtectionBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("DataProtectionBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataProtectionBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupRecoveryPointCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupRecoveryPointCollection.cs index 72d73ac4fdb9..deb0df8d7351 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupRecoveryPointCollection.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupRecoveryPointCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string recoveryPointId, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recoveryPointId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointId, nameof(recoveryPointId)); + + using var scope = _dataProtectionBackupRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataProtectionBackupRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataProtectionBackupRecoveryPointRecoveryPointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recoveryPointId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupRecoveryPointResource(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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recoveryPointId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointId, nameof(recoveryPointId)); + + using var scope = _dataProtectionBackupRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataProtectionBackupRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataProtectionBackupRecoveryPointRecoveryPointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recoveryPointId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultCollection.cs index 46bf60d56e8d..20eed1566911 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultCollection.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string vaultName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName} + /// + /// + /// Operation Id + /// BackupVaults_Get + /// + /// + /// + /// The name of the backup vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _dataProtectionBackupVaultBackupVaultsClientDiagnostics.CreateScope("DataProtectionBackupVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataProtectionBackupVaultBackupVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupVaultResource(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.DataProtection/backupVaults/{vaultName} + /// + /// + /// Operation Id + /// BackupVaults_Get + /// + /// + /// + /// The name of the backup vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _dataProtectionBackupVaultBackupVaultsClientDiagnostics.CreateScope("DataProtectionBackupVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataProtectionBackupVaultBackupVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataProtectionBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DeletedDataProtectionBackupInstanceCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DeletedDataProtectionBackupInstanceCollection.cs index 622bc0fddc9e..d373a389be09 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DeletedDataProtectionBackupInstanceCollection.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DeletedDataProtectionBackupInstanceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string backupInstanceName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName} + /// + /// + /// Operation Id + /// DeletedBackupInstances_Get + /// + /// + /// + /// The name of the deleted backup 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 backupInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupInstanceName, nameof(backupInstanceName)); + + using var scope = _deletedDataProtectionBackupInstanceDeletedBackupInstancesClientDiagnostics.CreateScope("DeletedDataProtectionBackupInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deletedDataProtectionBackupInstanceDeletedBackupInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedDataProtectionBackupInstanceResource(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.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName} + /// + /// + /// Operation Id + /// DeletedBackupInstances_Get + /// + /// + /// + /// The name of the deleted backup instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupInstanceName, nameof(backupInstanceName)); + + using var scope = _deletedDataProtectionBackupInstanceDeletedBackupInstancesClientDiagnostics.CreateScope("DeletedDataProtectionBackupInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deletedDataProtectionBackupInstanceDeletedBackupInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedDataProtectionBackupInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardCollection.cs index d48c4dd4bb8b..7d5562c83bbc 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardCollection.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceGuardsName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName} + /// + /// + /// Operation Id + /// ResourceGuards_Get + /// + /// + /// + /// The name of ResourceGuard. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceGuardsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardsName, nameof(resourceGuardsName)); + + using var scope = _resourceGuardClientDiagnostics.CreateScope("ResourceGuardCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceGuardRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceGuardsName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardResource(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.DataProtection/resourceGuards/{resourceGuardsName} + /// + /// + /// Operation Id + /// ResourceGuards_Get + /// + /// + /// + /// The name of ResourceGuard. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceGuardsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardsName, nameof(resourceGuardsName)); + + using var scope = _resourceGuardClientDiagnostics.CreateScope("ResourceGuardCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceGuardRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceGuardsName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceCollection.cs index 35d74afaff6f..0769e479705d 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceCollection.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string resourceGuardProxyName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// name of the resource guard proxy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceGuardProxyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardProxyBaseResource(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.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// name of the resource guard proxy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceGuardProxyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardProxyBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareAccountCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareAccountCollection.cs index 74dab22e6b8d..c2b21030f409 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareAccountCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareAccountCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_AccountsGet() Console.WriteLine($"Succeeded: {result}"); } + // Accounts_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AccountsGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/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 = "12345678-1234-1234-12345678abc"; + string resourceGroupName = "SampleResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataShareAccountResource + DataShareAccountCollection collection = resourceGroupResource.GetDataShareAccounts(); + + // invoke the operation + string accountName = "Account1"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + DataShareAccountResource 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 + DataShareAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Accounts_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareCollection.cs index 2423134908e7..e7bbe381943a 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_SharesGet() Console.WriteLine($"Succeeded: {result}"); } + // Shares_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SharesGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/Shares_Get.json + // this example is just showing the usage of "Shares_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 DataShareAccountResource created on azure + // for more information of creating DataShareAccountResource, please refer to the document of DataShareAccountResource + string subscriptionId = "12345678-1234-1234-12345678abc"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "Account1"; + ResourceIdentifier dataShareAccountResourceId = DataShareAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DataShareAccountResource dataShareAccount = client.GetDataShareAccountResource(dataShareAccountResourceId); + + // get the collection of this DataShareResource + DataShareCollection collection = dataShareAccount.GetDataShares(); + + // invoke the operation + string shareName = "Share1"; + NullableResponse response = await collection.GetIfExistsAsync(shareName); + DataShareResource 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 + DataShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Shares_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareConsumerInvitationCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareConsumerInvitationCollection.cs index f042869a46b7..9d17ac46378d 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareConsumerInvitationCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareConsumerInvitationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -108,5 +109,45 @@ public async Task Exists_ConsumerInvitationsGet() Console.WriteLine($"Succeeded: {result}"); } + + // ConsumerInvitations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConsumerInvitationsGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/ConsumerInvitations_Get.json + // this example is just showing the usage of "ConsumerInvitations_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this DataShareConsumerInvitationResource + DataShareConsumerInvitationCollection collection = tenantResource.GetDataShareConsumerInvitations(); + + // invoke the operation + AzureLocation location = new AzureLocation("East US 2"); + Guid invitationId = Guid.Parse("dfbbc788-19eb-4607-a5a1-c74181bfff03"); + NullableResponse response = await collection.GetIfExistsAsync(location, invitationId); + DataShareConsumerInvitationResource 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 + DataShareConsumerInvitationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareInvitationCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareInvitationCollection.cs index 36de249c68e4..33af28d5a8f1 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareInvitationCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareInvitationCollection.cs @@ -85,6 +85,50 @@ public async Task Exists_InvitationsGet() Console.WriteLine($"Succeeded: {result}"); } + // Invitations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_InvitationsGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/Invitations_Get.json + // this example is just showing the usage of "Invitations_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 DataShareResource created on azure + // for more information of creating DataShareResource, please refer to the document of DataShareResource + string subscriptionId = "433a8dfd-e5d5-4e77-ad86-90acdc75eb1a"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "Account1"; + string shareName = "Share1"; + ResourceIdentifier dataShareResourceId = DataShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, shareName); + DataShareResource dataShare = client.GetDataShareResource(dataShareResourceId); + + // get the collection of this DataShareInvitationResource + DataShareInvitationCollection collection = dataShare.GetDataShareInvitations(); + + // invoke the operation + string invitationName = "Invitation1"; + NullableResponse response = await collection.GetIfExistsAsync(invitationName); + DataShareInvitationResource 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 + DataShareInvitationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Invitations_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareSynchronizationSettingCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareSynchronizationSettingCollection.cs index a417639c1480..26e2f5101035 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareSynchronizationSettingCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareSynchronizationSettingCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_SynchronizationSettingsGet() Console.WriteLine($"Succeeded: {result}"); } + // SynchronizationSettings_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SynchronizationSettingsGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/SynchronizationSettings_Get.json + // this example is just showing the usage of "SynchronizationSettings_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 DataShareResource created on azure + // for more information of creating DataShareResource, please refer to the document of DataShareResource + string subscriptionId = "433a8dfd-e5d5-4e77-ad86-90acdc75eb1a"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "Account1"; + string shareName = "Share1"; + ResourceIdentifier dataShareResourceId = DataShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, shareName); + DataShareResource dataShare = client.GetDataShareResource(dataShareResourceId); + + // get the collection of this DataShareSynchronizationSettingResource + DataShareSynchronizationSettingCollection collection = dataShare.GetDataShareSynchronizationSettings(); + + // invoke the operation + string synchronizationSettingName = "SynchronizationSetting1"; + NullableResponse response = await collection.GetIfExistsAsync(synchronizationSettingName); + DataShareSynchronizationSettingResource 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 + DataShareSynchronizationSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SynchronizationSettings_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareTriggerCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareTriggerCollection.cs index d5af5dc3d00f..f160664ca7bb 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareTriggerCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_DataShareTriggerCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_TriggersGet() Console.WriteLine($"Succeeded: {result}"); } + // Triggers_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TriggersGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/Triggers_Get.json + // this example is just showing the usage of "Triggers_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 ShareSubscriptionResource created on azure + // for more information of creating ShareSubscriptionResource, please refer to the document of ShareSubscriptionResource + string subscriptionId = "433a8dfd-e5d5-4e77-ad86-90acdc75eb1a"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "Account1"; + string shareSubscriptionName = "ShareSubscription1"; + ResourceIdentifier shareSubscriptionResourceId = ShareSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, shareSubscriptionName); + ShareSubscriptionResource shareSubscription = client.GetShareSubscriptionResource(shareSubscriptionResourceId); + + // get the collection of this DataShareTriggerResource + DataShareTriggerCollection collection = shareSubscription.GetDataShareTriggers(); + + // invoke the operation + string triggerName = "Trigger1"; + NullableResponse response = await collection.GetIfExistsAsync(triggerName); + DataShareTriggerResource 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 + DataShareTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Triggers_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ProviderShareSubscriptionCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ProviderShareSubscriptionCollection.cs index e7c97ce1b81b..8118ca89de7e 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ProviderShareSubscriptionCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ProviderShareSubscriptionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_ProviderShareSubscriptionsGetByShare() Console.WriteLine($"Succeeded: {result}"); } + // ProviderShareSubscriptions_GetByShare + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProviderShareSubscriptionsGetByShare() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/ProviderShareSubscriptions_GetByShare.json + // this example is just showing the usage of "ProviderShareSubscriptions_GetByShare" 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 DataShareResource created on azure + // for more information of creating DataShareResource, please refer to the document of DataShareResource + string subscriptionId = "12345678-1234-1234-12345678abc"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "Account1"; + string shareName = "Share1"; + ResourceIdentifier dataShareResourceId = DataShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, shareName); + DataShareResource dataShare = client.GetDataShareResource(dataShareResourceId); + + // get the collection of this ProviderShareSubscriptionResource + ProviderShareSubscriptionCollection collection = dataShare.GetProviderShareSubscriptions(); + + // invoke the operation + string providerShareSubscriptionId = "4256e2cf-0f82-4865-961b-12f83333f487"; + NullableResponse response = await collection.GetIfExistsAsync(providerShareSubscriptionId); + ProviderShareSubscriptionResource 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 + ProviderShareSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ProviderShareSubscriptions_ListByShare [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareDataSetCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareDataSetCollection.cs index 10aa0bb36d73..90334b771ab3 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareDataSetCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareDataSetCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_DataSetsGet() Console.WriteLine($"Succeeded: {result}"); } + // DataSets_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataSetsGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/DataSets_Get.json + // this example is just showing the usage of "DataSets_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 DataShareResource created on azure + // for more information of creating DataShareResource, please refer to the document of DataShareResource + string subscriptionId = "433a8dfd-e5d5-4e77-ad86-90acdc75eb1a"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "Account1"; + string shareName = "Share1"; + ResourceIdentifier dataShareResourceId = DataShareResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, shareName); + DataShareResource dataShare = client.GetDataShareResource(dataShareResourceId); + + // get the collection of this ShareDataSetResource + ShareDataSetCollection collection = dataShare.GetShareDataSets(); + + // invoke the operation + string dataSetName = "Dataset1"; + NullableResponse response = await collection.GetIfExistsAsync(dataSetName); + ShareDataSetResource 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 + ShareDataSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DataSets_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareDataSetMappingCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareDataSetMappingCollection.cs index f49af1a0fe38..e8da16b446ec 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareDataSetMappingCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareDataSetMappingCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_DataSetMappingsGet() Console.WriteLine($"Succeeded: {result}"); } + // DataSetMappings_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataSetMappingsGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/DataSetMappings_Get.json + // this example is just showing the usage of "DataSetMappings_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 ShareSubscriptionResource created on azure + // for more information of creating ShareSubscriptionResource, please refer to the document of ShareSubscriptionResource + string subscriptionId = "433a8dfd-e5d5-4e77-ad86-90acdc75eb1a"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "Account1"; + string shareSubscriptionName = "ShareSubscription1"; + ResourceIdentifier shareSubscriptionResourceId = ShareSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, shareSubscriptionName); + ShareSubscriptionResource shareSubscription = client.GetShareSubscriptionResource(shareSubscriptionResourceId); + + // get the collection of this ShareDataSetMappingResource + ShareDataSetMappingCollection collection = shareSubscription.GetShareDataSetMappings(); + + // invoke the operation + string dataSetMappingName = "DatasetMapping1"; + NullableResponse response = await collection.GetIfExistsAsync(dataSetMappingName); + ShareDataSetMappingResource 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 + ShareDataSetMappingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DataSetMappings_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareSubscriptionCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareSubscriptionCollection.cs index dc15603543df..6f279492c876 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareSubscriptionCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/samples/Generated/Samples/Sample_ShareSubscriptionCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_ShareSubscriptionsGet() Console.WriteLine($"Succeeded: {result}"); } + // ShareSubscriptions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ShareSubscriptionsGet() + { + // Generated from example definition: specification/datashare/resource-manager/Microsoft.DataShare/stable/2021-08-01/examples/ShareSubscriptions_Get.json + // this example is just showing the usage of "ShareSubscriptions_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 DataShareAccountResource created on azure + // for more information of creating DataShareAccountResource, please refer to the document of DataShareAccountResource + string subscriptionId = "12345678-1234-1234-12345678abc"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "Account1"; + ResourceIdentifier dataShareAccountResourceId = DataShareAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DataShareAccountResource dataShareAccount = client.GetDataShareAccountResource(dataShareAccountResourceId); + + // get the collection of this ShareSubscriptionResource + ShareSubscriptionCollection collection = dataShareAccount.GetShareSubscriptions(); + + // invoke the operation + string shareSubscriptionName = "ShareSubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(shareSubscriptionName); + ShareSubscriptionResource 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 + ShareSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ShareSubscriptions_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountCollection.cs index 96a5b6f7a738..6aa5f6b4764a 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the share 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _dataShareAccountAccountsClientDiagnostics.CreateScope("DataShareAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataShareAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareAccountResource(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.DataShare/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the share account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _dataShareAccountAccountsClientDiagnostics.CreateScope("DataShareAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataShareAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareCollection.cs index 49a0ececcb00..b68ac27a01aa 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string shareName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName} + /// + /// + /// Operation Id + /// Shares_Get + /// + /// + /// + /// The name of the share to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string shareName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(shareName, nameof(shareName)); + + using var scope = _dataShareSharesClientDiagnostics.CreateScope("DataShareCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataShareSharesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, shareName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareResource(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.DataShare/accounts/{accountName}/shares/{shareName} + /// + /// + /// Operation Id + /// Shares_Get + /// + /// + /// + /// The name of the share to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string shareName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(shareName, nameof(shareName)); + + using var scope = _dataShareSharesClientDiagnostics.CreateScope("DataShareCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataShareSharesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, shareName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareConsumerInvitationCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareConsumerInvitationCollection.cs index 2d53ed2892cf..b727956af428 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareConsumerInvitationCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareConsumerInvitationCollection.cs @@ -232,6 +232,74 @@ public virtual Response Exists(AzureLocation location, Guid invitationId, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId} + /// + /// + /// Operation Id + /// ConsumerInvitations_Get + /// + /// + /// + /// Location of the invitation. + /// An invitation id. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AzureLocation location, Guid invitationId, CancellationToken cancellationToken = default) + { + using var scope = _dataShareConsumerInvitationConsumerInvitationsClientDiagnostics.CreateScope("DataShareConsumerInvitationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataShareConsumerInvitationConsumerInvitationsRestClient.GetAsync(location, invitationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareConsumerInvitationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId} + /// + /// + /// Operation Id + /// ConsumerInvitations_Get + /// + /// + /// + /// Location of the invitation. + /// An invitation id. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AzureLocation location, Guid invitationId, CancellationToken cancellationToken = default) + { + using var scope = _dataShareConsumerInvitationConsumerInvitationsClientDiagnostics.CreateScope("DataShareConsumerInvitationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataShareConsumerInvitationConsumerInvitationsRestClient.Get(location, invitationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareConsumerInvitationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareInvitationCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareInvitationCollection.cs index 9c1140670d74..fe8224ccfddd 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareInvitationCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareInvitationCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string invitationName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/invitations/{invitationName} + /// + /// + /// Operation Id + /// Invitations_Get + /// + /// + /// + /// The name of the invitation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string invitationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(invitationName, nameof(invitationName)); + + using var scope = _dataShareInvitationInvitationsClientDiagnostics.CreateScope("DataShareInvitationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataShareInvitationInvitationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, invitationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareInvitationResource(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.DataShare/accounts/{accountName}/shares/{shareName}/invitations/{invitationName} + /// + /// + /// Operation Id + /// Invitations_Get + /// + /// + /// + /// The name of the invitation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string invitationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(invitationName, nameof(invitationName)); + + using var scope = _dataShareInvitationInvitationsClientDiagnostics.CreateScope("DataShareInvitationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataShareInvitationInvitationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, invitationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareInvitationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareSynchronizationSettingCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareSynchronizationSettingCollection.cs index 8d70ea300a51..408c7382d149 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareSynchronizationSettingCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareSynchronizationSettingCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string synchronizationSettingName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/synchronizationSettings/{synchronizationSettingName} + /// + /// + /// Operation Id + /// SynchronizationSettings_Get + /// + /// + /// + /// The name of the synchronizationSetting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string synchronizationSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(synchronizationSettingName, nameof(synchronizationSettingName)); + + using var scope = _dataShareSynchronizationSettingSynchronizationSettingsClientDiagnostics.CreateScope("DataShareSynchronizationSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataShareSynchronizationSettingSynchronizationSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, synchronizationSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareSynchronizationSettingResource(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.DataShare/accounts/{accountName}/shares/{shareName}/synchronizationSettings/{synchronizationSettingName} + /// + /// + /// Operation Id + /// SynchronizationSettings_Get + /// + /// + /// + /// The name of the synchronizationSetting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string synchronizationSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(synchronizationSettingName, nameof(synchronizationSettingName)); + + using var scope = _dataShareSynchronizationSettingSynchronizationSettingsClientDiagnostics.CreateScope("DataShareSynchronizationSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataShareSynchronizationSettingSynchronizationSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, synchronizationSettingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareSynchronizationSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareTriggerCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareTriggerCollection.cs index cd73aa05824b..0b5275aed0b2 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareTriggerCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareTriggerCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string triggerName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/triggers/{triggerName} + /// + /// + /// Operation Id + /// Triggers_Get + /// + /// + /// + /// The name of the trigger. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string triggerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); + + using var scope = _dataShareTriggerTriggersClientDiagnostics.CreateScope("DataShareTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataShareTriggerTriggersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, triggerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareTriggerResource(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.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/triggers/{triggerName} + /// + /// + /// Operation Id + /// Triggers_Get + /// + /// + /// + /// The name of the trigger. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string triggerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); + + using var scope = _dataShareTriggerTriggersClientDiagnostics.CreateScope("DataShareTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataShareTriggerTriggersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, triggerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataShareTriggerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ProviderShareSubscriptionCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ProviderShareSubscriptionCollection.cs index 957dc5d876ba..16685e40d2a0 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ProviderShareSubscriptionCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ProviderShareSubscriptionCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string providerShareSubscriptionId, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId} + /// + /// + /// Operation Id + /// ProviderShareSubscriptions_GetByShare + /// + /// + /// + /// To locate shareSubscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string providerShareSubscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerShareSubscriptionId, nameof(providerShareSubscriptionId)); + + using var scope = _providerShareSubscriptionClientDiagnostics.CreateScope("ProviderShareSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _providerShareSubscriptionRestClient.GetByShareAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, providerShareSubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProviderShareSubscriptionResource(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.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId} + /// + /// + /// Operation Id + /// ProviderShareSubscriptions_GetByShare + /// + /// + /// + /// To locate shareSubscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string providerShareSubscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerShareSubscriptionId, nameof(providerShareSubscriptionId)); + + using var scope = _providerShareSubscriptionClientDiagnostics.CreateScope("ProviderShareSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _providerShareSubscriptionRestClient.GetByShare(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, providerShareSubscriptionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProviderShareSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetCollection.cs index 8cd8ab5df934..4ca47f2bc11f 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string dataSetName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/dataSets/{dataSetName} + /// + /// + /// Operation Id + /// DataSets_Get + /// + /// + /// + /// The name of the dataSet. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataSetName, nameof(dataSetName)); + + using var scope = _shareDataSetDataSetsClientDiagnostics.CreateScope("ShareDataSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _shareDataSetDataSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ShareDataSetResource(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.DataShare/accounts/{accountName}/shares/{shareName}/dataSets/{dataSetName} + /// + /// + /// Operation Id + /// DataSets_Get + /// + /// + /// + /// The name of the dataSet. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataSetName, nameof(dataSetName)); + + using var scope = _shareDataSetDataSetsClientDiagnostics.CreateScope("ShareDataSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _shareDataSetDataSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataSetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ShareDataSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetMappingCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetMappingCollection.cs index a89c3c860335..1b6f6640c732 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetMappingCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetMappingCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string dataSetMappingName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName} + /// + /// + /// Operation Id + /// DataSetMappings_Get + /// + /// + /// + /// The name of the dataSetMapping. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataSetMappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataSetMappingName, nameof(dataSetMappingName)); + + using var scope = _shareDataSetMappingDataSetMappingsClientDiagnostics.CreateScope("ShareDataSetMappingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _shareDataSetMappingDataSetMappingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataSetMappingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ShareDataSetMappingResource(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.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName} + /// + /// + /// Operation Id + /// DataSetMappings_Get + /// + /// + /// + /// The name of the dataSetMapping. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataSetMappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataSetMappingName, nameof(dataSetMappingName)); + + using var scope = _shareDataSetMappingDataSetMappingsClientDiagnostics.CreateScope("ShareDataSetMappingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _shareDataSetMappingDataSetMappingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataSetMappingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ShareDataSetMappingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionCollection.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionCollection.cs index 2ef26fc4c804..539a6d29bdb8 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionCollection.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string shareSubscriptionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName} + /// + /// + /// Operation Id + /// ShareSubscriptions_Get + /// + /// + /// + /// The name of the shareSubscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string shareSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(shareSubscriptionName, nameof(shareSubscriptionName)); + + using var scope = _shareSubscriptionClientDiagnostics.CreateScope("ShareSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _shareSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, shareSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ShareSubscriptionResource(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.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName} + /// + /// + /// Operation Id + /// ShareSubscriptions_Get + /// + /// + /// + /// The name of the shareSubscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string shareSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(shareSubscriptionName, nameof(shareSubscriptionName)); + + using var scope = _shareSubscriptionClientDiagnostics.CreateScope("ShareSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _shareSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, shareSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ShareSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/samples/Generated/Samples/Sample_EasmLabelCollection.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/samples/Generated/Samples/Sample_EasmLabelCollection.cs index 4c4e4ca24197..99c0e8e035fe 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/samples/Generated/Samples/Sample_EasmLabelCollection.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/samples/Generated/Samples/Sample_EasmLabelCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_Labels() Console.WriteLine($"Succeeded: {result}"); } + // Labels + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_Labels() + { + // Generated from example definition: specification/riskiq/resource-manager/Microsoft.Easm/preview/2023-04-01-preview/examples/Labels_GetByWorkspace.json + // this example is just showing the usage of "Labels_GetByWorkspace" 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 EasmWorkspaceResource created on azure + // for more information of creating EasmWorkspaceResource, please refer to the document of EasmWorkspaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "dummyrg"; + string workspaceName = "ThisisaWorkspace"; + ResourceIdentifier easmWorkspaceResourceId = EasmWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + EasmWorkspaceResource easmWorkspace = client.GetEasmWorkspaceResource(easmWorkspaceResourceId); + + // get the collection of this EasmLabelResource + EasmLabelCollection collection = easmWorkspace.GetEasmLabels(); + + // invoke the operation + string labelName = "ThisisaLabel"; + NullableResponse response = await collection.GetIfExistsAsync(labelName); + EasmLabelResource 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 + EasmLabelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Labels [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/samples/Generated/Samples/Sample_EasmWorkspaceCollection.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/samples/Generated/Samples/Sample_EasmWorkspaceCollection.cs index 12ffdebd7d70..3185f4207524 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/samples/Generated/Samples/Sample_EasmWorkspaceCollection.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/samples/Generated/Samples/Sample_EasmWorkspaceCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_Workspaces() Console.WriteLine($"Succeeded: {result}"); } + // Workspaces + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_Workspaces() + { + // Generated from example definition: specification/riskiq/resource-manager/Microsoft.Easm/preview/2023-04-01-preview/examples/Workspaces_Get.json + // this example is just showing the usage of "Workspaces_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 EasmWorkspaceResource + EasmWorkspaceCollection collection = resourceGroupResource.GetEasmWorkspaces(); + + // invoke the operation + string workspaceName = "ThisisaWorkspace"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + EasmWorkspaceResource 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 + EasmWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Workspaces [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmLabelCollection.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmLabelCollection.cs index 7b3c7611f963..fc195044dabe 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmLabelCollection.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmLabelCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string labelName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces/{workspaceName}/labels/{labelName} + /// + /// + /// Operation Id + /// Labels_GetByWorkspace + /// + /// + /// + /// The name of the Label. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string labelName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(labelName, nameof(labelName)); + + using var scope = _easmLabelLabelsClientDiagnostics.CreateScope("EasmLabelCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _easmLabelLabelsRestClient.GetByWorkspaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, labelName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EasmLabelResource(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.Easm/workspaces/{workspaceName}/labels/{labelName} + /// + /// + /// Operation Id + /// Labels_GetByWorkspace + /// + /// + /// + /// The name of the Label. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string labelName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(labelName, nameof(labelName)); + + using var scope = _easmLabelLabelsClientDiagnostics.CreateScope("EasmLabelCollection.GetIfExists"); + scope.Start(); + try + { + var response = _easmLabelLabelsRestClient.GetByWorkspace(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, labelName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EasmLabelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceCollection.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceCollection.cs index da7dca1b798b..99c39587b200 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceCollection.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the Workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _easmWorkspaceWorkspacesClientDiagnostics.CreateScope("EasmWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _easmWorkspaceWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EasmWorkspaceResource(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.Easm/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the Workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _easmWorkspaceWorkspacesClientDiagnostics.CreateScope("EasmWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _easmWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EasmWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ArtifactSourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ArtifactSourceCollection.cs index bf9c35f0bc70..723d1d8bfcb5 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ArtifactSourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ArtifactSourceCollection.cs @@ -176,6 +176,48 @@ public async Task Exists_GetArtifactSource() Console.WriteLine($"Succeeded: {result}"); } + // Get artifact source + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetArtifactSource() + { + // Generated from example definition: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/artifactsource_get.json + // this example is just showing the usage of "ArtifactSources_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 = "caac1590-e859-444f-a9e0-62091c0f5929"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ArtifactSourceResource + ArtifactSourceCollection collection = resourceGroupResource.GetArtifactSources(); + + // invoke the operation + string artifactSourceName = "myArtifactSource"; + NullableResponse response = await collection.GetIfExistsAsync(artifactSourceName); + ArtifactSourceResource 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 + ArtifactSourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List steps [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_RolloutCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_RolloutCollection.cs index 850d4871806b..bf92572c4b4e 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_RolloutCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_RolloutCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -81,6 +82,48 @@ public async Task Exists_GetRollout() Console.WriteLine($"Succeeded: {result}"); } + // Get rollout + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRollout() + { + // Generated from example definition: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/rollout_get.json + // this example is just showing the usage of "Rollouts_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 = "caac1590-e859-444f-a9e0-62091c0f5929"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RolloutResource + RolloutCollection collection = resourceGroupResource.GetRollouts(); + + // invoke the operation + string rolloutName = "myRollout"; + NullableResponse response = await collection.GetIfExistsAsync(rolloutName); + RolloutResource 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 + RolloutData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List rollouts by resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceResourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceResourceCollection.cs index fb7b7fc26546..45a259635974 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceResourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceResourceCollection.cs @@ -125,6 +125,49 @@ public async Task Exists_GetService() Console.WriteLine($"Succeeded: {result}"); } + // Get service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetService() + { + // Generated from example definition: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/service_get.json + // this example is just showing the usage of "Services_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 ServiceTopologyResource created on azure + // for more information of creating ServiceTopologyResource, please refer to the document of ServiceTopologyResource + string subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + string resourceGroupName = "myResourceGroup"; + string serviceTopologyName = "myTopology"; + ResourceIdentifier serviceTopologyResourceId = ServiceTopologyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceTopologyName); + ServiceTopologyResource serviceTopologyResource = client.GetServiceTopologyResource(serviceTopologyResourceId); + + // get the collection of this ServiceResource + ServiceResourceCollection collection = serviceTopologyResource.GetServiceResources(); + + // invoke the operation + string serviceName = "myService"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + ServiceResource 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 + ServiceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List services [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceTopologyResourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceTopologyResourceCollection.cs index fe5bfe1e7b4c..6abb2d481831 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceTopologyResourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceTopologyResourceCollection.cs @@ -165,6 +165,48 @@ public async Task Exists_GetTopology() Console.WriteLine($"Succeeded: {result}"); } + // Get topology + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTopology() + { + // Generated from example definition: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/servicetopology_get.json + // this example is just showing the usage of "ServiceTopologies_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 = "caac1590-e859-444f-a9e0-62091c0f5929"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ServiceTopologyResource + ServiceTopologyResourceCollection collection = resourceGroupResource.GetServiceTopologyResources(); + + // invoke the operation + string serviceTopologyName = "myTopology"; + NullableResponse response = await collection.GetIfExistsAsync(serviceTopologyName); + ServiceTopologyResource 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 + ServiceTopologyResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List topologies [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceUnitResourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceUnitResourceCollection.cs index 26a8ba159004..20a704c3dae0 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceUnitResourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_ServiceUnitResourceCollection.cs @@ -182,6 +182,50 @@ public async Task Exists_GetServiceUnit() Console.WriteLine($"Succeeded: {result}"); } + // Get service unit + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetServiceUnit() + { + // Generated from example definition: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/serviceunit_get.json + // this example is just showing the usage of "ServiceUnits_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 ServiceResource created on azure + // for more information of creating ServiceResource, please refer to the document of ServiceResource + string subscriptionId = "caac1590-e859-444f-a9e0-62091c0f5929"; + string resourceGroupName = "myResourceGroup"; + string serviceTopologyName = "myTopology"; + string serviceName = "myService"; + ResourceIdentifier serviceResourceId = ServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceTopologyName, serviceName); + ServiceResource serviceResource = client.GetServiceResource(serviceResourceId); + + // get the collection of this ServiceUnitResource + ServiceUnitResourceCollection collection = serviceResource.GetServiceUnitResources(); + + // invoke the operation + string serviceUnitName = "myServiceUnit"; + NullableResponse response = await collection.GetIfExistsAsync(serviceUnitName); + ServiceUnitResource 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 + ServiceUnitResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List service units [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_StepResourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_StepResourceCollection.cs index 7a31fd5e16be..0a81365d4e46 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_StepResourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/samples/Generated/Samples/Sample_StepResourceCollection.cs @@ -208,6 +208,48 @@ public async Task Exists_GetDeploymentStep() Console.WriteLine($"Succeeded: {result}"); } + // Get deployment step + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDeploymentStep() + { + // Generated from example definition: specification/deploymentmanager/resource-manager/Microsoft.DeploymentManager/preview/2019-11-01-preview/examples/step_get.json + // this example is just showing the usage of "Steps_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 = "caac1590-e859-444f-a9e0-62091c0f5929"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StepResource + StepResourceCollection collection = resourceGroupResource.GetStepResources(); + + // invoke the operation + string stepName = "waitStep"; + NullableResponse response = await collection.GetIfExistsAsync(stepName); + StepResource 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 + StepResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List steps [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ArtifactSourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ArtifactSourceCollection.cs index efc19e3dc146..8b724d83cf36 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ArtifactSourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ArtifactSourceCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string artifactSourceName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName} + /// + /// + /// Operation Id + /// ArtifactSources_Get + /// + /// + /// + /// The name of the artifact source. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string artifactSourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); + + using var scope = _artifactSourceClientDiagnostics.CreateScope("ArtifactSourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _artifactSourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, artifactSourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactSourceResource(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.DeploymentManager/artifactSources/{artifactSourceName} + /// + /// + /// Operation Id + /// ArtifactSources_Get + /// + /// + /// + /// The name of the artifact source. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string artifactSourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); + + using var scope = _artifactSourceClientDiagnostics.CreateScope("ArtifactSourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _artifactSourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, artifactSourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactSourceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/RolloutCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/RolloutCollection.cs index 0b9caaf4f136..58c82a7e2254 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/RolloutCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/RolloutCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string rolloutName, int? retryAttempt = nul } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName} + /// + /// + /// Operation Id + /// Rollouts_Get + /// + /// + /// + /// The rollout name. + /// Rollout retry attempt ordinal to get the result of. If not specified, result of the latest attempt will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string rolloutName, int? retryAttempt = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rolloutName, nameof(rolloutName)); + + using var scope = _rolloutClientDiagnostics.CreateScope("RolloutCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _rolloutRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, rolloutName, retryAttempt, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RolloutResource(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.DeploymentManager/rollouts/{rolloutName} + /// + /// + /// Operation Id + /// Rollouts_Get + /// + /// + /// + /// The rollout name. + /// Rollout retry attempt ordinal to get the result of. If not specified, result of the latest attempt will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string rolloutName, int? retryAttempt = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rolloutName, nameof(rolloutName)); + + using var scope = _rolloutClientDiagnostics.CreateScope("RolloutCollection.GetIfExists"); + scope.Start(); + try + { + var response = _rolloutRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, rolloutName, retryAttempt, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RolloutResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceResourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceResourceCollection.cs index 9e6726237594..cb3ba682615b 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceResourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceResourceCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service 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 serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _serviceResourceServicesClientDiagnostics.CreateScope("ServiceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceResourceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceResource(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.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _serviceResourceServicesClientDiagnostics.CreateScope("ServiceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceResourceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceTopologyResourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceTopologyResourceCollection.cs index c7b41119da01..25286c1fad9e 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceTopologyResourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceTopologyResourceCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string serviceTopologyName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName} + /// + /// + /// Operation Id + /// ServiceTopologies_Get + /// + /// + /// + /// The name of the service topology . + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceTopologyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceTopologyName, nameof(serviceTopologyName)); + + using var scope = _serviceTopologyResourceServiceTopologiesClientDiagnostics.CreateScope("ServiceTopologyResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceTopologyResourceServiceTopologiesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceTopologyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceTopologyResource(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.DeploymentManager/serviceTopologies/{serviceTopologyName} + /// + /// + /// Operation Id + /// ServiceTopologies_Get + /// + /// + /// + /// The name of the service topology . + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceTopologyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceTopologyName, nameof(serviceTopologyName)); + + using var scope = _serviceTopologyResourceServiceTopologiesClientDiagnostics.CreateScope("ServiceTopologyResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceTopologyResourceServiceTopologiesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serviceTopologyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceTopologyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceUnitResourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceUnitResourceCollection.cs index 257829becec9..e21945778c0e 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceUnitResourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/ServiceUnitResourceCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string serviceUnitName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName} + /// + /// + /// Operation Id + /// ServiceUnits_Get + /// + /// + /// + /// The name of the service unit 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 serviceUnitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceUnitName, nameof(serviceUnitName)); + + using var scope = _serviceUnitResourceServiceUnitsClientDiagnostics.CreateScope("ServiceUnitResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceUnitResourceServiceUnitsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, serviceUnitName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceUnitResource(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.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName} + /// + /// + /// Operation Id + /// ServiceUnits_Get + /// + /// + /// + /// The name of the service unit resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceUnitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceUnitName, nameof(serviceUnitName)); + + using var scope = _serviceUnitResourceServiceUnitsClientDiagnostics.CreateScope("ServiceUnitResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceUnitResourceServiceUnitsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, serviceUnitName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceUnitResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/StepResourceCollection.cs b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/StepResourceCollection.cs index b8e5deec6666..bd55aa529877 100644 --- a/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/StepResourceCollection.cs +++ b/sdk/deploymentmanager/Azure.ResourceManager.DeploymentManager/src/Generated/StepResourceCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string stepName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName} + /// + /// + /// Operation Id + /// Steps_Get + /// + /// + /// + /// The name of the deployment step. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string stepName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stepName, nameof(stepName)); + + using var scope = _stepResourceStepsClientDiagnostics.CreateScope("StepResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _stepResourceStepsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, stepName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StepResource(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.DeploymentManager/steps/{stepName} + /// + /// + /// Operation Id + /// Steps_Get + /// + /// + /// + /// The name of the deployment step. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string stepName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stepName, nameof(stepName)); + + using var scope = _stepResourceStepsClientDiagnostics.CreateScope("StepResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _stepResourceStepsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, stepName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StepResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_HostPoolCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_HostPoolCollection.cs index c4d474e3b61c..f64ec57630d2 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_HostPoolCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_HostPoolCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_HostPoolGet() Console.WriteLine($"Succeeded: {result}"); } + // HostPool_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HostPoolGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/HostPool_Get.json + // this example is just showing the usage of "HostPools_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 = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HostPoolResource + HostPoolCollection collection = resourceGroupResource.GetHostPools(); + + // invoke the operation + string hostPoolName = "hostPool1"; + NullableResponse response = await collection.GetIfExistsAsync(hostPoolName); + HostPoolResource 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 + HostPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HostPool_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_MsixPackageCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_MsixPackageCollection.cs index 234e264f49cb..7db0084f63df 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_MsixPackageCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_MsixPackageCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_MSIXPackageGet() Console.WriteLine($"Succeeded: {result}"); } + // MSIXPackage_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MSIXPackageGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/MsixPackage_Get.json + // this example is just showing the usage of "MSIXPackages_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 HostPoolResource created on azure + // for more information of creating HostPoolResource, please refer to the document of HostPoolResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostpool1"; + ResourceIdentifier hostPoolResourceId = HostPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + HostPoolResource hostPool = client.GetHostPoolResource(hostPoolResourceId); + + // get the collection of this MsixPackageResource + MsixPackageCollection collection = hostPool.GetMsixPackages(); + + // invoke the operation + string msixPackageFullName = "packagefullname"; + NullableResponse response = await collection.GetIfExistsAsync(msixPackageFullName); + MsixPackageResource 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 + MsixPackageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MSIXPackage_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_ScalingPlanCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_ScalingPlanCollection.cs index 27f1b7788b6a..6fcbb1ad728d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_ScalingPlanCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_ScalingPlanCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_ScalingPlansGet() Console.WriteLine($"Succeeded: {result}"); } + // ScalingPlans_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ScalingPlansGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlan_Get.json + // this example is just showing the usage of "ScalingPlans_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 = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ScalingPlanResource + ScalingPlanCollection collection = resourceGroupResource.GetScalingPlans(); + + // invoke the operation + string scalingPlanName = "scalingPlan1"; + NullableResponse response = await collection.GetIfExistsAsync(scalingPlanName); + ScalingPlanResource 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 + ScalingPlanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ScalingPlans_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_ScalingPlanPooledScheduleCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_ScalingPlanPooledScheduleCollection.cs index 5759c6cbe554..a70d6c00b104 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_ScalingPlanPooledScheduleCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_ScalingPlanPooledScheduleCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ScalingPlanPooledSchedulesGet() Console.WriteLine($"Succeeded: {result}"); } + // ScalingPlanPooledSchedules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ScalingPlanPooledSchedulesGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ScalingPlanPooledSchedule_Get.json + // this example is just showing the usage of "ScalingPlanPooledSchedules_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 ScalingPlanResource created on azure + // for more information of creating ScalingPlanResource, please refer to the document of ScalingPlanResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string scalingPlanName = "scalingPlan1"; + ResourceIdentifier scalingPlanResourceId = ScalingPlanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, scalingPlanName); + ScalingPlanResource scalingPlan = client.GetScalingPlanResource(scalingPlanResourceId); + + // get the collection of this ScalingPlanPooledScheduleResource + ScalingPlanPooledScheduleCollection collection = scalingPlan.GetScalingPlanPooledSchedules(); + + // invoke the operation + string scalingPlanScheduleName = "scalingPlanScheduleWeekdays1"; + NullableResponse response = await collection.GetIfExistsAsync(scalingPlanScheduleName); + ScalingPlanPooledScheduleResource 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 + ScalingPlanPooledScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ScalingPlanPooledSchedules_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_SessionHostCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_SessionHostCollection.cs index 807b65708e1e..347599ecff84 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_SessionHostCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_SessionHostCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_SessionHostGet() Console.WriteLine($"Succeeded: {result}"); } + // SessionHost_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SessionHostGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/SessionHost_Get.json + // this example is just showing the usage of "SessionHosts_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 HostPoolResource created on azure + // for more information of creating HostPoolResource, please refer to the document of HostPoolResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier hostPoolResourceId = HostPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + HostPoolResource hostPool = client.GetHostPoolResource(hostPoolResourceId); + + // get the collection of this SessionHostResource + SessionHostCollection collection = hostPool.GetSessionHosts(); + + // invoke the operation + string sessionHostName = "sessionHost1.microsoft.com"; + NullableResponse response = await collection.GetIfExistsAsync(sessionHostName); + SessionHostResource 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 + SessionHostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SessionHost_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_UserSessionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_UserSessionCollection.cs index 8d59c5f2dcd2..8fe1179491cd 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_UserSessionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_UserSessionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_UserSessionGet() Console.WriteLine($"Succeeded: {result}"); } + // UserSession_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_UserSessionGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/UserSession_Get.json + // this example is just showing the usage of "UserSessions_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 SessionHostResource created on azure + // for more information of creating SessionHostResource, please refer to the document of SessionHostResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + string sessionHostName = "sessionHost1.microsoft.com"; + ResourceIdentifier sessionHostResourceId = SessionHostResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); + SessionHostResource sessionHost = client.GetSessionHostResource(sessionHostResourceId); + + // get the collection of this UserSessionResource + UserSessionCollection collection = sessionHost.GetUserSessions(); + + // invoke the operation + string userSessionId = "1"; + NullableResponse response = await collection.GetIfExistsAsync(userSessionId); + UserSessionResource 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 + UserSessionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // UserSession_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualApplicationCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualApplicationCollection.cs index abc0457865eb..3a12d2736352 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualApplicationCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualApplicationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ApplicationGet() Console.WriteLine($"Succeeded: {result}"); } + // Application_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApplicationGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Application_Get.json + // this example is just showing the usage of "Applications_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 VirtualApplicationGroupResource created on azure + // for more information of creating VirtualApplicationGroupResource, please refer to the document of VirtualApplicationGroupResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string applicationGroupName = "applicationGroup1"; + ResourceIdentifier virtualApplicationGroupResourceId = VirtualApplicationGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, applicationGroupName); + VirtualApplicationGroupResource virtualApplicationGroup = client.GetVirtualApplicationGroupResource(virtualApplicationGroupResourceId); + + // get the collection of this VirtualApplicationResource + VirtualApplicationCollection collection = virtualApplicationGroup.GetVirtualApplications(); + + // invoke the operation + string applicationName = "application1"; + NullableResponse response = await collection.GetIfExistsAsync(applicationName); + VirtualApplicationResource 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 + VirtualApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Application_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualApplicationGroupCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualApplicationGroupCollection.cs index f31aab54caac..af2e6366ff59 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualApplicationGroupCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualApplicationGroupCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_ApplicationGroupGet() Console.WriteLine($"Succeeded: {result}"); } + // ApplicationGroup_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApplicationGroupGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/ApplicationGroup_Get.json + // this example is just showing the usage of "ApplicationGroups_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 = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualApplicationGroupResource + VirtualApplicationGroupCollection collection = resourceGroupResource.GetVirtualApplicationGroups(); + + // invoke the operation + string applicationGroupName = "applicationGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(applicationGroupName); + VirtualApplicationGroupResource 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 + VirtualApplicationGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApplicationGroup_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualDesktopCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualDesktopCollection.cs index 4db7f002e1f5..342e39ae1821 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualDesktopCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualDesktopCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_DesktopGet() Console.WriteLine($"Succeeded: {result}"); } + // Desktop_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DesktopGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Desktop_Get.json + // this example is just showing the usage of "Desktops_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 VirtualApplicationGroupResource created on azure + // for more information of creating VirtualApplicationGroupResource, please refer to the document of VirtualApplicationGroupResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string applicationGroupName = "applicationGroup1"; + ResourceIdentifier virtualApplicationGroupResourceId = VirtualApplicationGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, applicationGroupName); + VirtualApplicationGroupResource virtualApplicationGroup = client.GetVirtualApplicationGroupResource(virtualApplicationGroupResourceId); + + // get the collection of this VirtualDesktopResource + VirtualDesktopCollection collection = virtualApplicationGroup.GetVirtualDesktops(); + + // invoke the operation + string desktopName = "SessionDesktop"; + NullableResponse response = await collection.GetIfExistsAsync(desktopName); + VirtualDesktopResource 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 + VirtualDesktopData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Desktop_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualWorkspaceCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualWorkspaceCollection.cs index 062c21cad200..9ab955f4f5b8 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualWorkspaceCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/samples/Generated/Samples/Sample_VirtualWorkspaceCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_WorkspaceGet() Console.WriteLine($"Succeeded: {result}"); } + // Workspace_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkspaceGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2022-09-09/examples/Workspace_Get.json + // this example is just showing the usage of "Workspaces_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 = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualWorkspaceResource + VirtualWorkspaceCollection collection = resourceGroupResource.GetVirtualWorkspaces(); + + // invoke the operation + string workspaceName = "workspace1"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + VirtualWorkspaceResource 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 + VirtualWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Workspace_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs index c1cabf0598f0..9b0600d6320b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string hostPoolName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} + /// + /// + /// Operation Id + /// HostPools_Get + /// + /// + /// + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var scope = _hostPoolClientDiagnostics.CreateScope("HostPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hostPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, hostPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostPoolResource(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.DesktopVirtualization/hostPools/{hostPoolName} + /// + /// + /// Operation Id + /// HostPools_Get + /// + /// + /// + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var scope = _hostPoolClientDiagnostics.CreateScope("HostPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hostPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, hostPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs index ae517d184cec..24736e51ba08 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string msixPackageFullName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// + /// + /// Operation Id + /// MSIXPackages_Get + /// + /// + /// + /// The version specific package full name of the MSIX package within specified hostpool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string msixPackageFullName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); + + using var scope = _msixPackageMSIXPackagesClientDiagnostics.CreateScope("MsixPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _msixPackageMSIXPackagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixPackageFullName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MsixPackageResource(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.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// + /// + /// Operation Id + /// MSIXPackages_Get + /// + /// + /// + /// The version specific package full name of the MSIX package within specified hostpool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string msixPackageFullName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); + + using var scope = _msixPackageMSIXPackagesClientDiagnostics.CreateScope("MsixPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _msixPackageMSIXPackagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixPackageFullName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MsixPackageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs index 8bd252e5604f..e4835683b101 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string scalingPlanName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} + /// + /// + /// Operation Id + /// ScalingPlans_Get + /// + /// + /// + /// The name of the scaling plan. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scalingPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + + using var scope = _scalingPlanClientDiagnostics.CreateScope("ScalingPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scalingPlanRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, scalingPlanName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScalingPlanResource(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.DesktopVirtualization/scalingPlans/{scalingPlanName} + /// + /// + /// Operation Id + /// ScalingPlans_Get + /// + /// + /// + /// The name of the scaling plan. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scalingPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + + using var scope = _scalingPlanClientDiagnostics.CreateScope("ScalingPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scalingPlanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, scalingPlanName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScalingPlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs index eb040f5c78b8..e0515cf54833 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string scalingPlanScheduleName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName} + /// + /// + /// Operation Id + /// ScalingPlanPooledSchedules_Get + /// + /// + /// + /// The name of the ScalingPlanSchedule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scalingPlanScheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); + + using var scope = _scalingPlanPooledScheduleClientDiagnostics.CreateScope("ScalingPlanPooledScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scalingPlanPooledScheduleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scalingPlanScheduleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScalingPlanPooledScheduleResource(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.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName} + /// + /// + /// Operation Id + /// ScalingPlanPooledSchedules_Get + /// + /// + /// + /// The name of the ScalingPlanSchedule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scalingPlanScheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); + + using var scope = _scalingPlanPooledScheduleClientDiagnostics.CreateScope("ScalingPlanPooledScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scalingPlanPooledScheduleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scalingPlanScheduleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScalingPlanPooledScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostCollection.cs index 2fdc26457d0b..0fb3cdd22902 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string sessionHostName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName} + /// + /// + /// Operation Id + /// SessionHosts_Get + /// + /// + /// + /// The name of the session host within the specified host pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sessionHostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); + + using var scope = _sessionHostClientDiagnostics.CreateScope("SessionHostCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sessionHostRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sessionHostName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SessionHostResource(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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName} + /// + /// + /// Operation Id + /// SessionHosts_Get + /// + /// + /// + /// The name of the session host within the specified host pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sessionHostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); + + using var scope = _sessionHostClientDiagnostics.CreateScope("SessionHostCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sessionHostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sessionHostName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SessionHostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionCollection.cs index c32663e8f142..e53ebc7cd9d1 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string userSessionId, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId} + /// + /// + /// Operation Id + /// UserSessions_Get + /// + /// + /// + /// The name of the user session within the specified session host. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string userSessionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userSessionId, nameof(userSessionId)); + + using var scope = _userSessionClientDiagnostics.CreateScope("UserSessionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _userSessionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, userSessionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UserSessionResource(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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId} + /// + /// + /// Operation Id + /// UserSessions_Get + /// + /// + /// + /// The name of the user session within the specified session host. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string userSessionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userSessionId, nameof(userSessionId)); + + using var scope = _userSessionClientDiagnostics.CreateScope("UserSessionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _userSessionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, userSessionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UserSessionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs index 6b9e9bbdfced..2e912d7f86b0 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string applicationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the application within the specified application group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _virtualApplicationApplicationsClientDiagnostics.CreateScope("VirtualApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualApplicationResource(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.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the application within the specified application group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _virtualApplicationApplicationsClientDiagnostics.CreateScope("VirtualApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs index 5566d3ea042c..c6cbf17d7dd8 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string applicationGroupName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} + /// + /// + /// Operation Id + /// ApplicationGroups_Get + /// + /// + /// + /// The name of the application group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + + using var scope = _virtualApplicationGroupApplicationGroupsClientDiagnostics.CreateScope("VirtualApplicationGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualApplicationGroupApplicationGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, applicationGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualApplicationGroupResource(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.DesktopVirtualization/applicationGroups/{applicationGroupName} + /// + /// + /// Operation Id + /// ApplicationGroups_Get + /// + /// + /// + /// The name of the application group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + + using var scope = _virtualApplicationGroupApplicationGroupsClientDiagnostics.CreateScope("VirtualApplicationGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualApplicationGroupApplicationGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, applicationGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualApplicationGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs index aa98742efd60..5ea21f3dc50d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string desktopName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName} + /// + /// + /// Operation Id + /// Desktops_Get + /// + /// + /// + /// The name of the desktop within the specified desktop group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string desktopName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(desktopName, nameof(desktopName)); + + using var scope = _virtualDesktopDesktopsClientDiagnostics.CreateScope("VirtualDesktopCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualDesktopDesktopsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, desktopName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualDesktopResource(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.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName} + /// + /// + /// Operation Id + /// Desktops_Get + /// + /// + /// + /// The name of the desktop within the specified desktop group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string desktopName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(desktopName, nameof(desktopName)); + + using var scope = _virtualDesktopDesktopsClientDiagnostics.CreateScope("VirtualDesktopCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualDesktopDesktopsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, desktopName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualDesktopResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs index 375fcb246534..0e3a0cb69971 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _virtualWorkspaceWorkspacesClientDiagnostics.CreateScope("VirtualWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualWorkspaceWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualWorkspaceResource(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.DesktopVirtualization/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _virtualWorkspaceWorkspacesClientDiagnostics.CreateScope("VirtualWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_AllowedEnvironmentTypeCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_AllowedEnvironmentTypeCollection.cs index 1532e164d81d..09459cd327c5 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_AllowedEnvironmentTypeCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_AllowedEnvironmentTypeCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_ProjectAllowedEnvironmentTypesGet() Console.WriteLine($"Succeeded: {result}"); } + + // ProjectAllowedEnvironmentTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProjectAllowedEnvironmentTypesGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/ProjectAllowedEnvironmentTypes_Get.json + // this example is just showing the usage of "ProjectAllowedEnvironmentTypes_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 DevCenterProjectResource created on azure + // for more information of creating DevCenterProjectResource, please refer to the document of DevCenterProjectResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string projectName = "Contoso"; + ResourceIdentifier devCenterProjectResourceId = DevCenterProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, projectName); + DevCenterProjectResource devCenterProject = client.GetDevCenterProjectResource(devCenterProjectResourceId); + + // get the collection of this AllowedEnvironmentTypeResource + AllowedEnvironmentTypeCollection collection = devCenterProject.GetAllowedEnvironmentTypes(); + + // invoke the operation + string environmentTypeName = "DevTest"; + NullableResponse response = await collection.GetIfExistsAsync(environmentTypeName); + AllowedEnvironmentTypeResource 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 + AllowedEnvironmentTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_AttachedNetworkConnectionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_AttachedNetworkConnectionCollection.cs index 710d2ac873e4..74351ed46a40 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_AttachedNetworkConnectionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_AttachedNetworkConnectionCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_AttachedNetworksGetByDevCenter() Console.WriteLine($"Succeeded: {result}"); } + // AttachedNetworks_GetByDevCenter + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AttachedNetworksGetByDevCenter() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/AttachedNetworks_GetByDevCenter.json + // this example is just showing the usage of "AttachedNetworks_GetByDevCenter" 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 DevCenterResource created on azure + // for more information of creating DevCenterResource, please refer to the document of DevCenterResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string devCenterName = "Contoso"; + ResourceIdentifier devCenterResourceId = DevCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, devCenterName); + DevCenterResource devCenter = client.GetDevCenterResource(devCenterResourceId); + + // get the collection of this AttachedNetworkConnectionResource + AttachedNetworkConnectionCollection collection = devCenter.GetAttachedNetworkConnections(); + + // invoke the operation + string attachedNetworkConnectionName = "network-uswest3"; + NullableResponse response = await collection.GetIfExistsAsync(attachedNetworkConnectionName); + AttachedNetworkConnectionResource 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 + AttachedNetworkConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AttachedNetworks_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevBoxDefinitionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevBoxDefinitionCollection.cs index 663b640fc426..b7f0857705b6 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevBoxDefinitionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevBoxDefinitionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_DevBoxDefinitionsGet() Console.WriteLine($"Succeeded: {result}"); } + // DevBoxDefinitions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DevBoxDefinitionsGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/DevBoxDefinitions_Get.json + // this example is just showing the usage of "DevBoxDefinitions_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 DevCenterResource created on azure + // for more information of creating DevCenterResource, please refer to the document of DevCenterResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string devCenterName = "Contoso"; + ResourceIdentifier devCenterResourceId = DevCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, devCenterName); + DevCenterResource devCenter = client.GetDevCenterResource(devCenterResourceId); + + // get the collection of this DevBoxDefinitionResource + DevBoxDefinitionCollection collection = devCenter.GetDevBoxDefinitions(); + + // invoke the operation + string devBoxDefinitionName = "WebDevBox"; + NullableResponse response = await collection.GetIfExistsAsync(devBoxDefinitionName); + DevBoxDefinitionResource 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 + DevBoxDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DevBoxDefinitions_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterCatalogCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterCatalogCollection.cs index e5b69ce0b4b0..8f01ede304d0 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterCatalogCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterCatalogCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_CatalogsGet() Console.WriteLine($"Succeeded: {result}"); } + // Catalogs_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CatalogsGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/Catalogs_Get.json + // this example is just showing the usage of "Catalogs_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 DevCenterResource created on azure + // for more information of creating DevCenterResource, please refer to the document of DevCenterResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string devCenterName = "Contoso"; + ResourceIdentifier devCenterResourceId = DevCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, devCenterName); + DevCenterResource devCenter = client.GetDevCenterResource(devCenterResourceId); + + // get the collection of this DevCenterCatalogResource + DevCenterCatalogCollection collection = devCenter.GetDevCenterCatalogs(); + + // invoke the operation + string catalogName = "CentralCatalog"; + NullableResponse response = await collection.GetIfExistsAsync(catalogName); + DevCenterCatalogResource 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 + DevCenterCatalogData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Catalogs_CreateOrUpdateAdo [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterCollection.cs index 9610741db43c..0a88930e1930 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_DevCentersGet() Console.WriteLine($"Succeeded: {result}"); } + // DevCenters_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DevCentersGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/DevCenters_Get.json + // this example is just showing the usage of "DevCenters_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 = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DevCenterResource + DevCenterCollection collection = resourceGroupResource.GetDevCenters(); + + // invoke the operation + string devCenterName = "Contoso"; + NullableResponse response = await collection.GetIfExistsAsync(devCenterName); + DevCenterResource 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 + DevCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DevCenters_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterEnvironmentTypeCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterEnvironmentTypeCollection.cs index 820ff1704d0b..802ab58bb50e 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterEnvironmentTypeCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterEnvironmentTypeCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_EnvironmentTypesGet() Console.WriteLine($"Succeeded: {result}"); } + // EnvironmentTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EnvironmentTypesGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/EnvironmentTypes_Get.json + // this example is just showing the usage of "EnvironmentTypes_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 DevCenterResource created on azure + // for more information of creating DevCenterResource, please refer to the document of DevCenterResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string devCenterName = "Contoso"; + ResourceIdentifier devCenterResourceId = DevCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, devCenterName); + DevCenterResource devCenter = client.GetDevCenterResource(devCenterResourceId); + + // get the collection of this DevCenterEnvironmentTypeResource + DevCenterEnvironmentTypeCollection collection = devCenter.GetDevCenterEnvironmentTypes(); + + // invoke the operation + string environmentTypeName = "DevTest"; + NullableResponse response = await collection.GetIfExistsAsync(environmentTypeName); + DevCenterEnvironmentTypeResource 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 + DevCenterEnvironmentTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EnvironmentTypes_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterGalleryCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterGalleryCollection.cs index 54f1a779ebb2..40d37d3591ec 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterGalleryCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterGalleryCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GalleriesGet() Console.WriteLine($"Succeeded: {result}"); } + // Galleries_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GalleriesGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/Galleries_Get.json + // this example is just showing the usage of "Galleries_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 DevCenterResource created on azure + // for more information of creating DevCenterResource, please refer to the document of DevCenterResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string devCenterName = "Contoso"; + ResourceIdentifier devCenterResourceId = DevCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, devCenterName); + DevCenterResource devCenter = client.GetDevCenterResource(devCenterResourceId); + + // get the collection of this DevCenterGalleryResource + DevCenterGalleryCollection collection = devCenter.GetDevCenterGalleries(); + + // invoke the operation + string galleryName = "StandardGallery"; + NullableResponse response = await collection.GetIfExistsAsync(galleryName); + DevCenterGalleryResource 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 + DevCenterGalleryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Galleries_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterImageCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterImageCollection.cs index af867c0d809d..7395fcafef49 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterImageCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterImageCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_ImagesGet() Console.WriteLine($"Succeeded: {result}"); } + + // Images_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ImagesGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/Images_Get.json + // this example is just showing the usage of "Images_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 DevCenterGalleryResource created on azure + // for more information of creating DevCenterGalleryResource, please refer to the document of DevCenterGalleryResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string devCenterName = "Contoso"; + string galleryName = "DefaultDevGallery"; + ResourceIdentifier devCenterGalleryResourceId = DevCenterGalleryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, devCenterName, galleryName); + DevCenterGalleryResource devCenterGallery = client.GetDevCenterGalleryResource(devCenterGalleryResourceId); + + // get the collection of this DevCenterImageResource + DevCenterImageCollection collection = devCenterGallery.GetDevCenterImages(); + + // invoke the operation + string imageName = "ContosoBaseImage"; + NullableResponse response = await collection.GetIfExistsAsync(imageName); + DevCenterImageResource 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 + DevCenterImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterNetworkConnectionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterNetworkConnectionCollection.cs index b2fd7572d868..837573a085e1 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterNetworkConnectionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterNetworkConnectionCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_NetworkConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // NetworkConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkConnectionsGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/NetworkConnections_Get.json + // this example is just showing the usage of "NetworkConnections_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 = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DevCenterNetworkConnectionResource + DevCenterNetworkConnectionCollection collection = resourceGroupResource.GetDevCenterNetworkConnections(); + + // invoke the operation + string networkConnectionName = "uswest3network"; + NullableResponse response = await collection.GetIfExistsAsync(networkConnectionName); + DevCenterNetworkConnectionResource 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 + DevCenterNetworkConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkConnections_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterPoolCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterPoolCollection.cs index f5a6980f9663..fad42d1b70c0 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterPoolCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterPoolCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PoolsGet() Console.WriteLine($"Succeeded: {result}"); } + // Pools_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PoolsGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/Pools_Get.json + // this example is just showing the usage of "Pools_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 DevCenterProjectResource created on azure + // for more information of creating DevCenterProjectResource, please refer to the document of DevCenterProjectResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string projectName = "DevProject"; + ResourceIdentifier devCenterProjectResourceId = DevCenterProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, projectName); + DevCenterProjectResource devCenterProject = client.GetDevCenterProjectResource(devCenterProjectResourceId); + + // get the collection of this DevCenterPoolResource + DevCenterPoolCollection collection = devCenterProject.GetDevCenterPools(); + + // invoke the operation + string poolName = "DevPool"; + NullableResponse response = await collection.GetIfExistsAsync(poolName); + DevCenterPoolResource 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 + DevCenterPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Pools_GetUnhealthyStatus [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_PoolsGetUnhealthyStatus() Console.WriteLine($"Succeeded: {result}"); } + // Pools_GetUnhealthyStatus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PoolsGetUnhealthyStatus() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/Pools_GetUnhealthyStatus.json + // this example is just showing the usage of "Pools_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 DevCenterProjectResource created on azure + // for more information of creating DevCenterProjectResource, please refer to the document of DevCenterProjectResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string projectName = "DevProject"; + ResourceIdentifier devCenterProjectResourceId = DevCenterProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, projectName); + DevCenterProjectResource devCenterProject = client.GetDevCenterProjectResource(devCenterProjectResourceId); + + // get the collection of this DevCenterPoolResource + DevCenterPoolCollection collection = devCenterProject.GetDevCenterPools(); + + // invoke the operation + string poolName = "DevPool"; + NullableResponse response = await collection.GetIfExistsAsync(poolName); + DevCenterPoolResource 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 + DevCenterPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Pools_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterProjectCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterProjectCollection.cs index 8d12d23ceeaa..677675f623a6 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterProjectCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterProjectCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_ProjectsGet() Console.WriteLine($"Succeeded: {result}"); } + // Projects_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProjectsGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/Projects_Get.json + // this example is just showing the usage of "Projects_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 = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DevCenterProjectResource + DevCenterProjectCollection collection = resourceGroupResource.GetDevCenterProjects(); + + // invoke the operation + string projectName = "DevProject"; + NullableResponse response = await collection.GetIfExistsAsync(projectName); + DevCenterProjectResource 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 + DevCenterProjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Projects_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterProjectEnvironmentCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterProjectEnvironmentCollection.cs index 3b6638a2902e..394eb682f9a9 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterProjectEnvironmentCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterProjectEnvironmentCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_ProjectEnvironmentTypesGet() Console.WriteLine($"Succeeded: {result}"); } + // ProjectEnvironmentTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProjectEnvironmentTypesGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/ProjectEnvironmentTypes_Get.json + // this example is just showing the usage of "ProjectEnvironmentTypes_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 DevCenterProjectResource created on azure + // for more information of creating DevCenterProjectResource, please refer to the document of DevCenterProjectResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string projectName = "ContosoProj"; + ResourceIdentifier devCenterProjectResourceId = DevCenterProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, projectName); + DevCenterProjectResource devCenterProject = client.GetDevCenterProjectResource(devCenterProjectResourceId); + + // get the collection of this DevCenterProjectEnvironmentResource + DevCenterProjectEnvironmentCollection collection = devCenterProject.GetDevCenterProjectEnvironments(); + + // invoke the operation + string environmentTypeName = "DevTest"; + NullableResponse response = await collection.GetIfExistsAsync(environmentTypeName); + DevCenterProjectEnvironmentResource 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 + DevCenterProjectEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ProjectEnvironmentTypes_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterScheduleCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterScheduleCollection.cs index c5906c507103..b79762f8fb66 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterScheduleCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_DevCenterScheduleCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_SchedulesGetByPool() Console.WriteLine($"Succeeded: {result}"); } + // Schedules_GetByPool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SchedulesGetByPool() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/Schedules_Get.json + // this example is just showing the usage of "Schedules_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 DevCenterPoolResource created on azure + // for more information of creating DevCenterPoolResource, please refer to the document of DevCenterPoolResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string projectName = "TestProject"; + string poolName = "DevPool"; + ResourceIdentifier devCenterPoolResourceId = DevCenterPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, projectName, poolName); + DevCenterPoolResource devCenterPool = client.GetDevCenterPoolResource(devCenterPoolResourceId); + + // get the collection of this DevCenterScheduleResource + DevCenterScheduleCollection collection = devCenterPool.GetDevCenterSchedules(); + + // invoke the operation + string scheduleName = "autoShutdown"; + NullableResponse response = await collection.GetIfExistsAsync(scheduleName); + DevCenterScheduleResource 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 + DevCenterScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Schedules_CreateDailyShutdownPoolSchedule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ImageVersionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ImageVersionCollection.cs index 48ac81c41624..18b2c4278155 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ImageVersionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ImageVersionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_VersionsGet() Console.WriteLine($"Succeeded: {result}"); } + + // Versions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VersionsGet() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/ImageVersions_Get.json + // this example is just showing the usage of "ImageVersions_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 DevCenterImageResource created on azure + // for more information of creating DevCenterImageResource, please refer to the document of DevCenterImageResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string devCenterName = "Contoso"; + string galleryName = "DefaultDevGallery"; + string imageName = "Win11"; + ResourceIdentifier devCenterImageResourceId = DevCenterImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, devCenterName, galleryName, imageName); + DevCenterImageResource devCenterImage = client.GetDevCenterImageResource(devCenterImageResourceId); + + // get the collection of this ImageVersionResource + ImageVersionCollection collection = devCenterImage.GetImageVersions(); + + // invoke the operation + string versionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(versionName); + ImageVersionResource 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 + ImageVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ProjectAttachedNetworkConnectionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ProjectAttachedNetworkConnectionCollection.cs index 96fde5563d0d..f88c01953326 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ProjectAttachedNetworkConnectionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ProjectAttachedNetworkConnectionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_AttachedNetworksGetByProject() Console.WriteLine($"Succeeded: {result}"); } + + // AttachedNetworks_GetByProject + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AttachedNetworksGetByProject() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/AttachedNetworks_GetByProject.json + // this example is just showing the usage of "AttachedNetworks_GetByProject" 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 DevCenterProjectResource created on azure + // for more information of creating DevCenterProjectResource, please refer to the document of DevCenterProjectResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string projectName = "DevProject"; + ResourceIdentifier devCenterProjectResourceId = DevCenterProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, projectName); + DevCenterProjectResource devCenterProject = client.GetDevCenterProjectResource(devCenterProjectResourceId); + + // get the collection of this ProjectAttachedNetworkConnectionResource + ProjectAttachedNetworkConnectionCollection collection = devCenterProject.GetProjectAttachedNetworkConnections(); + + // invoke the operation + string attachedNetworkConnectionName = "network-uswest3"; + NullableResponse response = await collection.GetIfExistsAsync(attachedNetworkConnectionName); + ProjectAttachedNetworkConnectionResource 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 + AttachedNetworkConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ProjectDevBoxDefinitionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ProjectDevBoxDefinitionCollection.cs index 7c18b3987219..46487f30f4f0 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ProjectDevBoxDefinitionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/samples/Generated/Samples/Sample_ProjectDevBoxDefinitionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_DevBoxDefinitionsGetByProject() Console.WriteLine($"Succeeded: {result}"); } + + // DevBoxDefinitions_GetByProject + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DevBoxDefinitionsGetByProject() + { + // Generated from example definition: specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2023-04-01/examples/DevBoxDefinitions_GetByProject.json + // this example is just showing the usage of "DevBoxDefinitions_GetByProject" 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 DevCenterProjectResource created on azure + // for more information of creating DevCenterProjectResource, please refer to the document of DevCenterProjectResource + string subscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c58ffff"; + string resourceGroupName = "rg1"; + string projectName = "ContosoProject"; + ResourceIdentifier devCenterProjectResourceId = DevCenterProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, projectName); + DevCenterProjectResource devCenterProject = client.GetDevCenterProjectResource(devCenterProjectResourceId); + + // get the collection of this ProjectDevBoxDefinitionResource + ProjectDevBoxDefinitionCollection collection = devCenterProject.GetProjectDevBoxDefinitions(); + + // invoke the operation + string devBoxDefinitionName = "WebDevBox"; + NullableResponse response = await collection.GetIfExistsAsync(devBoxDefinitionName); + ProjectDevBoxDefinitionResource 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 + DevBoxDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AllowedEnvironmentTypeCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AllowedEnvironmentTypeCollection.cs index 12259eb0da22..42f36af2fc99 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AllowedEnvironmentTypeCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AllowedEnvironmentTypeCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string environmentTypeName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/allowedEnvironmentTypes/{environmentTypeName} + /// + /// + /// Operation Id + /// ProjectAllowedEnvironmentTypes_Get + /// + /// + /// + /// The name of the environment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string environmentTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentTypeName, nameof(environmentTypeName)); + + using var scope = _allowedEnvironmentTypeProjectAllowedEnvironmentTypesClientDiagnostics.CreateScope("AllowedEnvironmentTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _allowedEnvironmentTypeProjectAllowedEnvironmentTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, environmentTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AllowedEnvironmentTypeResource(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.DevCenter/projects/{projectName}/allowedEnvironmentTypes/{environmentTypeName} + /// + /// + /// Operation Id + /// ProjectAllowedEnvironmentTypes_Get + /// + /// + /// + /// The name of the environment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string environmentTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentTypeName, nameof(environmentTypeName)); + + using var scope = _allowedEnvironmentTypeProjectAllowedEnvironmentTypesClientDiagnostics.CreateScope("AllowedEnvironmentTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _allowedEnvironmentTypeProjectAllowedEnvironmentTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, environmentTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AllowedEnvironmentTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AttachedNetworkConnectionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AttachedNetworkConnectionCollection.cs index 374cba466c3d..981c38522407 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AttachedNetworkConnectionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AttachedNetworkConnectionCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string attachedNetworkConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/attachednetworks/{attachedNetworkConnectionName} + /// + /// + /// Operation Id + /// AttachedNetworks_GetByDevCenter + /// + /// + /// + /// The name of the attached NetworkConnection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string attachedNetworkConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedNetworkConnectionName, nameof(attachedNetworkConnectionName)); + + using var scope = _attachedNetworkConnectionAttachedNetworksClientDiagnostics.CreateScope("AttachedNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _attachedNetworkConnectionAttachedNetworksRestClient.GetByDevCenterAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, attachedNetworkConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AttachedNetworkConnectionResource(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.DevCenter/devcenters/{devCenterName}/attachednetworks/{attachedNetworkConnectionName} + /// + /// + /// Operation Id + /// AttachedNetworks_GetByDevCenter + /// + /// + /// + /// The name of the attached NetworkConnection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string attachedNetworkConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedNetworkConnectionName, nameof(attachedNetworkConnectionName)); + + using var scope = _attachedNetworkConnectionAttachedNetworksClientDiagnostics.CreateScope("AttachedNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _attachedNetworkConnectionAttachedNetworksRestClient.GetByDevCenter(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, attachedNetworkConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AttachedNetworkConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevBoxDefinitionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevBoxDefinitionCollection.cs index 2e42f8d050a6..715bdd0567b1 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevBoxDefinitionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevBoxDefinitionCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string devBoxDefinitionName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/devboxdefinitions/{devBoxDefinitionName} + /// + /// + /// Operation Id + /// DevBoxDefinitions_Get + /// + /// + /// + /// The name of the Dev Box definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string devBoxDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(devBoxDefinitionName, nameof(devBoxDefinitionName)); + + using var scope = _devBoxDefinitionClientDiagnostics.CreateScope("DevBoxDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devBoxDefinitionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, devBoxDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevBoxDefinitionResource(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.DevCenter/devcenters/{devCenterName}/devboxdefinitions/{devBoxDefinitionName} + /// + /// + /// Operation Id + /// DevBoxDefinitions_Get + /// + /// + /// + /// The name of the Dev Box definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string devBoxDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(devBoxDefinitionName, nameof(devBoxDefinitionName)); + + using var scope = _devBoxDefinitionClientDiagnostics.CreateScope("DevBoxDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devBoxDefinitionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, devBoxDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevBoxDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCatalogCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCatalogCollection.cs index 3fddfd78eba8..e1819a3366a3 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCatalogCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCatalogCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string catalogName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/catalogs/{catalogName} + /// + /// + /// Operation Id + /// Catalogs_Get + /// + /// + /// + /// The name of the Catalog. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string catalogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + + using var scope = _devCenterCatalogCatalogsClientDiagnostics.CreateScope("DevCenterCatalogCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterCatalogCatalogsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, catalogName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterCatalogResource(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.DevCenter/devcenters/{devCenterName}/catalogs/{catalogName} + /// + /// + /// Operation Id + /// Catalogs_Get + /// + /// + /// + /// The name of the Catalog. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string catalogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + + using var scope = _devCenterCatalogCatalogsClientDiagnostics.CreateScope("DevCenterCatalogCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterCatalogCatalogsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, catalogName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterCatalogResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCollection.cs index 2661c982dbd4..cda352f83243 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string devCenterName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName} + /// + /// + /// Operation Id + /// DevCenters_Get + /// + /// + /// + /// The name of the devcenter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string devCenterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(devCenterName, nameof(devCenterName)); + + using var scope = _devCenterClientDiagnostics.CreateScope("DevCenterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, devCenterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterResource(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.DevCenter/devcenters/{devCenterName} + /// + /// + /// Operation Id + /// DevCenters_Get + /// + /// + /// + /// The name of the devcenter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string devCenterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(devCenterName, nameof(devCenterName)); + + using var scope = _devCenterClientDiagnostics.CreateScope("DevCenterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, devCenterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterEnvironmentTypeCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterEnvironmentTypeCollection.cs index 2cc67b69501b..32f9026d00b6 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterEnvironmentTypeCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterEnvironmentTypeCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string environmentTypeName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/environmentTypes/{environmentTypeName} + /// + /// + /// Operation Id + /// EnvironmentTypes_Get + /// + /// + /// + /// The name of the environment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string environmentTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentTypeName, nameof(environmentTypeName)); + + using var scope = _devCenterEnvironmentTypeEnvironmentTypesClientDiagnostics.CreateScope("DevCenterEnvironmentTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterEnvironmentTypeEnvironmentTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, environmentTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterEnvironmentTypeResource(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.DevCenter/devcenters/{devCenterName}/environmentTypes/{environmentTypeName} + /// + /// + /// Operation Id + /// EnvironmentTypes_Get + /// + /// + /// + /// The name of the environment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string environmentTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentTypeName, nameof(environmentTypeName)); + + using var scope = _devCenterEnvironmentTypeEnvironmentTypesClientDiagnostics.CreateScope("DevCenterEnvironmentTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterEnvironmentTypeEnvironmentTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, environmentTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterEnvironmentTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryCollection.cs index 8e2bcf9abec7..701403b00b40 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string galleryName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/galleries/{galleryName} + /// + /// + /// Operation Id + /// Galleries_Get + /// + /// + /// + /// The name of the gallery. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryName, nameof(galleryName)); + + using var scope = _devCenterGalleryGalleriesClientDiagnostics.CreateScope("DevCenterGalleryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterGalleryGalleriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterGalleryResource(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.DevCenter/devcenters/{devCenterName}/galleries/{galleryName} + /// + /// + /// Operation Id + /// Galleries_Get + /// + /// + /// + /// The name of the gallery. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryName, nameof(galleryName)); + + using var scope = _devCenterGalleryGalleriesClientDiagnostics.CreateScope("DevCenterGalleryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterGalleryGalleriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterGalleryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageCollection.cs index d3ef672d0e2a..5f2818e0d9cc 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string imageName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// The name of the image. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string imageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + using var scope = _devCenterImageImagesClientDiagnostics.CreateScope("DevCenterImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterImageImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, imageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterImageResource(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.DevCenter/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// The name of the image. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string imageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + using var scope = _devCenterImageImagesClientDiagnostics.CreateScope("DevCenterImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterImageImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, imageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterNetworkConnectionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterNetworkConnectionCollection.cs index 8763e89bd3a6..19a0bcf270e2 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterNetworkConnectionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterNetworkConnectionCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string networkConnectionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/networkConnections/{networkConnectionName} + /// + /// + /// Operation Id + /// NetworkConnections_Get + /// + /// + /// + /// Name of the Network Connection that can be applied to a Pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkConnectionName, nameof(networkConnectionName)); + + using var scope = _devCenterNetworkConnectionNetworkConnectionsClientDiagnostics.CreateScope("DevCenterNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterNetworkConnectionNetworkConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterNetworkConnectionResource(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.DevCenter/networkConnections/{networkConnectionName} + /// + /// + /// Operation Id + /// NetworkConnections_Get + /// + /// + /// + /// Name of the Network Connection that can be applied to a Pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkConnectionName, nameof(networkConnectionName)); + + using var scope = _devCenterNetworkConnectionNetworkConnectionsClientDiagnostics.CreateScope("DevCenterNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterNetworkConnectionNetworkConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterNetworkConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolCollection.cs index 794142509aee..163ce08dc402 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string poolName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/pools/{poolName} + /// + /// + /// Operation Id + /// Pools_Get + /// + /// + /// + /// Name of the pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using var scope = _devCenterPoolPoolsClientDiagnostics.CreateScope("DevCenterPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterPoolResource(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.DevCenter/projects/{projectName}/pools/{poolName} + /// + /// + /// Operation Id + /// Pools_Get + /// + /// + /// + /// Name of the pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using var scope = _devCenterPoolPoolsClientDiagnostics.CreateScope("DevCenterPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectCollection.cs index 76cd426f622f..0701af79b9aa 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string projectName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName} + /// + /// + /// Operation Id + /// Projects_Get + /// + /// + /// + /// The name of the project. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using var scope = _devCenterProjectProjectsClientDiagnostics.CreateScope("DevCenterProjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterProjectProjectsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, projectName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterProjectResource(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.DevCenter/projects/{projectName} + /// + /// + /// Operation Id + /// Projects_Get + /// + /// + /// + /// The name of the project. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using var scope = _devCenterProjectProjectsClientDiagnostics.CreateScope("DevCenterProjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterProjectProjectsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, projectName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterProjectResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectEnvironmentCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectEnvironmentCollection.cs index af6316720763..211d27756e10 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectEnvironmentCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectEnvironmentCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string environmentTypeName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/environmentTypes/{environmentTypeName} + /// + /// + /// Operation Id + /// ProjectEnvironmentTypes_Get + /// + /// + /// + /// The name of the environment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string environmentTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentTypeName, nameof(environmentTypeName)); + + using var scope = _devCenterProjectEnvironmentProjectEnvironmentTypesClientDiagnostics.CreateScope("DevCenterProjectEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterProjectEnvironmentProjectEnvironmentTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, environmentTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterProjectEnvironmentResource(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.DevCenter/projects/{projectName}/environmentTypes/{environmentTypeName} + /// + /// + /// Operation Id + /// ProjectEnvironmentTypes_Get + /// + /// + /// + /// The name of the environment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string environmentTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentTypeName, nameof(environmentTypeName)); + + using var scope = _devCenterProjectEnvironmentProjectEnvironmentTypesClientDiagnostics.CreateScope("DevCenterProjectEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterProjectEnvironmentProjectEnvironmentTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, environmentTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterProjectEnvironmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterScheduleCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterScheduleCollection.cs index c6a45e53e0f2..887cc09a7d6b 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterScheduleCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterScheduleCollection.cs @@ -331,6 +331,82 @@ public virtual Response Exists(string scheduleName, int? top = null, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/pools/{poolName}/schedules/{scheduleName} + /// + /// + /// Operation Id + /// Schedules_Get + /// + /// + /// + /// The name of the schedule that uniquely identifies it. + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scheduleName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); + + using var scope = _devCenterScheduleSchedulesClientDiagnostics.CreateScope("DevCenterScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devCenterScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scheduleName, top, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterScheduleResource(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.DevCenter/projects/{projectName}/pools/{poolName}/schedules/{scheduleName} + /// + /// + /// Operation Id + /// Schedules_Get + /// + /// + /// + /// The name of the schedule that uniquely identifies it. + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scheduleName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); + + using var scope = _devCenterScheduleSchedulesClientDiagnostics.CreateScope("DevCenterScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devCenterScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scheduleName, top, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevCenterScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ImageVersionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ImageVersionCollection.cs index 463183fd8568..e55ad627edd7 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ImageVersionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ImageVersionCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string versionName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName}/versions/{versionName} + /// + /// + /// Operation Id + /// ImageVersions_Get + /// + /// + /// + /// The version of the image. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _imageVersionClientDiagnostics.CreateScope("ImageVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _imageVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, versionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ImageVersionResource(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.DevCenter/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName}/versions/{versionName} + /// + /// + /// Operation Id + /// ImageVersions_Get + /// + /// + /// + /// The version of the image. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _imageVersionClientDiagnostics.CreateScope("ImageVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _imageVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, versionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ImageVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectAttachedNetworkConnectionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectAttachedNetworkConnectionCollection.cs index 227570c3151d..a4b6ea20ad25 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectAttachedNetworkConnectionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectAttachedNetworkConnectionCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string attachedNetworkConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/attachednetworks/{attachedNetworkConnectionName} + /// + /// + /// Operation Id + /// AttachedNetworks_GetByProject + /// + /// + /// + /// The name of the attached NetworkConnection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string attachedNetworkConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedNetworkConnectionName, nameof(attachedNetworkConnectionName)); + + using var scope = _projectAttachedNetworkConnectionAttachedNetworksClientDiagnostics.CreateScope("ProjectAttachedNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _projectAttachedNetworkConnectionAttachedNetworksRestClient.GetByProjectAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, attachedNetworkConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProjectAttachedNetworkConnectionResource(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.DevCenter/projects/{projectName}/attachednetworks/{attachedNetworkConnectionName} + /// + /// + /// Operation Id + /// AttachedNetworks_GetByProject + /// + /// + /// + /// The name of the attached NetworkConnection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string attachedNetworkConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedNetworkConnectionName, nameof(attachedNetworkConnectionName)); + + using var scope = _projectAttachedNetworkConnectionAttachedNetworksClientDiagnostics.CreateScope("ProjectAttachedNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _projectAttachedNetworkConnectionAttachedNetworksRestClient.GetByProject(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, attachedNetworkConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProjectAttachedNetworkConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectDevBoxDefinitionCollection.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectDevBoxDefinitionCollection.cs index e39be62bed0d..651829fe570d 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectDevBoxDefinitionCollection.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectDevBoxDefinitionCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string devBoxDefinitionName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/devboxdefinitions/{devBoxDefinitionName} + /// + /// + /// Operation Id + /// DevBoxDefinitions_GetByProject + /// + /// + /// + /// The name of the Dev Box definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string devBoxDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(devBoxDefinitionName, nameof(devBoxDefinitionName)); + + using var scope = _projectDevBoxDefinitionDevBoxDefinitionsClientDiagnostics.CreateScope("ProjectDevBoxDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _projectDevBoxDefinitionDevBoxDefinitionsRestClient.GetByProjectAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, devBoxDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProjectDevBoxDefinitionResource(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.DevCenter/projects/{projectName}/devboxdefinitions/{devBoxDefinitionName} + /// + /// + /// Operation Id + /// DevBoxDefinitions_GetByProject + /// + /// + /// + /// The name of the Dev Box definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string devBoxDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(devBoxDefinitionName, nameof(devBoxDefinitionName)); + + using var scope = _projectDevBoxDefinitionDevBoxDefinitionsClientDiagnostics.CreateScope("ProjectDevBoxDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _projectDevBoxDefinitionDevBoxDefinitionsRestClient.GetByProject(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, devBoxDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProjectDevBoxDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServiceCollection.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServiceCollection.cs index 7596894e5345..8520988d065a 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServiceCollection.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServiceCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_DPSGet() Console.WriteLine($"Succeeded: {result}"); } + // DPSGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DPSGet() + { + // Generated from example definition: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2022-02-05/examples/DPSGet.json + // this example is just showing the usage of "IotDpsResource_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 = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceProvisioningServiceResource + DeviceProvisioningServiceCollection collection = resourceGroupResource.GetDeviceProvisioningServices(); + + // invoke the operation + string provisioningServiceName = "myFirstProvisioningService"; + NullableResponse response = await collection.GetIfExistsAsync(provisioningServiceName); + DeviceProvisioningServiceResource 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 + DeviceProvisioningServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DPSCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesCertificateCollection.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesCertificateCollection.cs index 0cf857d78a21..22e929764bcf 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesCertificateCollection.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesCertificateCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_DPSGetCertificate() Console.WriteLine($"Succeeded: {result}"); } + // DPSGetCertificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DPSGetCertificate() + { + // Generated from example definition: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2022-02-05/examples/DPSGetCertificate.json + // this example is just showing the usage of "DpsCertificate_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 DeviceProvisioningServiceResource created on azure + // for more information of creating DeviceProvisioningServiceResource, please refer to the document of DeviceProvisioningServiceResource + string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + string provisioningServiceName = "myFirstProvisioningService"; + ResourceIdentifier deviceProvisioningServiceResourceId = DeviceProvisioningServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, provisioningServiceName); + DeviceProvisioningServiceResource deviceProvisioningService = client.GetDeviceProvisioningServiceResource(deviceProvisioningServiceResourceId); + + // get the collection of this DeviceProvisioningServicesCertificateResource + DeviceProvisioningServicesCertificateCollection collection = deviceProvisioningService.GetDeviceProvisioningServicesCertificates(); + + // invoke the operation + string certificateName = "cert"; + NullableResponse response = await collection.GetIfExistsAsync(certificateName); + DeviceProvisioningServicesCertificateResource 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 + DeviceProvisioningServicesCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DPSCreateOrUpdateCertificate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesPrivateEndpointConnectionCollection.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesPrivateEndpointConnectionCollection.cs index bbc1ca8e265e..54531184d02b 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PrivateEndpointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnection_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionGet() + { + // Generated from example definition: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2022-02-05/examples/DPSGetPrivateEndpointConnection.json + // this example is just showing the usage of "IotDpsResource_GetPrivateEndpointConnection" 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 DeviceProvisioningServiceResource created on azure + // for more information of creating DeviceProvisioningServiceResource, please refer to the document of DeviceProvisioningServiceResource + string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "myFirstProvisioningService"; + ResourceIdentifier deviceProvisioningServiceResourceId = DeviceProvisioningServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + DeviceProvisioningServiceResource deviceProvisioningService = client.GetDeviceProvisioningServiceResource(deviceProvisioningServiceResourceId); + + // get the collection of this DeviceProvisioningServicesPrivateEndpointConnectionResource + DeviceProvisioningServicesPrivateEndpointConnectionCollection collection = deviceProvisioningService.GetDeviceProvisioningServicesPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myPrivateEndpointConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + DeviceProvisioningServicesPrivateEndpointConnectionResource 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 + DeviceProvisioningServicesPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnection_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesPrivateLinkResourceCollection.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesPrivateLinkResourceCollection.cs index 8ba130253367..8a82aa3f7b0c 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesPrivateLinkResourceCollection.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/samples/Generated/Samples/Sample_DeviceProvisioningServicesPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_PrivateLinkResourcesList() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateLinkResources_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesList() + { + // Generated from example definition: specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2022-02-05/examples/DPSGetPrivateLinkResources.json + // this example is just showing the usage of "IotDpsResource_GetPrivateLinkResources" 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 DeviceProvisioningServiceResource created on azure + // for more information of creating DeviceProvisioningServiceResource, please refer to the document of DeviceProvisioningServiceResource + string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "myFirstProvisioningService"; + ResourceIdentifier deviceProvisioningServiceResourceId = DeviceProvisioningServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + DeviceProvisioningServiceResource deviceProvisioningService = client.GetDeviceProvisioningServiceResource(deviceProvisioningServiceResourceId); + + // get the collection of this DeviceProvisioningServicesPrivateLinkResource + DeviceProvisioningServicesPrivateLinkResourceCollection collection = deviceProvisioningService.GetDeviceProvisioningServicesPrivateLinkResources(); + + // invoke the operation + string groupId = "iotDps"; + NullableResponse response = await collection.GetIfExistsAsync(groupId); + DeviceProvisioningServicesPrivateLinkResource 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 + DeviceProvisioningServicesPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceCollection.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceCollection.cs index 6b9a57e0616a..be6e23d1d253 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceCollection.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string provisioningServiceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName} + /// + /// + /// Operation Id + /// IotDpsResource_Get + /// + /// + /// + /// Name of the provisioning service to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string provisioningServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(provisioningServiceName, nameof(provisioningServiceName)); + + using var scope = _deviceProvisioningServiceIotDpsResourceClientDiagnostics.CreateScope("DeviceProvisioningServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceProvisioningServiceIotDpsResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, provisioningServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceProvisioningServiceResource(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.Devices/provisioningServices/{provisioningServiceName} + /// + /// + /// Operation Id + /// IotDpsResource_Get + /// + /// + /// + /// Name of the provisioning service to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string provisioningServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(provisioningServiceName, nameof(provisioningServiceName)); + + using var scope = _deviceProvisioningServiceIotDpsResourceClientDiagnostics.CreateScope("DeviceProvisioningServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceProvisioningServiceIotDpsResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, provisioningServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceProvisioningServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesCertificateCollection.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesCertificateCollection.cs index 1184b5f229ee..5217d5e06c15 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesCertificateCollection.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesCertificateCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string certificateName, string ifMatch = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// DpsCertificate_Get + /// + /// + /// + /// Name of the certificate to retrieve. + /// ETag of the certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _deviceProvisioningServicesCertificateDpsCertificateClientDiagnostics.CreateScope("DeviceProvisioningServicesCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceProvisioningServicesCertificateDpsCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, ifMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceProvisioningServicesCertificateResource(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.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// DpsCertificate_Get + /// + /// + /// + /// Name of the certificate to retrieve. + /// ETag of the certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _deviceProvisioningServicesCertificateDpsCertificateClientDiagnostics.CreateScope("DeviceProvisioningServicesCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceProvisioningServicesCertificateDpsCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, ifMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceProvisioningServicesCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateEndpointConnectionCollection.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateEndpointConnectionCollection.cs index c50888d5c7e6..219b4d767c98 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// IotDpsResource_GetPrivateEndpointConnection + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _deviceProvisioningServicesPrivateEndpointConnectionIotDpsResourceClientDiagnostics.CreateScope("DeviceProvisioningServicesPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceProvisioningServicesPrivateEndpointConnectionIotDpsResourceRestClient.GetPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceProvisioningServicesPrivateEndpointConnectionResource(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.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// IotDpsResource_GetPrivateEndpointConnection + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _deviceProvisioningServicesPrivateEndpointConnectionIotDpsResourceClientDiagnostics.CreateScope("DeviceProvisioningServicesPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceProvisioningServicesPrivateEndpointConnectionIotDpsResourceRestClient.GetPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceProvisioningServicesPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateLinkResourceCollection.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateLinkResourceCollection.cs index d1db96d9cff7..4c7e9a956f12 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateLinkResourceCollection.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string groupId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// IotDpsResource_GetPrivateLinkResources + /// + /// + /// + /// The name of the private link 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 groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _deviceProvisioningServicesPrivateLinkResourceIotDpsResourceClientDiagnostics.CreateScope("DeviceProvisioningServicesPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceProvisioningServicesPrivateLinkResourceIotDpsResourceRestClient.GetPrivateLinkResourcesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceProvisioningServicesPrivateLinkResource(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.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// IotDpsResource_GetPrivateLinkResources + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _deviceProvisioningServicesPrivateLinkResourceIotDpsResourceClientDiagnostics.CreateScope("DeviceProvisioningServicesPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceProvisioningServicesPrivateLinkResourceIotDpsResourceRestClient.GetPrivateLinkResources(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceProvisioningServicesPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdateAccountCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdateAccountCollection.cs index f1cb8c144532..c44c43c5f23c 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdateAccountCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdateAccountCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetsAccountDetails() Console.WriteLine($"Succeeded: {result}"); } + // Gets Account details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAccountDetails() + { + // Generated from example definition: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/stable/2022-10-01/examples/Accounts/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 = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DeviceUpdateAccountResource + DeviceUpdateAccountCollection collection = resourceGroupResource.GetDeviceUpdateAccounts(); + + // invoke the operation + string accountName = "contoso"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + DeviceUpdateAccountResource 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 + DeviceUpdateAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates Account [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdateInstanceCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdateInstanceCollection.cs index e5866bf78c20..d5fb5f2ac7d3 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdateInstanceCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdateInstanceCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsListOfInstances() Console.WriteLine($"Succeeded: {result}"); } + // Gets list of Instances + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsListOfInstances() + { + // Generated from example definition: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/stable/2022-10-01/examples/Instances/Instances_Get.json + // this example is just showing the usage of "Instances_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 DeviceUpdateAccountResource created on azure + // for more information of creating DeviceUpdateAccountResource, please refer to the document of DeviceUpdateAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + string accountName = "contoso"; + ResourceIdentifier deviceUpdateAccountResourceId = DeviceUpdateAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DeviceUpdateAccountResource deviceUpdateAccount = client.GetDeviceUpdateAccountResource(deviceUpdateAccountResourceId); + + // get the collection of this DeviceUpdateInstanceResource + DeviceUpdateInstanceCollection collection = deviceUpdateAccount.GetDeviceUpdateInstances(); + + // invoke the operation + string instanceName = "blue"; + NullableResponse response = await collection.GetIfExistsAsync(instanceName); + DeviceUpdateInstanceResource 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 + DeviceUpdateInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates Instance [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdatePrivateEndpointConnectionCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdatePrivateEndpointConnectionCollection.cs index f17c23a4100a..b71a403140c2 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdatePrivateEndpointConnectionCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_DeviceUpdatePrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PrivateEndpointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionGet() + { + // Generated from example definition: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/stable/2022-10-01/examples/PrivateEndpointConnections/PrivateEndpointConnection_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 DeviceUpdateAccountResource created on azure + // for more information of creating DeviceUpdateAccountResource, please refer to the document of DeviceUpdateAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + string accountName = "contoso"; + ResourceIdentifier deviceUpdateAccountResourceId = DeviceUpdateAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DeviceUpdateAccountResource deviceUpdateAccount = client.GetDeviceUpdateAccountResource(deviceUpdateAccountResourceId); + + // get the collection of this DeviceUpdatePrivateEndpointConnectionResource + DeviceUpdatePrivateEndpointConnectionCollection collection = deviceUpdateAccount.GetDeviceUpdatePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "peexample01"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + DeviceUpdatePrivateEndpointConnectionResource 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 + DeviceUpdatePrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnectionCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_PrivateEndpointConnectionProxyCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_PrivateEndpointConnectionProxyCollection.cs index 0efe0438827c..541655436baa 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_PrivateEndpointConnectionProxyCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_PrivateEndpointConnectionProxyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PrivateEndpointConnectionProxyGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnectionProxyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionProxyGet() + { + // Generated from example definition: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/stable/2022-10-01/examples/PrivateEndpointConnectionProxies/PrivateEndpointConnectionProxy_Get.json + // this example is just showing the usage of "PrivateEndpointConnectionProxies_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 DeviceUpdateAccountResource created on azure + // for more information of creating DeviceUpdateAccountResource, please refer to the document of DeviceUpdateAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + string accountName = "contoso"; + ResourceIdentifier deviceUpdateAccountResourceId = DeviceUpdateAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DeviceUpdateAccountResource deviceUpdateAccount = client.GetDeviceUpdateAccountResource(deviceUpdateAccountResourceId); + + // get the collection of this PrivateEndpointConnectionProxyResource + PrivateEndpointConnectionProxyCollection collection = deviceUpdateAccount.GetPrivateEndpointConnectionProxies(); + + // invoke the operation + string privateEndpointConnectionProxyId = "peexample01"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionProxyId); + PrivateEndpointConnectionProxyResource 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 + PrivateEndpointConnectionProxyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnectionProxyCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_PrivateLinkCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_PrivateLinkCollection.cs index 18e7621de5fb..0c072a4539a7 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_PrivateLinkCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/samples/Generated/Samples/Sample_PrivateLinkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_PrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateLinkResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/stable/2022-10-01/examples/PrivateLinkResources/PrivateLinkResources_Get.json + // this example is just showing the usage of "PrivateLinkResources_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 DeviceUpdateAccountResource created on azure + // for more information of creating DeviceUpdateAccountResource, please refer to the document of DeviceUpdateAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + string accountName = "contoso"; + ResourceIdentifier deviceUpdateAccountResourceId = DeviceUpdateAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DeviceUpdateAccountResource deviceUpdateAccount = client.GetDeviceUpdateAccountResource(deviceUpdateAccountResourceId); + + // get the collection of this PrivateLinkResource + PrivateLinkCollection collection = deviceUpdateAccount.GetPrivateLinks(); + + // invoke the operation + string groupId = "adu"; + NullableResponse response = await collection.GetIfExistsAsync(groupId); + PrivateLinkResource 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 + PrivateLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountCollection.cs index a6e224ae8a20..d149096b06e7 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// Account name. + /// The cancellation token to use. + /// 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(accountName, nameof(accountName)); + + using var scope = _deviceUpdateAccountAccountsClientDiagnostics.CreateScope("DeviceUpdateAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceUpdateAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceUpdateAccountResource(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.DeviceUpdate/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// Account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _deviceUpdateAccountAccountsClientDiagnostics.CreateScope("DeviceUpdateAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceUpdateAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceUpdateAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateInstanceCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateInstanceCollection.cs index f0f96eb0e52d..5b6957cc4155 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateInstanceCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateInstanceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string instanceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/instances/{instanceName} + /// + /// + /// Operation Id + /// Instances_Get + /// + /// + /// + /// Instance name. + /// 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 = _deviceUpdateInstanceInstancesClientDiagnostics.CreateScope("DeviceUpdateInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceUpdateInstanceInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, instanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceUpdateInstanceResource(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.DeviceUpdate/accounts/{accountName}/instances/{instanceName} + /// + /// + /// Operation Id + /// Instances_Get + /// + /// + /// + /// Instance name. + /// 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 = _deviceUpdateInstanceInstancesClientDiagnostics.CreateScope("DeviceUpdateInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceUpdateInstanceInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, instanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceUpdateInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdatePrivateEndpointConnectionCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdatePrivateEndpointConnectionCollection.cs index 3da2175c092d..7de86e01a61a 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdatePrivateEndpointConnectionCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdatePrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _deviceUpdatePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DeviceUpdatePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceUpdatePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceUpdatePrivateEndpointConnectionResource(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.DeviceUpdate/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _deviceUpdatePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DeviceUpdatePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceUpdatePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceUpdatePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateEndpointConnectionProxyCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateEndpointConnectionProxyCollection.cs index 500505178e25..665dcb91d21a 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateEndpointConnectionProxyCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateEndpointConnectionProxyCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionProxyId, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId} + /// + /// + /// Operation Id + /// PrivateEndpointConnectionProxies_Get + /// + /// + /// + /// The ID of the private endpoint connection proxy object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionProxyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionProxyId, nameof(privateEndpointConnectionProxyId)); + + using var scope = _privateEndpointConnectionProxyClientDiagnostics.CreateScope("PrivateEndpointConnectionProxyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateEndpointConnectionProxyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionProxyId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointConnectionProxyResource(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.DeviceUpdate/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId} + /// + /// + /// Operation Id + /// PrivateEndpointConnectionProxies_Get + /// + /// + /// + /// The ID of the private endpoint connection proxy object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionProxyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionProxyId, nameof(privateEndpointConnectionProxyId)); + + using var scope = _privateEndpointConnectionProxyClientDiagnostics.CreateScope("PrivateEndpointConnectionProxyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateEndpointConnectionProxyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionProxyId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointConnectionProxyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateLinkCollection.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateLinkCollection.cs index b7ffc5fb522a..f867fa29eca8 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateLinkCollection.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateLinkCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string groupId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The group ID of the private link 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 groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _privateLinkPrivateLinkResourcesClientDiagnostics.CreateScope("PrivateLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateLinkPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateLinkResource(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.DeviceUpdate/accounts/{accountName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The group ID of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _privateLinkPrivateLinkResourcesClientDiagnostics.CreateScope("PrivateLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateLinkPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/samples/Generated/Samples/Sample_ControllerCollection.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/samples/Generated/Samples/Sample_ControllerCollection.cs index 5230bf156b58..ad2e721531e2 100644 --- a/sdk/devspaces/Azure.ResourceManager.DevSpaces/samples/Generated/Samples/Sample_ControllerCollection.cs +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/samples/Generated/Samples/Sample_ControllerCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_ControllersGet() Console.WriteLine($"Succeeded: {result}"); } + // ControllersGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ControllersGet() + { + // Generated from example definition: specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/ControllersGet_example.json + // this example is just showing the usage of "Controllers_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ControllerResource + ControllerCollection collection = resourceGroupResource.GetControllers(); + + // invoke the operation + string name = "myControllerResource"; + NullableResponse response = await collection.GetIfExistsAsync(name); + ControllerResource 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 + ControllerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ControllersCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/ControllerCollection.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/ControllerCollection.cs index 78ff891872ff..3c8a40d15dbb 100644 --- a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/ControllerCollection.cs +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/ControllerCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name} + /// + /// + /// Operation Id + /// Controllers_Get + /// + /// + /// + /// Name of the 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 name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _controllerClientDiagnostics.CreateScope("ControllerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _controllerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ControllerResource(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.DevSpaces/controllers/{name} + /// + /// + /// Operation Id + /// Controllers_Get + /// + /// + /// + /// Name of the resource. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _controllerClientDiagnostics.CreateScope("ControllerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _controllerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ControllerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArmTemplateCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArmTemplateCollection.cs index feaecb749a38..65538993f559 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArmTemplateCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArmTemplateCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_ArmTemplatesGet() Console.WriteLine($"Succeeded: {result}"); } + + // ArmTemplates_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ArmTemplatesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json + // this example is just showing the usage of "ArmTemplates_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 DevTestLabArtifactSourceResource created on azure + // for more information of creating DevTestLabArtifactSourceResource, please refer to the document of DevTestLabArtifactSourceResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + string artifactSourceName = "{artifactSourceName}"; + ResourceIdentifier devTestLabArtifactSourceResourceId = DevTestLabArtifactSourceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, artifactSourceName); + DevTestLabArtifactSourceResource devTestLabArtifactSource = client.GetDevTestLabArtifactSourceResource(devTestLabArtifactSourceResourceId); + + // get the collection of this DevTestLabArmTemplateResource + DevTestLabArmTemplateCollection collection = devTestLabArtifactSource.GetDevTestLabArmTemplates(); + + // invoke the operation + string name = "{armTemplateName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabArmTemplateResource 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 + DevTestLabArmTemplateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArtifactCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArtifactCollection.cs index e7c39d1b547a..dfac221eecf3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArtifactCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArtifactCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_ArtifactsGet() Console.WriteLine($"Succeeded: {result}"); } + + // Artifacts_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ArtifactsGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json + // this example is just showing the usage of "Artifacts_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 DevTestLabArtifactSourceResource created on azure + // for more information of creating DevTestLabArtifactSourceResource, please refer to the document of DevTestLabArtifactSourceResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + string artifactSourceName = "{artifactSourceName}"; + ResourceIdentifier devTestLabArtifactSourceResourceId = DevTestLabArtifactSourceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, artifactSourceName); + DevTestLabArtifactSourceResource devTestLabArtifactSource = client.GetDevTestLabArtifactSourceResource(devTestLabArtifactSourceResourceId); + + // get the collection of this DevTestLabArtifactResource + DevTestLabArtifactCollection collection = devTestLabArtifactSource.GetDevTestLabArtifacts(); + + // invoke the operation + string name = "{artifactName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabArtifactResource 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 + DevTestLabArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArtifactSourceCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArtifactSourceCollection.cs index 0637fd36520c..772fdbba340d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArtifactSourceCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabArtifactSourceCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ArtifactSourcesGet() Console.WriteLine($"Succeeded: {result}"); } + // ArtifactSources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ArtifactSourcesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json + // this example is just showing the usage of "ArtifactSources_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabArtifactSourceResource + DevTestLabArtifactSourceCollection collection = devTestLab.GetDevTestLabArtifactSources(); + + // invoke the operation + string name = "{artifactSourceName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabArtifactSourceResource 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 + DevTestLabArtifactSourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ArtifactSources_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCollection.cs index d3818375d9ec..97cc65837b07 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_LabsGet() Console.WriteLine($"Succeeded: {result}"); } + // Labs_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LabsGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json + // this example is just showing the usage of "Labs_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 = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DevTestLabResource + DevTestLabCollection collection = resourceGroupResource.GetDevTestLabs(); + + // invoke the operation + string name = "{labName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabResource 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 + DevTestLabData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Labs_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCostCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCostCollection.cs index 9f6d49497a67..d279d6b3a8f2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCostCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCostCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_CostsGet() Console.WriteLine($"Succeeded: {result}"); } + // Costs_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CostsGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json + // this example is just showing the usage of "Costs_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabCostResource + DevTestLabCostCollection collection = devTestLab.GetDevTestLabCosts(); + + // invoke the operation + string name = "targetCost"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabCostResource 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 + DevTestLabCostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Costs_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCustomImageCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCustomImageCollection.cs index 5380499f6755..ef6ed8cbb650 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCustomImageCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabCustomImageCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_CustomImagesGet() Console.WriteLine($"Succeeded: {result}"); } + // CustomImages_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CustomImagesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json + // this example is just showing the usage of "CustomImages_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabCustomImageResource + DevTestLabCustomImageCollection collection = devTestLab.GetDevTestLabCustomImages(); + + // invoke the operation + string name = "{customImageName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabCustomImageResource 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 + DevTestLabCustomImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CustomImages_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabDiskCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabDiskCollection.cs index 437b62f58458..f00f4c646ade 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabDiskCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabDiskCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_DisksGet() Console.WriteLine($"Succeeded: {result}"); } + // Disks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DisksGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json + // this example is just showing the usage of "Disks_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 DevTestLabUserResource created on azure + // for more information of creating DevTestLabUserResource, please refer to the document of DevTestLabUserResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + string userName = "@me"; + ResourceIdentifier devTestLabUserResourceId = DevTestLabUserResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName); + DevTestLabUserResource devTestLabUser = client.GetDevTestLabUserResource(devTestLabUserResourceId); + + // get the collection of this DevTestLabDiskResource + DevTestLabDiskCollection collection = devTestLabUser.GetDevTestLabDisks(); + + // invoke the operation + string name = "{diskName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabDiskResource 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 + DevTestLabDiskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Disks_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabEnvironmentCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabEnvironmentCollection.cs index 352480b35b1c..e714c0325a1c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabEnvironmentCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabEnvironmentCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_EnvironmentsGet() Console.WriteLine($"Succeeded: {result}"); } + // Environments_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EnvironmentsGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json + // this example is just showing the usage of "Environments_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 DevTestLabUserResource created on azure + // for more information of creating DevTestLabUserResource, please refer to the document of DevTestLabUserResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + string userName = "@me"; + ResourceIdentifier devTestLabUserResourceId = DevTestLabUserResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName); + DevTestLabUserResource devTestLabUser = client.GetDevTestLabUserResource(devTestLabUserResourceId); + + // get the collection of this DevTestLabEnvironmentResource + DevTestLabEnvironmentCollection collection = devTestLabUser.GetDevTestLabEnvironments(); + + // invoke the operation + string name = "{environmentName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabEnvironmentResource 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 + DevTestLabEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Environments_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabFormulaCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabFormulaCollection.cs index ca4eae3ce3d4..eb1100372b5b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabFormulaCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabFormulaCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_FormulasGet() Console.WriteLine($"Succeeded: {result}"); } + // Formulas_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FormulasGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json + // this example is just showing the usage of "Formulas_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabFormulaResource + DevTestLabFormulaCollection collection = devTestLab.GetDevTestLabFormulas(); + + // invoke the operation + string name = "{formulaName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabFormulaResource 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 + DevTestLabFormulaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Formulas_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabGlobalScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabGlobalScheduleCollection.cs index 946e667a0f85..fcccc665e342 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabGlobalScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabGlobalScheduleCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GlobalSchedulesGet() Console.WriteLine($"Succeeded: {result}"); } + // GlobalSchedules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GlobalSchedulesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json + // this example is just showing the usage of "GlobalSchedules_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 = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DevTestLabGlobalScheduleResource + DevTestLabGlobalScheduleCollection collection = resourceGroupResource.GetDevTestLabGlobalSchedules(); + + // invoke the operation + string name = "labvmautostart"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabGlobalScheduleResource 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 + DevTestLabScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GlobalSchedules_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabNotificationChannelCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabNotificationChannelCollection.cs index 6c3ba9fb050a..770c5fecd417 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabNotificationChannelCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabNotificationChannelCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_NotificationChannelsGet() Console.WriteLine($"Succeeded: {result}"); } + // NotificationChannels_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NotificationChannelsGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json + // this example is just showing the usage of "NotificationChannels_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabNotificationChannelResource + DevTestLabNotificationChannelCollection collection = devTestLab.GetDevTestLabNotificationChannels(); + + // invoke the operation + string name = "{notificationChannelName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabNotificationChannelResource 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 + DevTestLabNotificationChannelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NotificationChannels_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabPolicyCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabPolicyCollection.cs index d2a8a6dce799..f034af658aae 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabPolicyCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabPolicyCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_PoliciesGet() Console.WriteLine($"Succeeded: {result}"); } + // Policies_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PoliciesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json + // this example is just showing the usage of "Policies_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabPolicyResource + string policySetName = "{policySetName}"; + DevTestLabPolicyCollection collection = devTestLab.GetDevTestLabPolicies(policySetName); + + // invoke the operation + string name = "{policyName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabPolicyResource 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 + DevTestLabPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Policies_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabScheduleCollection.cs index 22dfdfe97ef2..314672bc260b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabScheduleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_SchedulesGet() Console.WriteLine($"Succeeded: {result}"); } + // Schedules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SchedulesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json + // this example is just showing the usage of "Schedules_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabScheduleResource + DevTestLabScheduleCollection collection = devTestLab.GetDevTestLabSchedules(); + + // invoke the operation + string name = "{scheduleName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabScheduleResource 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 + DevTestLabScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Schedules_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabSecretCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabSecretCollection.cs index fd4a0561bcca..35192b2ef4ea 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabSecretCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabSecretCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_SecretsGet() Console.WriteLine($"Succeeded: {result}"); } + // Secrets_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SecretsGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json + // this example is just showing the usage of "Secrets_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 DevTestLabUserResource created on azure + // for more information of creating DevTestLabUserResource, please refer to the document of DevTestLabUserResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + string userName = "{userName}"; + ResourceIdentifier devTestLabUserResourceId = DevTestLabUserResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName); + DevTestLabUserResource devTestLabUser = client.GetDevTestLabUserResource(devTestLabUserResourceId); + + // get the collection of this DevTestLabSecretResource + DevTestLabSecretCollection collection = devTestLabUser.GetDevTestLabSecrets(); + + // invoke the operation + string name = "{secretName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabSecretResource 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 + DevTestLabSecretData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Secrets_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceFabricCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceFabricCollection.cs index 32b0b8d43acc..cc550e662130 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceFabricCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceFabricCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_ServiceFabricsGet() Console.WriteLine($"Succeeded: {result}"); } + // ServiceFabrics_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServiceFabricsGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json + // this example is just showing the usage of "ServiceFabrics_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 DevTestLabUserResource created on azure + // for more information of creating DevTestLabUserResource, please refer to the document of DevTestLabUserResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + string userName = "{userName}"; + ResourceIdentifier devTestLabUserResourceId = DevTestLabUserResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName); + DevTestLabUserResource devTestLabUser = client.GetDevTestLabUserResource(devTestLabUserResourceId); + + // get the collection of this DevTestLabServiceFabricResource + DevTestLabServiceFabricCollection collection = devTestLabUser.GetDevTestLabServiceFabrics(); + + // invoke the operation + string name = "{serviceFabricName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabServiceFabricResource 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 + DevTestLabServiceFabricData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ServiceFabrics_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceFabricScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceFabricScheduleCollection.cs index e54505816b98..2d5d30d81979 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceFabricScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceFabricScheduleCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_ServiceFabricSchedulesGet() Console.WriteLine($"Succeeded: {result}"); } + // ServiceFabricSchedules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServiceFabricSchedulesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json + // this example is just showing the usage of "ServiceFabricSchedules_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 DevTestLabServiceFabricResource created on azure + // for more information of creating DevTestLabServiceFabricResource, please refer to the document of DevTestLabServiceFabricResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + string userName = "@me"; + string serviceFabricName = "{serviceFrabicName}"; + ResourceIdentifier devTestLabServiceFabricResourceId = DevTestLabServiceFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName); + DevTestLabServiceFabricResource devTestLabServiceFabric = client.GetDevTestLabServiceFabricResource(devTestLabServiceFabricResourceId); + + // get the collection of this DevTestLabServiceFabricScheduleResource + DevTestLabServiceFabricScheduleCollection collection = devTestLabServiceFabric.GetDevTestLabServiceFabricSchedules(); + + // invoke the operation + string name = "{scheduleName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabServiceFabricScheduleResource 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 + DevTestLabScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ServiceFabricSchedules_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceRunnerCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceRunnerCollection.cs index 95f10d0dd14b..cdef0df487e4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceRunnerCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabServiceRunnerCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ServiceRunnersGet() Console.WriteLine($"Succeeded: {result}"); } + // ServiceRunners_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServiceRunnersGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json + // this example is just showing the usage of "ServiceRunners_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{devtestlabName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabServiceRunnerResource + DevTestLabServiceRunnerCollection collection = devTestLab.GetDevTestLabServiceRunners(); + + // invoke the operation + string name = "{servicerunnerName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabServiceRunnerResource 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 + DevTestLabServiceRunnerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ServiceRunners_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabUserCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabUserCollection.cs index fd2621424f35..ba92bf142444 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabUserCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabUserCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_UsersGet() Console.WriteLine($"Succeeded: {result}"); } + // Users_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_UsersGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json + // this example is just showing the usage of "Users_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{devtestlabName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabUserResource + DevTestLabUserCollection collection = devTestLab.GetDevTestLabUsers(); + + // invoke the operation + string name = "{userName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabUserResource 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 + DevTestLabUserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Users_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVirtualNetworkCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVirtualNetworkCollection.cs index 1d842fb4bee8..da945d6607c9 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVirtualNetworkCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVirtualNetworkCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_VirtualNetworksGet() Console.WriteLine($"Succeeded: {result}"); } + // VirtualNetworks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualNetworksGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json + // this example is just showing the usage of "VirtualNetworks_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabVirtualNetworkResource + DevTestLabVirtualNetworkCollection collection = devTestLab.GetDevTestLabVirtualNetworks(); + + // invoke the operation + string name = "{virtualNetworkName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabVirtualNetworkResource 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 + DevTestLabVirtualNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualNetworks_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVmCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVmCollection.cs index de665d1e5b8a..b9a1f16a1f4e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVmCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVmCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_VirtualMachinesGet() Console.WriteLine($"Succeeded: {result}"); } + // VirtualMachines_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualMachinesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json + // this example is just showing the usage of "VirtualMachines_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 DevTestLabResource created on azure + // for more information of creating DevTestLabResource, please refer to the document of DevTestLabResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + ResourceIdentifier devTestLabResourceId = DevTestLabResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName); + DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); + + // get the collection of this DevTestLabVmResource + DevTestLabVmCollection collection = devTestLab.GetDevTestLabVms(); + + // invoke the operation + string name = "{vmName}"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabVmResource 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 + DevTestLabVmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachines_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVmScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVmScheduleCollection.cs index 384c061e4db0..b1a0ac028333 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVmScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/samples/Generated/Samples/Sample_DevTestLabVmScheduleCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_VirtualMachineSchedulesGet() Console.WriteLine($"Succeeded: {result}"); } + // VirtualMachineSchedules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualMachineSchedulesGet() + { + // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json + // this example is just showing the usage of "VirtualMachineSchedules_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 DevTestLabVmResource created on azure + // for more information of creating DevTestLabVmResource, please refer to the document of DevTestLabVmResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "resourceGroupName"; + string labName = "{labName}"; + string vmName = "{vmName}"; + ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName); + DevTestLabVmResource devTestLabVm = client.GetDevTestLabVmResource(devTestLabVmResourceId); + + // get the collection of this DevTestLabVmScheduleResource + DevTestLabVmScheduleCollection collection = devTestLabVm.GetDevTestLabVmSchedules(); + + // invoke the operation + string name = "LabVmsShutdown"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DevTestLabVmScheduleResource 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 + DevTestLabScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineSchedules_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateCollection.cs index a2b03e5e28f9..3a17a35b90f0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateCollection.cs @@ -253,6 +253,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} + /// + /// + /// Operation Id + /// ArmTemplates_Get + /// + /// + /// + /// The name of the azure resource manager template. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabArmTemplateArmTemplatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabArmTemplateResource(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.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} + /// + /// + /// Operation Id + /// ArmTemplates_Get + /// + /// + /// + /// The name of the azure resource manager template. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabArmTemplateArmTemplatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabArmTemplateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactCollection.cs index 45592fcc921e..028e4df89168 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactCollection.cs @@ -253,6 +253,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} + /// + /// + /// Operation Id + /// Artifacts_Get + /// + /// + /// + /// The name of the artifact. + /// Specify the $expand query. Example: 'properties($select=title)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabArtifactResource(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.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} + /// + /// + /// Operation Id + /// Artifacts_Get + /// + /// + /// + /// The name of the artifact. + /// Specify the $expand query. Example: 'properties($select=title)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabArtifactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceCollection.cs index 79921f20859d..d2562f54ba1d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// + /// + /// Operation Id + /// ArtifactSources_Get + /// + /// + /// + /// The name of the artifact source. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabArtifactSourceArtifactSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabArtifactSourceResource(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.DevTestLab/labs/{labName}/artifactsources/{name} + /// + /// + /// Operation Id + /// ArtifactSources_Get + /// + /// + /// + /// The name of the artifact source. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabArtifactSourceArtifactSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCollection.cs index 09d67df1e717..8c9bf4e3ce3b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCollection.cs @@ -336,6 +336,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} + /// + /// + /// Operation Id + /// Labs_Get + /// + /// + /// + /// The name of the lab. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabLabsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabResource(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.DevTestLab/labs/{name} + /// + /// + /// Operation Id + /// Labs_Get + /// + /// + /// + /// The name of the lab. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabLabsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostCollection.cs index 4871dc804c10..90d9ea592374 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostCollection.cs @@ -279,5 +279,81 @@ public virtual Response Exists(string name, string expand = null, Cancella throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// + /// + /// Operation Id + /// Costs_Get + /// + /// + /// + /// The name of the cost. + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabCostCostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabCostResource(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.DevTestLab/labs/{labName}/costs/{name} + /// + /// + /// Operation Id + /// Costs_Get + /// + /// + /// + /// The name of the cost. + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabCostCostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageCollection.cs index d3ed8237b2b4..4dbace2b33e8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// + /// + /// Operation Id + /// CustomImages_Get + /// + /// + /// + /// The name of the custom image. + /// Specify the $expand query. Example: 'properties($select=vm)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabCustomImageCustomImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabCustomImageResource(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.DevTestLab/labs/{labName}/customimages/{name} + /// + /// + /// Operation Id + /// CustomImages_Get + /// + /// + /// + /// The name of the custom image. + /// Specify the $expand query. Example: 'properties($select=vm)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabCustomImageCustomImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskCollection.cs index c1473de535a2..13b37f0047de 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// + /// + /// Operation Id + /// Disks_Get + /// + /// + /// + /// The name of the disk. + /// Specify the $expand query. Example: 'properties($select=diskType)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabDiskResource(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.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// + /// + /// Operation Id + /// Disks_Get + /// + /// + /// + /// The name of the disk. + /// Specify the $expand query. Example: 'properties($select=diskType)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentCollection.cs index d6a2bd6cb444..94b815aeb1b0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// + /// + /// Operation Id + /// Environments_Get + /// + /// + /// + /// The name of the environment. + /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabEnvironmentEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabEnvironmentResource(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.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// + /// + /// Operation Id + /// Environments_Get + /// + /// + /// + /// The name of the environment. + /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabEnvironmentEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaCollection.cs index 53fb3053ba16..3d9d49797c2a 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// + /// + /// Operation Id + /// Formulas_Get + /// + /// + /// + /// The name of the formula. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabFormulaFormulasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabFormulaResource(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.DevTestLab/labs/{labName}/formulas/{name} + /// + /// + /// Operation Id + /// Formulas_Get + /// + /// + /// + /// The name of the formula. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabFormulaFormulasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleCollection.cs index c34205fe3c05..b02d265e3bc7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleCollection.cs @@ -336,6 +336,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// + /// + /// Operation Id + /// GlobalSchedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabGlobalScheduleResource(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.DevTestLab/schedules/{name} + /// + /// + /// Operation Id + /// GlobalSchedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelCollection.cs index c0089511c55b..6f392e62967e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// + /// + /// Operation Id + /// NotificationChannels_Get + /// + /// + /// + /// The name of the notification channel. + /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabNotificationChannelResource(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.DevTestLab/labs/{labName}/notificationchannels/{name} + /// + /// + /// Operation Id + /// NotificationChannels_Get + /// + /// + /// + /// The name of the notification channel. + /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabNotificationChannelNotificationChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyCollection.cs index 22c2351a0d30..8297d2325619 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyCollection.cs @@ -340,6 +340,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the policy. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabPolicyResource(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.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the policy. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleCollection.cs index 7b7f746b1c9e..e2b96ba98a95 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleCollection.cs @@ -389,6 +389,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// + /// + /// Operation Id + /// Schedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabScheduleResource(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.DevTestLab/labs/{labName}/schedules/{name} + /// + /// + /// Operation Id + /// Schedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretCollection.cs index 5d0dc16a58c9..b6540879d696 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// + /// + /// Operation Id + /// Secrets_Get + /// + /// + /// + /// The name of the secret. + /// Specify the $expand query. Example: 'properties($select=value)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabSecretResource(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.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// + /// + /// Operation Id + /// Secrets_Get + /// + /// + /// + /// The name of the secret. + /// Specify the $expand query. Example: 'properties($select=value)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricCollection.cs index 24a1d7652cb2..ad445462d3e9 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// + /// + /// Operation Id + /// ServiceFabrics_Get + /// + /// + /// + /// The name of the service fabric. + /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabServiceFabricServiceFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabServiceFabricResource(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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// + /// + /// Operation Id + /// ServiceFabrics_Get + /// + /// + /// + /// The name of the service fabric. + /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabServiceFabricServiceFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleCollection.cs index 1eec656c121f..e57a3f2111d9 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// + /// + /// Operation Id + /// ServiceFabricSchedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(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.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// + /// + /// Operation Id + /// ServiceFabricSchedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerCollection.cs index 7598b63d0fa2..a2e860e690f3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string name, CancellationToken cancellation throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// + /// + /// Operation Id + /// ServiceRunners_Get + /// + /// + /// + /// The name of the service runner. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabServiceRunnerServiceRunnersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabServiceRunnerResource(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.DevTestLab/labs/{labName}/servicerunners/{name} + /// + /// + /// Operation Id + /// ServiceRunners_Get + /// + /// + /// + /// The name of the service runner. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabServiceRunnerServiceRunnersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserCollection.cs index 4ec9b1ba4866..858d784c13b1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// + /// + /// Operation Id + /// Users_Get + /// + /// + /// + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=identity)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabUserResource(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.DevTestLab/labs/{labName}/users/{name} + /// + /// + /// Operation Id + /// Users_Get + /// + /// + /// + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=identity)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkCollection.cs index 9d72a2a97527..9fddbb0f979f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// The name of the virtual network. + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabVirtualNetworkResource(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.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// The name of the virtual network. + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmCollection.cs index 1689955aa469..05720a8fa0cf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabVmVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabVmResource(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.DevTestLab/labs/{labName}/virtualmachines/{name} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabVmVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleCollection.cs index c64f955d9523..f36fb4564262 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// + /// + /// Operation Id + /// VirtualMachineSchedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// 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, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _devTestLabVmScheduleVmSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabVmScheduleResource(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.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// + /// + /// Operation Id + /// VirtualMachineSchedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _devTestLabVmScheduleVmSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsDescriptionCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsDescriptionCollection.cs index 01b2735ef4e7..fb13278d1ca0 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsDescriptionCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsDescriptionCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetADigitalTwinsInstanceResource() Console.WriteLine($"Succeeded: {result}"); } + // Get a DigitalTwinsInstance resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADigitalTwinsInstanceResource() + { + // Generated from example definition: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2023-01-31/examples/DigitalTwinsGet_example.json + // this example is just showing the usage of "DigitalTwins_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 = "50016170-c839-41ba-a724-51e9df440b9e"; + string resourceGroupName = "resRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DigitalTwinsDescriptionResource + DigitalTwinsDescriptionCollection collection = resourceGroupResource.GetDigitalTwinsDescriptions(); + + // invoke the operation + string resourceName = "myDigitalTwinsService"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + DigitalTwinsDescriptionResource 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 + DigitalTwinsDescriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a DigitalTwinsInstance resource with a private endpoint connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -148,6 +190,48 @@ public async Task Exists_GetADigitalTwinsInstanceResourceWithAPrivateEndpointCon Console.WriteLine($"Succeeded: {result}"); } + // Get a DigitalTwinsInstance resource with a private endpoint connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADigitalTwinsInstanceResourceWithAPrivateEndpointConnection() + { + // Generated from example definition: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2023-01-31/examples/DigitalTwinsGet_WithPrivateEndpointConnection_example.json + // this example is just showing the usage of "DigitalTwins_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 = "50016170-c839-41ba-a724-51e9df440b9e"; + string resourceGroupName = "resRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DigitalTwinsDescriptionResource + DigitalTwinsDescriptionCollection collection = resourceGroupResource.GetDigitalTwinsDescriptions(); + + // invoke the operation + string resourceName = "myDigitalTwinsService"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + DigitalTwinsDescriptionResource 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 + DigitalTwinsDescriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a DigitalTwinsInstance resource with identity [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -212,6 +296,48 @@ public async Task Exists_GetADigitalTwinsInstanceResourceWithIdentity() Console.WriteLine($"Succeeded: {result}"); } + // Get a DigitalTwinsInstance resource with identity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADigitalTwinsInstanceResourceWithIdentity() + { + // Generated from example definition: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2023-01-31/examples/DigitalTwinsGet_WithIdentity_example.json + // this example is just showing the usage of "DigitalTwins_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 = "50016170-c839-41ba-a724-51e9df440b9e"; + string resourceGroupName = "resRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DigitalTwinsDescriptionResource + DigitalTwinsDescriptionCollection collection = resourceGroupResource.GetDigitalTwinsDescriptions(); + + // invoke the operation + string resourceName = "myDigitalTwinsService"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + DigitalTwinsDescriptionResource 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 + DigitalTwinsDescriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put a DigitalTwinsInstance resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsEndpointResourceCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsEndpointResourceCollection.cs index 8effd066d858..2f547c8ac4b2 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsEndpointResourceCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsEndpointResourceCollection.cs @@ -158,6 +158,49 @@ public async Task Exists_GetADigitalTwinsInstanceEndpoint() Console.WriteLine($"Succeeded: {result}"); } + // Get a DigitalTwinsInstance endpoint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADigitalTwinsInstanceEndpoint() + { + // Generated from example definition: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2023-01-31/examples/DigitalTwinsEndpointGet_example.json + // this example is just showing the usage of "DigitalTwinsEndpoint_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 DigitalTwinsDescriptionResource created on azure + // for more information of creating DigitalTwinsDescriptionResource, please refer to the document of DigitalTwinsDescriptionResource + string subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + string resourceGroupName = "resRg"; + string resourceName = "myDigitalTwinsService"; + ResourceIdentifier digitalTwinsDescriptionResourceId = DigitalTwinsDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + DigitalTwinsDescriptionResource digitalTwinsDescription = client.GetDigitalTwinsDescriptionResource(digitalTwinsDescriptionResourceId); + + // get the collection of this DigitalTwinsEndpointResource + DigitalTwinsEndpointResourceCollection collection = digitalTwinsDescription.GetDigitalTwinsEndpointResources(); + + // invoke the operation + string endpointName = "myServiceBus"; + NullableResponse response = await collection.GetIfExistsAsync(endpointName); + DigitalTwinsEndpointResource 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 + DigitalTwinsEndpointResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a DigitalTwinsInstance endpoint with identity [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -224,6 +267,49 @@ public async Task Exists_GetADigitalTwinsInstanceEndpointWithIdentity() Console.WriteLine($"Succeeded: {result}"); } + // Get a DigitalTwinsInstance endpoint with identity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADigitalTwinsInstanceEndpointWithIdentity() + { + // Generated from example definition: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2023-01-31/examples/DigitalTwinsEndpointGet_WithIdentity_example.json + // this example is just showing the usage of "DigitalTwinsEndpoint_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 DigitalTwinsDescriptionResource created on azure + // for more information of creating DigitalTwinsDescriptionResource, please refer to the document of DigitalTwinsDescriptionResource + string subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + string resourceGroupName = "resRg"; + string resourceName = "myDigitalTwinsService"; + ResourceIdentifier digitalTwinsDescriptionResourceId = DigitalTwinsDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + DigitalTwinsDescriptionResource digitalTwinsDescription = client.GetDigitalTwinsDescriptionResource(digitalTwinsDescriptionResourceId); + + // get the collection of this DigitalTwinsEndpointResource + DigitalTwinsEndpointResourceCollection collection = digitalTwinsDescription.GetDigitalTwinsEndpointResources(); + + // invoke the operation + string endpointName = "myServiceBus"; + NullableResponse response = await collection.GetIfExistsAsync(endpointName); + DigitalTwinsEndpointResource 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 + DigitalTwinsEndpointResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put a DigitalTwinsEndpoint resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsPrivateEndpointConnectionCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsPrivateEndpointConnectionCollection.cs index 9aa29ba53966..792836f2e3d9 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsPrivateEndpointConnectionCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetPrivateEndpointConnectionPropertiesForTheGivenPrivat Console.WriteLine($"Succeeded: {result}"); } + // Get private endpoint connection properties for the given private endpoint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpointConnectionPropertiesForTheGivenPrivateEndpoint() + { + // Generated from example definition: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2023-01-31/examples/PrivateEndpointConnectionByConnectionName_example.json + // this example is just showing the usage of "PrivateEndpointConnections_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 DigitalTwinsDescriptionResource created on azure + // for more information of creating DigitalTwinsDescriptionResource, please refer to the document of DigitalTwinsDescriptionResource + string subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + string resourceGroupName = "resRg"; + string resourceName = "myDigitalTwinsService"; + ResourceIdentifier digitalTwinsDescriptionResourceId = DigitalTwinsDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + DigitalTwinsDescriptionResource digitalTwinsDescription = client.GetDigitalTwinsDescriptionResource(digitalTwinsDescriptionResourceId); + + // get the collection of this DigitalTwinsPrivateEndpointConnectionResource + DigitalTwinsPrivateEndpointConnectionCollection collection = digitalTwinsDescription.GetDigitalTwinsPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myPrivateConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + DigitalTwinsPrivateEndpointConnectionResource 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 + DigitalTwinsPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update the status of a private endpoint connection with the given name [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsPrivateLinkResourceCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsPrivateLinkResourceCollection.cs index aa53e0b7b490..3c5567be0731 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsPrivateLinkResourceCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_DigitalTwinsPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetTheSpecifiedPrivateLinkResourceForTheGivenDigitalTwi Console.WriteLine($"Succeeded: {result}"); } + + // Get the specified private link resource for the given Digital Twin + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheSpecifiedPrivateLinkResourceForTheGivenDigitalTwin() + { + // Generated from example definition: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2023-01-31/examples/PrivateLinkResourcesByGroupId_example.json + // this example is just showing the usage of "PrivateLinkResources_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 DigitalTwinsDescriptionResource created on azure + // for more information of creating DigitalTwinsDescriptionResource, please refer to the document of DigitalTwinsDescriptionResource + string subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + string resourceGroupName = "resRg"; + string resourceName = "myDigitalTwinsService"; + ResourceIdentifier digitalTwinsDescriptionResourceId = DigitalTwinsDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + DigitalTwinsDescriptionResource digitalTwinsDescription = client.GetDigitalTwinsDescriptionResource(digitalTwinsDescriptionResourceId); + + // get the collection of this DigitalTwinsPrivateLinkResource + DigitalTwinsPrivateLinkResourceCollection collection = digitalTwinsDescription.GetDigitalTwinsPrivateLinkResources(); + + // invoke the operation + string resourceId = "subResource"; + NullableResponse response = await collection.GetIfExistsAsync(resourceId); + DigitalTwinsPrivateLinkResource 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 + DigitalTwinsPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_TimeSeriesDatabaseConnectionCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_TimeSeriesDatabaseConnectionCollection.cs index 888fd533a4e5..ebdfd788336a 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_TimeSeriesDatabaseConnectionCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/samples/Generated/Samples/Sample_TimeSeriesDatabaseConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetTimeSeriesDatabaseConnectionForADigitalTwinsInstance Console.WriteLine($"Succeeded: {result}"); } + // Get time series database connection for a DigitalTwins instance. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTimeSeriesDatabaseConnectionForADigitalTwinsInstance() + { + // Generated from example definition: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2023-01-31/examples/TimeSeriesDatabaseConnectionsGet_example.json + // this example is just showing the usage of "TimeSeriesDatabaseConnections_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 DigitalTwinsDescriptionResource created on azure + // for more information of creating DigitalTwinsDescriptionResource, please refer to the document of DigitalTwinsDescriptionResource + string subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + string resourceGroupName = "resRg"; + string resourceName = "myDigitalTwinsService"; + ResourceIdentifier digitalTwinsDescriptionResourceId = DigitalTwinsDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + DigitalTwinsDescriptionResource digitalTwinsDescription = client.GetDigitalTwinsDescriptionResource(digitalTwinsDescriptionResourceId); + + // get the collection of this TimeSeriesDatabaseConnectionResource + TimeSeriesDatabaseConnectionCollection collection = digitalTwinsDescription.GetTimeSeriesDatabaseConnections(); + + // invoke the operation + string timeSeriesDatabaseConnectionName = "myConnection"; + NullableResponse response = await collection.GetIfExistsAsync(timeSeriesDatabaseConnectionName); + TimeSeriesDatabaseConnectionResource 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 + TimeSeriesDatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or replace a time series database connection for a DigitalTwins instance with user assigned identity. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionCollection.cs index a94d7768b3d1..2a6b4e401cb6 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName} + /// + /// + /// Operation Id + /// DigitalTwins_Get + /// + /// + /// + /// The name of the DigitalTwinsInstance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _digitalTwinsDescriptionDigitalTwinsClientDiagnostics.CreateScope("DigitalTwinsDescriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _digitalTwinsDescriptionDigitalTwinsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DigitalTwinsDescriptionResource(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.DigitalTwins/digitalTwinsInstances/{resourceName} + /// + /// + /// Operation Id + /// DigitalTwins_Get + /// + /// + /// + /// The name of the DigitalTwinsInstance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _digitalTwinsDescriptionDigitalTwinsClientDiagnostics.CreateScope("DigitalTwinsDescriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _digitalTwinsDescriptionDigitalTwinsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DigitalTwinsDescriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsEndpointResourceCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsEndpointResourceCollection.cs index 244a599ef904..a8afc49aa540 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsEndpointResourceCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsEndpointResourceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string endpointName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName} + /// + /// + /// Operation Id + /// DigitalTwinsEndpoint_Get + /// + /// + /// + /// Name of Endpoint 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 endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _digitalTwinsEndpointResourceDigitalTwinsEndpointClientDiagnostics.CreateScope("DigitalTwinsEndpointResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _digitalTwinsEndpointResourceDigitalTwinsEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DigitalTwinsEndpointResource(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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName} + /// + /// + /// Operation Id + /// DigitalTwinsEndpoint_Get + /// + /// + /// + /// Name of Endpoint Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _digitalTwinsEndpointResourceDigitalTwinsEndpointClientDiagnostics.CreateScope("DigitalTwinsEndpointResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _digitalTwinsEndpointResourceDigitalTwinsEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DigitalTwinsEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateEndpointConnectionCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateEndpointConnectionCollection.cs index 0d458f28ca14..81e5e365e59e 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateEndpointConnectionCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _digitalTwinsPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DigitalTwinsPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _digitalTwinsPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DigitalTwinsPrivateEndpointConnectionResource(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.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _digitalTwinsPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DigitalTwinsPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _digitalTwinsPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DigitalTwinsPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateLinkResourceCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateLinkResourceCollection.cs index f7572389201a..a4dba213f3f3 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateLinkResourceCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string resourceId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources/{resourceId} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 resourceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceId, nameof(resourceId)); + + using var scope = _digitalTwinsPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DigitalTwinsPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _digitalTwinsPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DigitalTwinsPrivateLinkResource(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.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources/{resourceId} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceId, nameof(resourceId)); + + using var scope = _digitalTwinsPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DigitalTwinsPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _digitalTwinsPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DigitalTwinsPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/TimeSeriesDatabaseConnectionCollection.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/TimeSeriesDatabaseConnectionCollection.cs index 8a32d00ab675..4d77427d75b3 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/TimeSeriesDatabaseConnectionCollection.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/TimeSeriesDatabaseConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string timeSeriesDatabaseConnectionName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName} + /// + /// + /// Operation Id + /// TimeSeriesDatabaseConnections_Get + /// + /// + /// + /// Name of time series database connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string timeSeriesDatabaseConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(timeSeriesDatabaseConnectionName, nameof(timeSeriesDatabaseConnectionName)); + + using var scope = _timeSeriesDatabaseConnectionClientDiagnostics.CreateScope("TimeSeriesDatabaseConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _timeSeriesDatabaseConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, timeSeriesDatabaseConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TimeSeriesDatabaseConnectionResource(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.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName} + /// + /// + /// Operation Id + /// TimeSeriesDatabaseConnections_Get + /// + /// + /// + /// Name of time series database connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string timeSeriesDatabaseConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(timeSeriesDatabaseConnectionName, nameof(timeSeriesDatabaseConnectionName)); + + using var scope = _timeSeriesDatabaseConnectionClientDiagnostics.CreateScope("TimeSeriesDatabaseConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _timeSeriesDatabaseConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, timeSeriesDatabaseConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TimeSeriesDatabaseConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneCollection.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneCollection.cs index 68e333e989d2..c2b2c73f6804 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneCollection.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string zoneName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName} + /// + /// + /// Operation Id + /// Zones_Get + /// + /// + /// + /// The name of the DNS zone (without a terminating dot). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string zoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var scope = _dnsZoneZonesClientDiagnostics.CreateScope("DnsZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsZoneZonesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, zoneName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsZoneResource(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.Network/dnsZones/{zoneName} + /// + /// + /// Operation Id + /// Zones_Get + /// + /// + /// + /// The name of the DNS zone (without a terminating dot). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string zoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var scope = _dnsZoneZonesClientDiagnostics.CreateScope("DnsZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsZoneZonesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, zoneName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsZoneResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleCollection.cs index 3ff0555b57da..90cd41d98d3b 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string forwardingRuleName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName} + /// + /// + /// Operation Id + /// ForwardingRules_Get + /// + /// + /// + /// The name of the forwarding rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string forwardingRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(forwardingRuleName, nameof(forwardingRuleName)); + + using var scope = _dnsForwardingRuleForwardingRulesClientDiagnostics.CreateScope("DnsForwardingRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsForwardingRuleForwardingRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, forwardingRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsForwardingRuleResource(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.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName} + /// + /// + /// Operation Id + /// ForwardingRules_Get + /// + /// + /// + /// The name of the forwarding rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string forwardingRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(forwardingRuleName, nameof(forwardingRuleName)); + + using var scope = _dnsForwardingRuleForwardingRulesClientDiagnostics.CreateScope("DnsForwardingRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsForwardingRuleForwardingRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, forwardingRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsForwardingRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetCollection.cs index 0068bf257dbc..a7b366b882f3 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string rulesetName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName} + /// + /// + /// Operation Id + /// DnsForwardingRulesets_Get + /// + /// + /// + /// The name of the DNS forwarding ruleset. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string rulesetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rulesetName, nameof(rulesetName)); + + using var scope = _dnsForwardingRulesetClientDiagnostics.CreateScope("DnsForwardingRulesetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsForwardingRulesetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, rulesetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsForwardingRulesetResource(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.Network/dnsForwardingRulesets/{dnsForwardingRulesetName} + /// + /// + /// Operation Id + /// DnsForwardingRulesets_Get + /// + /// + /// + /// The name of the DNS forwarding ruleset. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string rulesetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rulesetName, nameof(rulesetName)); + + using var scope = _dnsForwardingRulesetClientDiagnostics.CreateScope("DnsForwardingRulesetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsForwardingRulesetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, rulesetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsForwardingRulesetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkCollection.cs index 1a8d06d4e52f..a1b95977da49 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string virtualNetworkLinkName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName} + /// + /// + /// Operation Id + /// VirtualNetworkLinks_Get + /// + /// + /// + /// The name of the virtual network link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkLinkName, nameof(virtualNetworkLinkName)); + + using var scope = _dnsForwardingRulesetVirtualNetworkLinkVirtualNetworkLinksClientDiagnostics.CreateScope("DnsForwardingRulesetVirtualNetworkLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsForwardingRulesetVirtualNetworkLinkVirtualNetworkLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsForwardingRulesetVirtualNetworkLinkResource(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.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/virtualNetworkLinks/{virtualNetworkLinkName} + /// + /// + /// Operation Id + /// VirtualNetworkLinks_Get + /// + /// + /// + /// The name of the virtual network link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkLinkName, nameof(virtualNetworkLinkName)); + + using var scope = _dnsForwardingRulesetVirtualNetworkLinkVirtualNetworkLinksClientDiagnostics.CreateScope("DnsForwardingRulesetVirtualNetworkLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsForwardingRulesetVirtualNetworkLinkVirtualNetworkLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsForwardingRulesetVirtualNetworkLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverCollection.cs index 1e67ee942628..3e37404771fa 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string dnsResolverName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName} + /// + /// + /// Operation Id + /// DnsResolvers_Get + /// + /// + /// + /// The name of the DNS resolver. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsResolverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverName, nameof(dnsResolverName)); + + using var scope = _dnsResolverClientDiagnostics.CreateScope("DnsResolverCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsResolverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverResource(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.Network/dnsResolvers/{dnsResolverName} + /// + /// + /// Operation Id + /// DnsResolvers_Get + /// + /// + /// + /// The name of the DNS resolver. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsResolverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverName, nameof(dnsResolverName)); + + using var scope = _dnsResolverClientDiagnostics.CreateScope("DnsResolverCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsResolverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointCollection.cs index fe442ec3fca9..0a9afa93bf06 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string inboundEndpointName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName} + /// + /// + /// Operation Id + /// InboundEndpoints_Get + /// + /// + /// + /// The name of the inbound endpoint for the DNS resolver. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string inboundEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inboundEndpointName, nameof(inboundEndpointName)); + + using var scope = _dnsResolverInboundEndpointInboundEndpointsClientDiagnostics.CreateScope("DnsResolverInboundEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsResolverInboundEndpointInboundEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverInboundEndpointResource(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.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName} + /// + /// + /// Operation Id + /// InboundEndpoints_Get + /// + /// + /// + /// The name of the inbound endpoint for the DNS resolver. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string inboundEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inboundEndpointName, nameof(inboundEndpointName)); + + using var scope = _dnsResolverInboundEndpointInboundEndpointsClientDiagnostics.CreateScope("DnsResolverInboundEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsResolverInboundEndpointInboundEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverInboundEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointCollection.cs index 61c5aff84658..a9b6a8662799 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string outboundEndpointName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName} + /// + /// + /// Operation Id + /// OutboundEndpoints_Get + /// + /// + /// + /// The name of the outbound endpoint for the DNS resolver. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string outboundEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(outboundEndpointName, nameof(outboundEndpointName)); + + using var scope = _dnsResolverOutboundEndpointOutboundEndpointsClientDiagnostics.CreateScope("DnsResolverOutboundEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsResolverOutboundEndpointOutboundEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverOutboundEndpointResource(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.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName} + /// + /// + /// Operation Id + /// OutboundEndpoints_Get + /// + /// + /// + /// The name of the outbound endpoint for the DNS resolver. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string outboundEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(outboundEndpointName, nameof(outboundEndpointName)); + + using var scope = _dnsResolverOutboundEndpointOutboundEndpointsClientDiagnostics.CreateScope("DnsResolverOutboundEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsResolverOutboundEndpointOutboundEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverOutboundEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorCollection.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorCollection.cs index 196b87f7621d..561cfef01569 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorCollection.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string monitorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _dynatraceMonitorMonitorsClientDiagnostics.CreateScope("DynatraceMonitorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dynatraceMonitorMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DynatraceMonitorResource(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/Dynatrace.Observability/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _dynatraceMonitorMonitorsClientDiagnostics.CreateScope("DynatraceMonitorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dynatraceMonitorMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DynatraceMonitorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceSingleSignOnCollection.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceSingleSignOnCollection.cs index c6c02c9d7513..723d9f146f02 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceSingleSignOnCollection.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceSingleSignOnCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName} + /// + /// + /// Operation Id + /// SingleSignOn_Get + /// + /// + /// + /// Single Sign On Configuration Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _dynatraceSingleSignOnSingleSignOnClientDiagnostics.CreateScope("DynatraceSingleSignOnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dynatraceSingleSignOnSingleSignOnRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DynatraceSingleSignOnResource(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/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName} + /// + /// + /// Operation Id + /// SingleSignOn_Get + /// + /// + /// + /// Single Sign On Configuration Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _dynatraceSingleSignOnSingleSignOnClientDiagnostics.CreateScope("DynatraceSingleSignOnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dynatraceSingleSignOnSingleSignOnRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DynatraceSingleSignOnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceTagRuleCollection.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceTagRuleCollection.cs index 7df71a3483a8..a46319b24867 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceTagRuleCollection.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceTagRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleSetName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName} + /// + /// + /// Operation Id + /// TagRules_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _dynatraceTagRuleTagRulesClientDiagnostics.CreateScope("DynatraceTagRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dynatraceTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DynatraceTagRuleResource(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/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName} + /// + /// + /// Operation Id + /// TagRules_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _dynatraceTagRuleTagRulesClientDiagnostics.CreateScope("DynatraceTagRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dynatraceTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DynatraceTagRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderAddressCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderAddressCollection.cs index 29cfa86d4fc6..11fbee16f448 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderAddressCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderAddressCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetAddressByName() Console.WriteLine($"Succeeded: {result}"); } + // GetAddressByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAddressByName() + { + // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetAddressByName.json + // this example is just showing the usage of "GetAddressByName" 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 = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string resourceGroupName = "TestRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EdgeOrderAddressResource + EdgeOrderAddressCollection collection = resourceGroupResource.GetEdgeOrderAddresses(); + + // invoke the operation + string addressName = "TestMSAddressName"; + NullableResponse response = await collection.GetIfExistsAsync(addressName); + EdgeOrderAddressResource 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 + EdgeOrderAddressData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateAddress [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderCollection.cs index b32a6c01b4e4..39db787da1f5 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,5 +83,48 @@ public async Task Exists_GetOrderByName() Console.WriteLine($"Succeeded: {result}"); } + + // GetOrderByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetOrderByName() + { + // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetOrderByName.json + // this example is just showing the usage of "GetOrderByName" 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 = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string resourceGroupName = "TestRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EdgeOrderResource + EdgeOrderCollection collection = resourceGroupResource.GetEdgeOrders(); + + // invoke the operation + AzureLocation location = new AzureLocation("%7B%7B%7Blocation%7D%7D"); + string orderName = "TestOrderItemName901"; + NullableResponse response = await collection.GetIfExistsAsync(location, orderName); + EdgeOrderResource 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 + EdgeOrderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderItemCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderItemCollection.cs index a987bf143578..fd702c4e96f9 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderItemCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_EdgeOrderItemCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetOrderItemByName() Console.WriteLine($"Succeeded: {result}"); } + // GetOrderItemByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetOrderItemByName() + { + // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetOrderItemByName.json + // this example is just showing the usage of "GetOrderItemByName" 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 = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string resourceGroupName = "TestRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EdgeOrderItemResource + EdgeOrderItemCollection collection = resourceGroupResource.GetEdgeOrderItems(); + + // invoke the operation + string orderItemName = "TestOrderItemName01"; + NullableResponse response = await collection.GetIfExistsAsync(orderItemName); + EdgeOrderItemResource 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 + EdgeOrderItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrderItem [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressCollection.cs index 7a280ff5e6e1..f1fb3d2cc9f0 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string addressName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName} + /// + /// + /// Operation Id + /// GetAddressByName + /// + /// + /// + /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string addressName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + + using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _edgeOrderAddressRestClient.GetAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EdgeOrderAddressResource(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.EdgeOrder/addresses/{addressName} + /// + /// + /// Operation Id + /// GetAddressByName + /// + /// + /// + /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string addressName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + + using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.GetIfExists"); + scope.Start(); + try + { + var response = _edgeOrderAddressRestClient.GetAddressByName(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EdgeOrderAddressResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderCollection.cs index 06d4d1b47073..efd63fe4ec96 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderCollection.cs @@ -198,5 +198,81 @@ public virtual Response Exists(AzureLocation location, string orderName, C throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} + /// + /// + /// Operation Id + /// GetOrderByName + /// + /// + /// + /// The name of Azure region. + /// The name of the order. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); + + using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _edgeOrderRestClient.GetOrderByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EdgeOrderResource(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.EdgeOrder/locations/{location}/orders/{orderName} + /// + /// + /// Operation Id + /// GetOrderByName + /// + /// + /// + /// The name of Azure region. + /// The name of the order. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); + + using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _edgeOrderRestClient.GetOrderByName(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EdgeOrderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemCollection.cs index e9542be569de..7161f716e729 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemCollection.cs @@ -334,6 +334,82 @@ public virtual Response Exists(string orderItemName, string expand = null, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} + /// + /// + /// Operation Id + /// GetOrderItemByName + /// + /// + /// + /// The name of the order item. + /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + + using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _edgeOrderItemRestClient.GetOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EdgeOrderItemResource(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.EdgeOrder/orderItems/{orderItemName} + /// + /// + /// Operation Id + /// GetOrderItemByName + /// + /// + /// + /// The name of the order item. + /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + + using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _edgeOrderItemRestClient.GetOrderItemByName(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EdgeOrderItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResourceCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResourceCollection.cs index 0705fedde95e..532d29fca37b 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResourceCollection.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResourceCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_MonitorsGet() Console.WriteLine($"Succeeded: {result}"); } + // Monitors_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MonitorsGet() + { + // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/Monitors_Get.json + // this example is just showing the usage of "Monitors_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ElasticMonitorResource + ElasticMonitorResourceCollection collection = resourceGroupResource.GetElasticMonitorResources(); + + // invoke the operation + string monitorName = "myMonitor"; + NullableResponse response = await collection.GetIfExistsAsync(monitorName); + ElasticMonitorResource 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 + ElasticMonitorResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Monitors_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs index 4506c5aa1110..bc16e5afe4c2 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs @@ -156,5 +156,48 @@ public async Task Exists_TagRulesGet() Console.WriteLine($"Succeeded: {result}"); } + + // TagRules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TagRulesGet() + { + // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/preview/2020-07-01-preview/examples/TagRules_Get.json + // this example is just showing the usage of "TagRules_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoringTagRuleResource + MonitoringTagRuleCollection collection = elasticMonitorResource.GetMonitoringTagRules(); + + // invoke the operation + string ruleSetName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(ruleSetName); + MonitoringTagRuleResource 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 + MonitoringTagRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceCollection.cs index 71e028b96491..74d6664ac050 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceCollection.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string monitorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _elasticMonitorResourceMonitorsClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _elasticMonitorResourceMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticMonitorResource(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.Elastic/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _elasticMonitorResourceMonitorsClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _elasticMonitorResourceMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleCollection.cs index cb69ee38d1cb..a0a6d20994c7 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleCollection.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleSetName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName} + /// + /// + /// Operation Id + /// TagRules_Get + /// + /// + /// + /// Tag Rule Set resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _monitoringTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName} + /// + /// + /// Operation Id + /// TagRules_Get + /// + /// + /// + /// Tag Rule Set resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _monitoringTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs index 8a373181d8d0..e5d955b8f081 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs @@ -240,6 +240,48 @@ public async Task Exists_ElasticSansGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // ElasticSans_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ElasticSansGetMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSans_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 = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ElasticSanResource + ElasticSanCollection collection = resourceGroupResource.GetElasticSans(); + + // invoke the operation + string elasticSanName = "elasticsanname"; + NullableResponse response = await collection.GetIfExistsAsync(elasticSanName); + ElasticSanResource 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 + ElasticSanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ElasticSans_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -303,5 +345,47 @@ public async Task Exists_ElasticSansGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + + // ElasticSans_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ElasticSansGetMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSans_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 = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ElasticSanResource + ElasticSanCollection collection = resourceGroupResource.GetElasticSans(); + + // invoke the operation + string elasticSanName = "elasticsanname"; + NullableResponse response = await collection.GetIfExistsAsync(elasticSanName); + ElasticSanResource 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 + ElasticSanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs index 4a62be05d0f3..3b2b954382c7 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs @@ -174,6 +174,49 @@ public async Task Exists_PrivateEndpointConnectionsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGetMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnections_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this ElasticSanPrivateEndpointConnectionResource + ElasticSanPrivateEndpointConnectionCollection collection = elasticSan.GetElasticSanPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateendpointconnectionname"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + ElasticSanPrivateEndpointConnectionResource 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 + ElasticSanPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -240,6 +283,49 @@ public async Task Exists_PrivateEndpointConnectionsGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGetMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnections_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this ElasticSanPrivateEndpointConnectionResource + ElasticSanPrivateEndpointConnectionCollection collection = elasticSan.GetElasticSanPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateendpointconnectionname"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + ElasticSanPrivateEndpointConnectionResource 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 + ElasticSanPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_List_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeCollection.cs index 1e0fc927f832..2d7d8dd8feaf 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeCollection.cs @@ -169,6 +169,50 @@ public async Task Exists_VolumesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // Volumes_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumesGetMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Volumes_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 ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanVolumeResource + ElasticSanVolumeCollection collection = elasticSanVolumeGroup.GetElasticSanVolumes(); + + // invoke the operation + string volumeName = "volumename"; + NullableResponse response = await collection.GetIfExistsAsync(volumeName); + ElasticSanVolumeResource 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 + ElasticSanVolumeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Volumes_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -237,6 +281,50 @@ public async Task Exists_VolumesGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // Volumes_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumesGetMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Volumes_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 ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanVolumeResource + ElasticSanVolumeCollection collection = elasticSanVolumeGroup.GetElasticSanVolumes(); + + // invoke the operation + string volumeName = "volumename"; + NullableResponse response = await collection.GetIfExistsAsync(volumeName); + ElasticSanVolumeResource 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 + ElasticSanVolumeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Volumes_ListByVolumeGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupCollection.cs index 6636b230d3a9..be498f61678c 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupCollection.cs @@ -243,6 +243,49 @@ public async Task Exists_VolumeGroupsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // VolumeGroups_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumeGroupsGetMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroups_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this ElasticSanVolumeGroupResource + ElasticSanVolumeGroupCollection collection = elasticSan.GetElasticSanVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + NullableResponse response = await collection.GetIfExistsAsync(volumeGroupName); + ElasticSanVolumeGroupResource 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 + ElasticSanVolumeGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VolumeGroups_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -308,5 +351,48 @@ public async Task Exists_VolumeGroupsGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + + // VolumeGroups_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumeGroupsGetMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroups_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this ElasticSanVolumeGroupResource + ElasticSanVolumeGroupCollection collection = elasticSan.GetElasticSanVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + NullableResponse response = await collection.GetIfExistsAsync(volumeGroupName); + ElasticSanVolumeGroupResource 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 + ElasticSanVolumeGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanCollection.cs index b0fbab4200ca..35b15b6cc9b3 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string elasticSanName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName} + /// + /// + /// Operation Id + /// ElasticSans_Get + /// + /// + /// + /// The name of the ElasticSan. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string elasticSanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + + using var scope = _elasticSanClientDiagnostics.CreateScope("ElasticSanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _elasticSanRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, elasticSanName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanResource(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.ElasticSan/elasticSans/{elasticSanName} + /// + /// + /// Operation Id + /// ElasticSans_Get + /// + /// + /// + /// The name of the ElasticSan. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string elasticSanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + + using var scope = _elasticSanClientDiagnostics.CreateScope("ElasticSanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _elasticSanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, elasticSanName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionCollection.cs index e42061dd2a62..d1249112901f 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the Private Endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ElasticSanPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanPrivateEndpointConnectionResource(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.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the Private Endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ElasticSanPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeCollection.cs index ba937f21b2ce..995b9c5f0a42 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string volumeName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName} + /// + /// + /// Operation Id + /// Volumes_Get + /// + /// + /// + /// The name of the Volume. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _elasticSanVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanVolumeResource(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.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName} + /// + /// + /// Operation Id + /// Volumes_Get + /// + /// + /// + /// The name of the Volume. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _elasticSanVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupCollection.cs index 0a650889074c..cdf6e8d0d533 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string volumeGroupName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName} + /// + /// + /// Operation Id + /// VolumeGroups_Get + /// + /// + /// + /// The name of the VolumeGroup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _elasticSanVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanVolumeGroupResource(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.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName} + /// + /// + /// Operation Id + /// VolumeGroups_Get + /// + /// + /// + /// The name of the VolumeGroup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanVolumeGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_CaCertificateCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_CaCertificateCollection.cs index c07a8055a92a..e8e0fe2d742a 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_CaCertificateCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_CaCertificateCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_CaCertificatesGet() Console.WriteLine($"Succeeded: {result}"); } + // CaCertificates_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CaCertificatesGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/CaCertificates_Get.json + // this example is just showing the usage of "CaCertificates_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 EventGridNamespaceResource created on azure + // for more information of creating EventGridNamespaceResource, please refer to the document of EventGridNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string namespaceName = "exampleNamespaceName1"; + ResourceIdentifier eventGridNamespaceResourceId = EventGridNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventGridNamespaceResource eventGridNamespace = client.GetEventGridNamespaceResource(eventGridNamespaceResourceId); + + // get the collection of this CaCertificateResource + CaCertificateCollection collection = eventGridNamespace.GetCaCertificates(); + + // invoke the operation + string caCertificateName = "exampleCACertificateName1"; + NullableResponse response = await collection.GetIfExistsAsync(caCertificateName); + CaCertificateResource 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 + CaCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CaCertificates_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainEventSubscriptionCollection.cs index 3a84aaa7521c..7a1b95e9b7a8 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainEventSubscriptionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_DomainEventSubscriptionsGet() Console.WriteLine($"Succeeded: {result}"); } + // DomainEventSubscriptions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DomainEventSubscriptionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainEventSubscriptions_Get.json + // this example is just showing the usage of "DomainEventSubscriptions_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 EventGridDomainResource created on azure + // for more information of creating EventGridDomainResource, please refer to the document of EventGridDomainResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string domainName = "exampleDomain1"; + ResourceIdentifier eventGridDomainResourceId = EventGridDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + EventGridDomainResource eventGridDomain = client.GetEventGridDomainResource(eventGridDomainResourceId); + + // get the collection of this DomainEventSubscriptionResource + DomainEventSubscriptionCollection collection = eventGridDomain.GetDomainEventSubscriptions(); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + DomainEventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DomainEventSubscriptions_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainTopicCollection.cs index 9908602a4531..2432f70a0f38 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainTopicCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_DomainTopicsGet() Console.WriteLine($"Succeeded: {result}"); } + // DomainTopics_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DomainTopicsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopics_Get.json + // this example is just showing the usage of "DomainTopics_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 EventGridDomainResource created on azure + // for more information of creating EventGridDomainResource, please refer to the document of EventGridDomainResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string domainName = "exampledomain2"; + ResourceIdentifier eventGridDomainResourceId = EventGridDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + EventGridDomainResource eventGridDomain = client.GetEventGridDomainResource(eventGridDomainResourceId); + + // get the collection of this DomainTopicResource + DomainTopicCollection collection = eventGridDomain.GetDomainTopics(); + + // invoke the operation + string domainTopicName = "topic1"; + NullableResponse response = await collection.GetIfExistsAsync(domainTopicName); + DomainTopicResource 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 + DomainTopicData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DomainTopics_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainTopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainTopicEventSubscriptionCollection.cs index 26c85845d3ab..528a8d2c2bca 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainTopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_DomainTopicEventSubscriptionCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_DomainTopicEventSubscriptionsGet() Console.WriteLine($"Succeeded: {result}"); } + // DomainTopicEventSubscriptions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DomainTopicEventSubscriptionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopicEventSubscriptions_Get.json + // this example is just showing the usage of "DomainTopicEventSubscriptions_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 DomainTopicResource created on azure + // for more information of creating DomainTopicResource, please refer to the document of DomainTopicResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string domainName = "exampleDomain1"; + string topicName = "exampleDomainTopic1"; + ResourceIdentifier domainTopicResourceId = DomainTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName, topicName); + DomainTopicResource domainTopic = client.GetDomainTopicResource(domainTopicResourceId); + + // get the collection of this DomainTopicEventSubscriptionResource + DomainTopicEventSubscriptionCollection collection = domainTopic.GetDomainTopicEventSubscriptions(); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + DomainTopicEventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DomainTopicEventSubscriptions_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainCollection.cs index 68ce0e7dd959..5ffb537b38a8 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_DomainsGet() Console.WriteLine($"Succeeded: {result}"); } + // Domains_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DomainsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_Get.json + // this example is just showing the usage of "Domains_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 = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EventGridDomainResource + EventGridDomainCollection collection = resourceGroupResource.GetEventGridDomains(); + + // invoke the operation + string domainName = "exampledomain2"; + NullableResponse response = await collection.GetIfExistsAsync(domainName); + EventGridDomainResource 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 + EventGridDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Domains_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainPrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainPrivateEndpointConnectionCollection.cs index 47a087303964..b492346453e9 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainPrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_PrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateEndpointConnections_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 EventGridDomainResource created on azure + // for more information of creating EventGridDomainResource, please refer to the document of EventGridDomainResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string parentName = "exampletopic1"; + ResourceIdentifier eventGridDomainResourceId = EventGridDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, parentName); + EventGridDomainResource eventGridDomain = client.GetEventGridDomainResource(eventGridDomainResourceId); + + // get the collection of this EventGridDomainPrivateEndpointConnectionResource + EventGridDomainPrivateEndpointConnectionCollection collection = eventGridDomain.GetEventGridDomainPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + EventGridDomainPrivateEndpointConnectionResource 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 + EventGridPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_Update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainPrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainPrivateLinkResourceCollection.cs index 04a3c44707f8..45e31ef82725 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainPrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridDomainPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_PrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateLinkResources_Get.json + // this example is just showing the usage of "PrivateLinkResources_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 EventGridDomainResource created on azure + // for more information of creating EventGridDomainResource, please refer to the document of EventGridDomainResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string parentName = "exampletopic1"; + ResourceIdentifier eventGridDomainResourceId = EventGridDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, parentName); + EventGridDomainResource eventGridDomain = client.GetEventGridDomainResource(eventGridDomainResourceId); + + // get the collection of this EventGridDomainPrivateLinkResource + EventGridDomainPrivateLinkResourceCollection collection = eventGridDomain.GetEventGridDomainPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "topic"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + EventGridDomainPrivateLinkResource 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 + EventGridPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateLinkResources_ListByResource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceClientCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceClientCollection.cs index 33515c76b329..83cfc32ea834 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceClientCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceClientCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ClientsGet() Console.WriteLine($"Succeeded: {result}"); } + // Clients_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ClientsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Clients_Get.json + // this example is just showing the usage of "Clients_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 EventGridNamespaceResource created on azure + // for more information of creating EventGridNamespaceResource, please refer to the document of EventGridNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string namespaceName = "exampleNamespaceName1"; + ResourceIdentifier eventGridNamespaceResourceId = EventGridNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventGridNamespaceResource eventGridNamespace = client.GetEventGridNamespaceResource(eventGridNamespaceResourceId); + + // get the collection of this EventGridNamespaceClientResource + EventGridNamespaceClientCollection collection = eventGridNamespace.GetEventGridNamespaceClients(); + + // invoke the operation + string clientName = "exampleClientName1"; + NullableResponse response = await collection.GetIfExistsAsync(clientName); + EventGridNamespaceClientResource 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 + EventGridNamespaceClientData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Clients_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceClientGroupCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceClientGroupCollection.cs index 2694675ded10..7b493cdfc886 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceClientGroupCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceClientGroupCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_ClientGroupsGet() Console.WriteLine($"Succeeded: {result}"); } + // ClientGroups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ClientGroupsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/ClientGroups_Get.json + // this example is just showing the usage of "ClientGroups_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 EventGridNamespaceResource created on azure + // for more information of creating EventGridNamespaceResource, please refer to the document of EventGridNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string namespaceName = "exampleNamespaceName1"; + ResourceIdentifier eventGridNamespaceResourceId = EventGridNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventGridNamespaceResource eventGridNamespace = client.GetEventGridNamespaceResource(eventGridNamespaceResourceId); + + // get the collection of this EventGridNamespaceClientGroupResource + EventGridNamespaceClientGroupCollection collection = eventGridNamespace.GetEventGridNamespaceClientGroups(); + + // invoke the operation + string clientGroupName = "exampleClientGroupName1"; + NullableResponse response = await collection.GetIfExistsAsync(clientGroupName); + EventGridNamespaceClientGroupResource 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 + EventGridNamespaceClientGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ClientGroups_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceCollection.cs index 892951b60536..a3e6c372bcbb 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespaceCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_NamespacesGet() Console.WriteLine($"Succeeded: {result}"); } + // Namespaces_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NamespacesGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_Get.json + // this example is just showing the usage of "Namespaces_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 = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EventGridNamespaceResource + EventGridNamespaceCollection collection = resourceGroupResource.GetEventGridNamespaces(); + + // invoke the operation + string namespaceName = "exampleNamespaceName1"; + NullableResponse response = await collection.GetIfExistsAsync(namespaceName); + EventGridNamespaceResource 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 + EventGridNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Namespaces_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespacePermissionBindingCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespacePermissionBindingCollection.cs index 91e1bc65a42c..8c18c2d91c09 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespacePermissionBindingCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridNamespacePermissionBindingCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_PermissionBindingsGet() Console.WriteLine($"Succeeded: {result}"); } + // PermissionBindings_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PermissionBindingsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PermissionBindings_Get.json + // this example is just showing the usage of "PermissionBindings_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 EventGridNamespaceResource created on azure + // for more information of creating EventGridNamespaceResource, please refer to the document of EventGridNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string namespaceName = "exampleNamespaceName1"; + ResourceIdentifier eventGridNamespaceResourceId = EventGridNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventGridNamespaceResource eventGridNamespace = client.GetEventGridNamespaceResource(eventGridNamespaceResourceId); + + // get the collection of this EventGridNamespacePermissionBindingResource + EventGridNamespacePermissionBindingCollection collection = eventGridNamespace.GetEventGridNamespacePermissionBindings(); + + // invoke the operation + string permissionBindingName = "examplePermissionBindingName1"; + NullableResponse response = await collection.GetIfExistsAsync(permissionBindingName); + EventGridNamespacePermissionBindingResource 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 + EventGridNamespacePermissionBindingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PermissionBindings_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs index d9bb1febb3fb..a26798d1a127 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_PrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateEndpointConnections_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 PartnerNamespaceResource created on azure + // for more information of creating PartnerNamespaceResource, please refer to the document of PartnerNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string parentName = "exampletopic1"; + ResourceIdentifier partnerNamespaceResourceId = PartnerNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, parentName); + PartnerNamespaceResource partnerNamespace = client.GetPartnerNamespaceResource(partnerNamespaceResourceId); + + // get the collection of this EventGridPartnerNamespacePrivateEndpointConnectionResource + EventGridPartnerNamespacePrivateEndpointConnectionCollection collection = partnerNamespace.GetEventGridPartnerNamespacePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + EventGridPartnerNamespacePrivateEndpointConnectionResource 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 + EventGridPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_Update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicCollection.cs index a21fb10443f3..c50545fcfa65 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_TopicsGet() Console.WriteLine($"Succeeded: {result}"); } + // Topics_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TopicsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_Get.json + // this example is just showing the usage of "Topics_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 = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EventGridTopicResource + EventGridTopicCollection collection = resourceGroupResource.GetEventGridTopics(); + + // invoke the operation + string topicName = "exampletopic2"; + NullableResponse response = await collection.GetIfExistsAsync(topicName); + EventGridTopicResource 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 + EventGridTopicData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Topics_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicPrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicPrivateEndpointConnectionCollection.cs index b236c9da5d63..96d6b4485877 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicPrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_PrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateEndpointConnections_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 EventGridTopicResource created on azure + // for more information of creating EventGridTopicResource, please refer to the document of EventGridTopicResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string parentName = "exampletopic1"; + ResourceIdentifier eventGridTopicResourceId = EventGridTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, parentName); + EventGridTopicResource eventGridTopic = client.GetEventGridTopicResource(eventGridTopicResourceId); + + // get the collection of this EventGridTopicPrivateEndpointConnectionResource + EventGridTopicPrivateEndpointConnectionCollection collection = eventGridTopic.GetEventGridTopicPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + EventGridTopicPrivateEndpointConnectionResource 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 + EventGridPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_Update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicPrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicPrivateLinkResourceCollection.cs index 5d3095518780..2b037e5d4464 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicPrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventGridTopicPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_PrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateLinkResources_Get.json + // this example is just showing the usage of "PrivateLinkResources_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 EventGridTopicResource created on azure + // for more information of creating EventGridTopicResource, please refer to the document of EventGridTopicResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string parentName = "exampletopic1"; + ResourceIdentifier eventGridTopicResourceId = EventGridTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, parentName); + EventGridTopicResource eventGridTopic = client.GetEventGridTopicResource(eventGridTopicResourceId); + + // get the collection of this EventGridTopicPrivateLinkResource + EventGridTopicPrivateLinkResourceCollection collection = eventGridTopic.GetEventGridTopicPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "topic"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + EventGridTopicPrivateLinkResource 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 + EventGridPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateLinkResources_ListByResource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventSubscriptionCollection.cs index 14ab6fdf8674..27d8a9cd63bb 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_EventSubscriptionCollection.cs @@ -78,6 +78,46 @@ public async Task Exists_EventSubscriptionsGetForCustomTopic() Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForCustomTopic + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForCustomTopic() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForCustomTopic_AzureFunctionDestination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -138,6 +178,46 @@ public async Task Exists_EventSubscriptionsGetForCustomTopicAzureFunctionDestina Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForCustomTopic_AzureFunctionDestination + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForCustomTopicAzureFunctionDestination() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_AzureFunctionDestination.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForCustomTopic_EventHubDestination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -198,6 +278,46 @@ public async Task Exists_EventSubscriptionsGetForCustomTopicEventHubDestination( Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForCustomTopic_EventHubDestination + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForCustomTopicEventHubDestination() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_EventHubDestination.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForCustomTopic_HybridConnectionDestination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -258,6 +378,46 @@ public async Task Exists_EventSubscriptionsGetForCustomTopicHybridConnectionDest Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForCustomTopic_HybridConnectionDestination + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForCustomTopicHybridConnectionDestination() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_HybridConnectionDestination.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -318,6 +478,46 @@ public async Task Exists_EventSubscriptionsGetForCustomTopicServiceBusQueueDesti Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForCustomTopicServiceBusQueueDestination() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -378,6 +578,46 @@ public async Task Exists_EventSubscriptionsGetForCustomTopicServiceBusTopicDesti Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForCustomTopicServiceBusTopicDestination() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForCustomTopic_StorageQueueDestination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -438,6 +678,46 @@ public async Task Exists_EventSubscriptionsGetForCustomTopicStorageQueueDestinat Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForCustomTopic_StorageQueueDestination + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForCustomTopicStorageQueueDestination() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_StorageQueueDestination.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForCustomTopic_WebhookDestination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -498,6 +778,46 @@ public async Task Exists_EventSubscriptionsGetForCustomTopicWebhookDestination() Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForCustomTopic_WebhookDestination + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForCustomTopicWebhookDestination() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_WebhookDestination.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForResource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -558,6 +878,46 @@ public async Task Exists_EventSubscriptionsGetForResource() Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForResource() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForResource.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -618,6 +978,46 @@ public async Task Exists_EventSubscriptionsGetForResourceGroup() Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForResourceGroup() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForResourceGroup.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription2"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_GetForSubscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -678,6 +1078,46 @@ public async Task Exists_EventSubscriptionsGetForSubscription() Console.WriteLine($"Succeeded: {result}"); } + // EventSubscriptions_GetForSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventSubscriptionsGetForSubscription() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForSubscription.json + // this example is just showing the usage of "EventSubscriptions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this EventSubscriptionResource + string scope = "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId); + + // invoke the operation + string eventSubscriptionName = "examplesubscription3"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + EventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EventSubscriptions_CreateOrUpdateForCustomTopic [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_NamespaceTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_NamespaceTopicCollection.cs index bc05fe68d49d..306dce1b7c48 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_NamespaceTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_NamespaceTopicCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_NamespaceTopicsGet() Console.WriteLine($"Succeeded: {result}"); } + // NamespaceTopics_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NamespaceTopicsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopics_Get.json + // this example is just showing the usage of "NamespaceTopics_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 EventGridNamespaceResource created on azure + // for more information of creating EventGridNamespaceResource, please refer to the document of EventGridNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e41"; + string resourceGroupName = "examplerg"; + string namespaceName = "examplenamespace2"; + ResourceIdentifier eventGridNamespaceResourceId = EventGridNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventGridNamespaceResource eventGridNamespace = client.GetEventGridNamespaceResource(eventGridNamespaceResourceId); + + // get the collection of this NamespaceTopicResource + NamespaceTopicCollection collection = eventGridNamespace.GetNamespaceTopics(); + + // invoke the operation + string topicName = "examplenamespacetopic2"; + NullableResponse response = await collection.GetIfExistsAsync(topicName); + NamespaceTopicResource 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 + NamespaceTopicData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NamespaceTopics_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_NamespaceTopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_NamespaceTopicEventSubscriptionCollection.cs index 49c934cfb194..e6db3ef7caf6 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_NamespaceTopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_NamespaceTopicEventSubscriptionCollection.cs @@ -87,6 +87,50 @@ public async Task Exists_NamespaceTopicEventSubscriptionsGet() Console.WriteLine($"Succeeded: {result}"); } + // NamespaceTopicEventSubscriptions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NamespaceTopicEventSubscriptionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopicEventSubscriptions_Get.json + // this example is just showing the usage of "NamespaceTopicEventSubscriptions_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 NamespaceTopicResource created on azure + // for more information of creating NamespaceTopicResource, please refer to the document of NamespaceTopicResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string namespaceName = "examplenamespace2"; + string topicName = "examplenamespacetopic2"; + ResourceIdentifier namespaceTopicResourceId = NamespaceTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, topicName); + NamespaceTopicResource namespaceTopic = client.GetNamespaceTopicResource(namespaceTopicResourceId); + + // get the collection of this NamespaceTopicEventSubscriptionResource + NamespaceTopicEventSubscriptionCollection collection = namespaceTopic.GetNamespaceTopicEventSubscriptions(); + + // invoke the operation + string eventSubscriptionName = "examplenamespacetopicEventSub1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + NamespaceTopicEventSubscriptionResource 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 + NamespaceTopicEventSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NamespaceTopicEventSubscriptions_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerDestinationCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerDestinationCollection.cs index 2c193d8e0b78..2aad0386810c 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerDestinationCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerDestinationCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_PartnerDestinationsGet() Console.WriteLine($"Succeeded: {result}"); } + // PartnerDestinations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PartnerDestinationsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerDestinations_Get.json + // this example is just showing the usage of "PartnerDestinations_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 = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PartnerDestinationResource + PartnerDestinationCollection collection = resourceGroupResource.GetPartnerDestinations(); + + // invoke the operation + string partnerDestinationName = "examplePartnerDestinationName1"; + NullableResponse response = await collection.GetIfExistsAsync(partnerDestinationName); + PartnerDestinationResource 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 + PartnerDestinationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PartnerDestinations_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespaceChannelCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespaceChannelCollection.cs index 4741404dc3e6..447aae65877f 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespaceChannelCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespaceChannelCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ChannelsGet() Console.WriteLine($"Succeeded: {result}"); } + // Channels_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ChannelsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Channels_Get.json + // this example is just showing the usage of "Channels_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 PartnerNamespaceResource created on azure + // for more information of creating PartnerNamespaceResource, please refer to the document of PartnerNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string partnerNamespaceName = "examplePartnerNamespaceName1"; + ResourceIdentifier partnerNamespaceResourceId = PartnerNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, partnerNamespaceName); + PartnerNamespaceResource partnerNamespace = client.GetPartnerNamespaceResource(partnerNamespaceResourceId); + + // get the collection of this PartnerNamespaceChannelResource + PartnerNamespaceChannelCollection collection = partnerNamespace.GetPartnerNamespaceChannels(); + + // invoke the operation + string channelName = "exampleChannelName1"; + NullableResponse response = await collection.GetIfExistsAsync(channelName); + PartnerNamespaceChannelResource 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 + PartnerNamespaceChannelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Channels_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespaceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespaceCollection.cs index fe782a63a4c1..0ce4d57ec140 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespaceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespaceCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_PartnerNamespacesGet() Console.WriteLine($"Succeeded: {result}"); } + // PartnerNamespaces_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PartnerNamespacesGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_Get.json + // this example is just showing the usage of "PartnerNamespaces_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 = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PartnerNamespaceResource + PartnerNamespaceCollection collection = resourceGroupResource.GetPartnerNamespaces(); + + // invoke the operation + string partnerNamespaceName = "examplePartnerNamespaceName1"; + NullableResponse response = await collection.GetIfExistsAsync(partnerNamespaceName); + PartnerNamespaceResource 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 + PartnerNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PartnerNamespaces_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespacePrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespacePrivateLinkResourceCollection.cs index dddf7ef9d67f..1d49c1adbdca 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespacePrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerNamespacePrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_PrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateLinkResources_Get.json + // this example is just showing the usage of "PrivateLinkResources_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 PartnerNamespaceResource created on azure + // for more information of creating PartnerNamespaceResource, please refer to the document of PartnerNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string parentName = "exampletopic1"; + ResourceIdentifier partnerNamespaceResourceId = PartnerNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, parentName); + PartnerNamespaceResource partnerNamespace = client.GetPartnerNamespaceResource(partnerNamespaceResourceId); + + // get the collection of this PartnerNamespacePrivateLinkResource + PartnerNamespacePrivateLinkResourceCollection collection = partnerNamespace.GetPartnerNamespacePrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "topic"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + PartnerNamespacePrivateLinkResource 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 + EventGridPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateLinkResources_ListByResource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerRegistrationCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerRegistrationCollection.cs index b5fc6efe6f72..50a9189cf74b 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerRegistrationCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerRegistrationCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_PartnerRegistrationsGet() Console.WriteLine($"Succeeded: {result}"); } + // PartnerRegistrations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PartnerRegistrationsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerRegistrations_Get.json + // this example is just showing the usage of "PartnerRegistrations_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 = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PartnerRegistrationResource + PartnerRegistrationCollection collection = resourceGroupResource.GetPartnerRegistrations(); + + // invoke the operation + string partnerRegistrationName = "examplePartnerRegistrationName1"; + NullableResponse response = await collection.GetIfExistsAsync(partnerRegistrationName); + PartnerRegistrationResource 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 + PartnerRegistrationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PartnerRegistrations_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerTopicCollection.cs index 2dd26e92231f..84579a68e472 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerTopicCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_PartnerTopicsGet() Console.WriteLine($"Succeeded: {result}"); } + // PartnerTopics_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PartnerTopicsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_Get.json + // this example is just showing the usage of "PartnerTopics_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 = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PartnerTopicResource + PartnerTopicCollection collection = resourceGroupResource.GetPartnerTopics(); + + // invoke the operation + string partnerTopicName = "examplePartnerTopicName1"; + NullableResponse response = await collection.GetIfExistsAsync(partnerTopicName); + PartnerTopicResource 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 + PartnerTopicData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PartnerTopics_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerTopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerTopicEventSubscriptionCollection.cs index f4da7309ed1d..78de39071bbe 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerTopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_PartnerTopicEventSubscriptionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_PartnerTopicEventSubscriptionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PartnerTopicEventSubscriptions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PartnerTopicEventSubscriptionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopicEventSubscriptions_Get.json + // this example is just showing the usage of "PartnerTopicEventSubscriptions_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 PartnerTopicResource created on azure + // for more information of creating PartnerTopicResource, please refer to the document of PartnerTopicResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string partnerTopicName = "examplePartnerTopic1"; + ResourceIdentifier partnerTopicResourceId = PartnerTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, partnerTopicName); + PartnerTopicResource partnerTopic = client.GetPartnerTopicResource(partnerTopicResourceId); + + // get the collection of this PartnerTopicEventSubscriptionResource + PartnerTopicEventSubscriptionCollection collection = partnerTopic.GetPartnerTopicEventSubscriptions(); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + PartnerTopicEventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PartnerTopicEventSubscriptions_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_SystemTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_SystemTopicCollection.cs index 56d417a3c2ef..58ab95851eb7 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_SystemTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_SystemTopicCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_SystemTopicsGet() Console.WriteLine($"Succeeded: {result}"); } + // SystemTopics_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SystemTopicsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopics_Get.json + // this example is just showing the usage of "SystemTopics_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 = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SystemTopicResource + SystemTopicCollection collection = resourceGroupResource.GetSystemTopics(); + + // invoke the operation + string systemTopicName = "exampleSystemTopic2"; + NullableResponse response = await collection.GetIfExistsAsync(systemTopicName); + SystemTopicResource 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 + SystemTopicData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SystemTopics_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_SystemTopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_SystemTopicEventSubscriptionCollection.cs index bfc1db5b396b..c339149ffb4f 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_SystemTopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_SystemTopicEventSubscriptionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_SystemTopicEventSubscriptionsGet() Console.WriteLine($"Succeeded: {result}"); } + // SystemTopicEventSubscriptions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SystemTopicEventSubscriptionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopicEventSubscriptions_Get.json + // this example is just showing the usage of "SystemTopicEventSubscriptions_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 SystemTopicResource created on azure + // for more information of creating SystemTopicResource, please refer to the document of SystemTopicResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string systemTopicName = "exampleSystemTopic1"; + ResourceIdentifier systemTopicResourceId = SystemTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, systemTopicName); + SystemTopicResource systemTopic = client.GetSystemTopicResource(systemTopicResourceId); + + // get the collection of this SystemTopicEventSubscriptionResource + SystemTopicEventSubscriptionCollection collection = systemTopic.GetSystemTopicEventSubscriptions(); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + SystemTopicEventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SystemTopicEventSubscriptions_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicEventSubscriptionCollection.cs index 8646159c296e..1c6a81cd3f41 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicEventSubscriptionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_TopicEventSubscriptionsGet() Console.WriteLine($"Succeeded: {result}"); } + // TopicEventSubscriptions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TopicEventSubscriptionsGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicEventSubscriptions_Get.json + // this example is just showing the usage of "TopicEventSubscriptions_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 EventGridTopicResource created on azure + // for more information of creating EventGridTopicResource, please refer to the document of EventGridTopicResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string topicName = "exampleTopic1"; + ResourceIdentifier eventGridTopicResourceId = EventGridTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, topicName); + EventGridTopicResource eventGridTopic = client.GetEventGridTopicResource(eventGridTopicResourceId); + + // get the collection of this TopicEventSubscriptionResource + TopicEventSubscriptionCollection collection = eventGridTopic.GetTopicEventSubscriptions(); + + // invoke the operation + string eventSubscriptionName = "examplesubscription1"; + NullableResponse response = await collection.GetIfExistsAsync(eventSubscriptionName); + TopicEventSubscriptionResource 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 + EventGridSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TopicEventSubscriptions_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicSpaceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicSpaceCollection.cs index eb775982ad95..27935ced4417 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicSpaceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicSpaceCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_TopicSpacesGet() Console.WriteLine($"Succeeded: {result}"); } + // TopicSpaces_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TopicSpacesGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicSpaces_Get.json + // this example is just showing the usage of "TopicSpaces_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 EventGridNamespaceResource created on azure + // for more information of creating EventGridNamespaceResource, please refer to the document of EventGridNamespaceResource + string subscriptionId = "8f6b6269-84f2-4d09-9e31-1127efcd1e40"; + string resourceGroupName = "examplerg"; + string namespaceName = "exampleNamespaceName1"; + ResourceIdentifier eventGridNamespaceResourceId = EventGridNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventGridNamespaceResource eventGridNamespace = client.GetEventGridNamespaceResource(eventGridNamespaceResourceId); + + // get the collection of this TopicSpaceResource + TopicSpaceCollection collection = eventGridNamespace.GetTopicSpaces(); + + // invoke the operation + string topicSpaceName = "exampleTopicSpaceName1"; + NullableResponse response = await collection.GetIfExistsAsync(topicSpaceName); + TopicSpaceResource 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 + TopicSpaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TopicSpaces_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicTypeCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicTypeCollection.cs index 46e67da75fbb..2f236f11ea36 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicTypeCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_TopicTypeCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -106,5 +107,44 @@ public async Task Exists_TopicTypesGet() Console.WriteLine($"Succeeded: {result}"); } + + // TopicTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TopicTypesGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicTypes_Get.json + // this example is just showing the usage of "TopicTypes_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TopicTypeResource + TopicTypeCollection collection = tenantResource.GetTopicTypes(); + + // invoke the operation + string topicTypeName = "Microsoft.Storage.StorageAccounts"; + NullableResponse response = await collection.GetIfExistsAsync(topicTypeName); + TopicTypeResource 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 + TopicTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_VerifiedPartnerCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_VerifiedPartnerCollection.cs index 844d33bcd5e7..b68a2e94ce4e 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_VerifiedPartnerCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/samples/Generated/Samples/Sample_VerifiedPartnerCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -74,6 +75,45 @@ public async Task Exists_VerifiedPartnersGet() Console.WriteLine($"Succeeded: {result}"); } + // VerifiedPartners_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VerifiedPartnersGet() + { + // Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/VerifiedPartners_Get.json + // this example is just showing the usage of "VerifiedPartners_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this VerifiedPartnerResource + VerifiedPartnerCollection collection = tenantResource.GetVerifiedPartners(); + + // invoke the operation + string verifiedPartnerName = "Contoso.Finance"; + NullableResponse response = await collection.GetIfExistsAsync(verifiedPartnerName); + VerifiedPartnerResource 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 + VerifiedPartnerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VerifiedPartners_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateCollection.cs index 5f661dd1ebef..36510d550a95 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string caCertificateName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// Name of the CA certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _caCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CaCertificateResource(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.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName} + /// + /// + /// Operation Id + /// CaCertificates_Get + /// + /// + /// + /// Name of the CA certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string caCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(caCertificateName, nameof(caCertificateName)); + + using var scope = _caCertificateClientDiagnostics.CreateScope("CaCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _caCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, caCertificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CaCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainEventSubscriptionCollection.cs index e8d2c08c1e0f..d9d3c26ca3ba 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainEventSubscriptionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string eventSubscriptionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// DomainEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _domainEventSubscriptionClientDiagnostics.CreateScope("DomainEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _domainEventSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DomainEventSubscriptionResource(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.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// DomainEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _domainEventSubscriptionClientDiagnostics.CreateScope("DomainEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _domainEventSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DomainEventSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicCollection.cs index 5ddfd7bb877e..428fa3615dc1 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string domainTopicName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName} + /// + /// + /// Operation Id + /// DomainTopics_Get + /// + /// + /// + /// Name of the topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string domainTopicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainTopicName, nameof(domainTopicName)); + + using var scope = _domainTopicClientDiagnostics.CreateScope("DomainTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _domainTopicRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, domainTopicName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DomainTopicResource(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.EventGrid/domains/{domainName}/topics/{domainTopicName} + /// + /// + /// Operation Id + /// DomainTopics_Get + /// + /// + /// + /// Name of the topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainTopicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainTopicName, nameof(domainTopicName)); + + using var scope = _domainTopicClientDiagnostics.CreateScope("DomainTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = _domainTopicRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, domainTopicName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DomainTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionCollection.cs index 7d3a3459825b..60a16bf7ed2b 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string eventSubscriptionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// DomainTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _domainTopicEventSubscriptionClientDiagnostics.CreateScope("DomainTopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _domainTopicEventSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DomainTopicEventSubscriptionResource(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.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// DomainTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _domainTopicEventSubscriptionClientDiagnostics.CreateScope("DomainTopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _domainTopicEventSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DomainTopicEventSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainCollection.cs index 5fd5ee91701b..0e47b1023e58 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string domainName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _eventGridDomainDomainsClientDiagnostics.CreateScope("EventGridDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridDomainDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, domainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridDomainResource(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.EventGrid/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _eventGridDomainDomainsClientDiagnostics.CreateScope("EventGridDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridDomainDomainsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, domainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionCollection.cs index 6180864d3291..41d93e4ada7b 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _eventGridDomainPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("EventGridDomainPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridDomainPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, "domains", Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridDomainPrivateEndpointConnectionResource(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.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _eventGridDomainPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("EventGridDomainPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridDomainPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, "domains", Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridDomainPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResourceCollection.cs index a6fe9887adbb..737b969e7bc7 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResourceCollection.cs @@ -246,6 +246,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _eventGridDomainPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("EventGridDomainPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridDomainPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, "domains", Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridDomainPrivateLinkResource(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.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _eventGridDomainPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("EventGridDomainPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridDomainPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, "domains", Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridDomainPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientCollection.cs index 00940707d102..51190173b746 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string clientName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// Name of the client. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var scope = _eventGridNamespaceClientClientsClientDiagnostics.CreateScope("EventGridNamespaceClientCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridNamespaceClientClientsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridNamespaceClientResource(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.EventGrid/namespaces/{namespaceName}/clients/{clientName} + /// + /// + /// Operation Id + /// Clients_Get + /// + /// + /// + /// Name of the client. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clientName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientName, nameof(clientName)); + + using var scope = _eventGridNamespaceClientClientsClientDiagnostics.CreateScope("EventGridNamespaceClientCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridNamespaceClientClientsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridNamespaceClientResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientGroupCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientGroupCollection.cs index ff0a56caa66f..15234ea3c8b7 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientGroupCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientGroupCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string clientGroupName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// Name of the client group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var scope = _eventGridNamespaceClientGroupClientGroupsClientDiagnostics.CreateScope("EventGridNamespaceClientGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridNamespaceClientGroupClientGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridNamespaceClientGroupResource(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.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName} + /// + /// + /// Operation Id + /// ClientGroups_Get + /// + /// + /// + /// Name of the client group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clientGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientGroupName, nameof(clientGroupName)); + + using var scope = _eventGridNamespaceClientGroupClientGroupsClientDiagnostics.CreateScope("EventGridNamespaceClientGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridNamespaceClientGroupClientGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clientGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridNamespaceClientGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceCollection.cs index b2f3aa3b61f9..b8cdd4511c96 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string namespaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// Name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _eventGridNamespaceNamespacesClientDiagnostics.CreateScope("EventGridNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridNamespaceNamespacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridNamespaceResource(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.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// Name of the namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _eventGridNamespaceNamespacesClientDiagnostics.CreateScope("EventGridNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridNamespaceNamespacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridNamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespacePermissionBindingCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespacePermissionBindingCollection.cs index 11805f69ec83..3ca7f6ec99fa 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespacePermissionBindingCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespacePermissionBindingCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string permissionBindingName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// Name of the permission binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var scope = _eventGridNamespacePermissionBindingPermissionBindingsClientDiagnostics.CreateScope("EventGridNamespacePermissionBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridNamespacePermissionBindingPermissionBindingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridNamespacePermissionBindingResource(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.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName} + /// + /// + /// Operation Id + /// PermissionBindings_Get + /// + /// + /// + /// Name of the permission binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string permissionBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(permissionBindingName, nameof(permissionBindingName)); + + using var scope = _eventGridNamespacePermissionBindingPermissionBindingsClientDiagnostics.CreateScope("EventGridNamespacePermissionBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridNamespacePermissionBindingPermissionBindingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, permissionBindingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridNamespacePermissionBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs index c5b24d30dd1e..9b64d307279c 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _eventGridPartnerNamespacePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("EventGridPartnerNamespacePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridPartnerNamespacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, "partnerNamespaces", Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridPartnerNamespacePrivateEndpointConnectionResource(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.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _eventGridPartnerNamespacePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("EventGridPartnerNamespacePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridPartnerNamespacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, "partnerNamespaces", Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridPartnerNamespacePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicCollection.cs index 625945c2823b..a42b5246750a 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string topicName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName} + /// + /// + /// Operation Id + /// Topics_Get + /// + /// + /// + /// Name of the topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _eventGridTopicTopicsClientDiagnostics.CreateScope("EventGridTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridTopicTopicsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, topicName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridTopicResource(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.EventGrid/topics/{topicName} + /// + /// + /// Operation Id + /// Topics_Get + /// + /// + /// + /// Name of the topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _eventGridTopicTopicsClientDiagnostics.CreateScope("EventGridTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridTopicTopicsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, topicName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionCollection.cs index daec6d694a25..6b2616e0d9af 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _eventGridTopicPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("EventGridTopicPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridTopicPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, "topics", Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridTopicPrivateEndpointConnectionResource(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.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _eventGridTopicPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("EventGridTopicPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridTopicPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, "topics", Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridTopicPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResourceCollection.cs index a460b3e743a9..ed72dbffc175 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResourceCollection.cs @@ -246,6 +246,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _eventGridTopicPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("EventGridTopicPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventGridTopicPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, "topics", Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridTopicPrivateLinkResource(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.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _eventGridTopicPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("EventGridTopicPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventGridTopicPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, "topics", Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventGridTopicPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionCollection.cs index 2ca48123e023..d73c7f1ee3fd 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionCollection.cs @@ -409,6 +409,80 @@ public virtual Response Exists(string eventSubscriptionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// EventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _eventSubscriptionClientDiagnostics.CreateScope("EventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventSubscriptionRestClient.GetAsync(Id, eventSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// EventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _eventSubscriptionClientDiagnostics.CreateScope("EventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventSubscriptionRestClient.Get(Id, eventSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicCollection.cs index e70eb22e830a..ab678c0613c6 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string topicName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// Name of the namespace topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _namespaceTopicRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceTopicResource(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.EventGrid/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// NamespaceTopics_Get + /// + /// + /// + /// Name of the namespace topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _namespaceTopicClientDiagnostics.CreateScope("NamespaceTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = _namespaceTopicRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicEventSubscriptionCollection.cs index 45109e170251..d0a0a2458c0f 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicEventSubscriptionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string eventSubscriptionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _namespaceTopicEventSubscriptionClientDiagnostics.CreateScope("NamespaceTopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _namespaceTopicEventSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceTopicEventSubscriptionResource(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.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// NamespaceTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _namespaceTopicEventSubscriptionClientDiagnostics.CreateScope("NamespaceTopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _namespaceTopicEventSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NamespaceTopicEventSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationCollection.cs index f4388d245262..2928cd923a7f 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string partnerDestinationName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// Name of the partner destination. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _partnerDestinationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerDestinationResource(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.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// Name of the partner destination. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string partnerDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerDestinationName, nameof(partnerDestinationName)); + + using var scope = _partnerDestinationClientDiagnostics.CreateScope("PartnerDestinationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _partnerDestinationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, partnerDestinationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerDestinationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelCollection.cs index c49a72a1b478..ef3054e4a7c1 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string channelName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName} + /// + /// + /// Operation Id + /// Channels_Get + /// + /// + /// + /// Name of the channel. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string channelName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(channelName, nameof(channelName)); + + using var scope = _partnerNamespaceChannelChannelsClientDiagnostics.CreateScope("PartnerNamespaceChannelCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _partnerNamespaceChannelChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, channelName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerNamespaceChannelResource(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.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName} + /// + /// + /// Operation Id + /// Channels_Get + /// + /// + /// + /// Name of the channel. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string channelName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(channelName, nameof(channelName)); + + using var scope = _partnerNamespaceChannelChannelsClientDiagnostics.CreateScope("PartnerNamespaceChannelCollection.GetIfExists"); + scope.Start(); + try + { + var response = _partnerNamespaceChannelChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, channelName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerNamespaceChannelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceCollection.cs index 73e74eff12cc..bf7be22eb111 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string partnerNamespaceName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName} + /// + /// + /// Operation Id + /// PartnerNamespaces_Get + /// + /// + /// + /// Name of the partner namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string partnerNamespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerNamespaceName, nameof(partnerNamespaceName)); + + using var scope = _partnerNamespaceClientDiagnostics.CreateScope("PartnerNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _partnerNamespaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, partnerNamespaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerNamespaceResource(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.EventGrid/partnerNamespaces/{partnerNamespaceName} + /// + /// + /// Operation Id + /// PartnerNamespaces_Get + /// + /// + /// + /// Name of the partner namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string partnerNamespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerNamespaceName, nameof(partnerNamespaceName)); + + using var scope = _partnerNamespaceClientDiagnostics.CreateScope("PartnerNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _partnerNamespaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, partnerNamespaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerNamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResourceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResourceCollection.cs index 0953421afb6f..ba41dc7a1ce7 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResourceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResourceCollection.cs @@ -246,6 +246,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _partnerNamespacePrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("PartnerNamespacePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _partnerNamespacePrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, "partnerNamespaces", Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerNamespacePrivateLinkResource(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.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _partnerNamespacePrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("PartnerNamespacePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _partnerNamespacePrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, "partnerNamespaces", Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerNamespacePrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerRegistrationCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerRegistrationCollection.cs index e4105a166211..26c7697e590e 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerRegistrationCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerRegistrationCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string partnerRegistrationName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName} + /// + /// + /// Operation Id + /// PartnerRegistrations_Get + /// + /// + /// + /// Name of the partner registration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string partnerRegistrationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerRegistrationName, nameof(partnerRegistrationName)); + + using var scope = _partnerRegistrationClientDiagnostics.CreateScope("PartnerRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _partnerRegistrationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, partnerRegistrationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerRegistrationResource(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.EventGrid/partnerRegistrations/{partnerRegistrationName} + /// + /// + /// Operation Id + /// PartnerRegistrations_Get + /// + /// + /// + /// Name of the partner registration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string partnerRegistrationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerRegistrationName, nameof(partnerRegistrationName)); + + using var scope = _partnerRegistrationClientDiagnostics.CreateScope("PartnerRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _partnerRegistrationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, partnerRegistrationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerRegistrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicCollection.cs index 3b3675784abf..dbdcf941f2b9 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string partnerTopicName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName} + /// + /// + /// Operation Id + /// PartnerTopics_Get + /// + /// + /// + /// Name of the partner topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string partnerTopicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerTopicName, nameof(partnerTopicName)); + + using var scope = _partnerTopicClientDiagnostics.CreateScope("PartnerTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _partnerTopicRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, partnerTopicName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerTopicResource(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.EventGrid/partnerTopics/{partnerTopicName} + /// + /// + /// Operation Id + /// PartnerTopics_Get + /// + /// + /// + /// Name of the partner topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string partnerTopicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(partnerTopicName, nameof(partnerTopicName)); + + using var scope = _partnerTopicClientDiagnostics.CreateScope("PartnerTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = _partnerTopicRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, partnerTopicName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicEventSubscriptionCollection.cs index a4448884c387..bbabcc61d75b 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicEventSubscriptionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string eventSubscriptionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// PartnerTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _partnerTopicEventSubscriptionClientDiagnostics.CreateScope("PartnerTopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _partnerTopicEventSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerTopicEventSubscriptionResource(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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// PartnerTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _partnerTopicEventSubscriptionClientDiagnostics.CreateScope("PartnerTopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _partnerTopicEventSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PartnerTopicEventSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicCollection.cs index 00d942da6340..f56444726478 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string systemTopicName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName} + /// + /// + /// Operation Id + /// SystemTopics_Get + /// + /// + /// + /// Name of the system topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string systemTopicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(systemTopicName, nameof(systemTopicName)); + + using var scope = _systemTopicClientDiagnostics.CreateScope("SystemTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _systemTopicRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, systemTopicName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SystemTopicResource(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.EventGrid/systemTopics/{systemTopicName} + /// + /// + /// Operation Id + /// SystemTopics_Get + /// + /// + /// + /// Name of the system topic. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string systemTopicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(systemTopicName, nameof(systemTopicName)); + + using var scope = _systemTopicClientDiagnostics.CreateScope("SystemTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = _systemTopicRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, systemTopicName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SystemTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionCollection.cs index fd20865a41c0..e6882eb56412 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string eventSubscriptionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// SystemTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _systemTopicEventSubscriptionClientDiagnostics.CreateScope("SystemTopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _systemTopicEventSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SystemTopicEventSubscriptionResource(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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// SystemTopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _systemTopicEventSubscriptionClientDiagnostics.CreateScope("SystemTopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _systemTopicEventSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SystemTopicEventSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicEventSubscriptionCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicEventSubscriptionCollection.cs index 6c62071622eb..d57830f7182d 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicEventSubscriptionCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicEventSubscriptionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string eventSubscriptionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// TopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _topicEventSubscriptionClientDiagnostics.CreateScope("TopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _topicEventSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TopicEventSubscriptionResource(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.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// TopicEventSubscriptions_Get + /// + /// + /// + /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventSubscriptionName, nameof(eventSubscriptionName)); + + using var scope = _topicEventSubscriptionClientDiagnostics.CreateScope("TopicEventSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _topicEventSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TopicEventSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceCollection.cs index 619845e959e4..88f8c2c10a1d 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string topicSpaceName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// Name of the Topic space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _topicSpaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TopicSpaceResource(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.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName} + /// + /// + /// Operation Id + /// TopicSpaces_Get + /// + /// + /// + /// Name of the Topic space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string topicSpaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicSpaceName, nameof(topicSpaceName)); + + using var scope = _topicSpaceClientDiagnostics.CreateScope("TopicSpaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _topicSpaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicSpaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TopicSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeCollection.cs index 8178a40a4dcd..24472d8b1efb 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeCollection.cs @@ -240,6 +240,80 @@ public virtual Response Exists(string topicTypeName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.EventGrid/topicTypes/{topicTypeName} + /// + /// + /// Operation Id + /// TopicTypes_Get + /// + /// + /// + /// Name of the topic type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string topicTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + using var scope = _topicTypeClientDiagnostics.CreateScope("TopicTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _topicTypeRestClient.GetAsync(topicTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TopicTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.EventGrid/topicTypes/{topicTypeName} + /// + /// + /// Operation Id + /// TopicTypes_Get + /// + /// + /// + /// Name of the topic type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string topicTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + using var scope = _topicTypeClientDiagnostics.CreateScope("TopicTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _topicTypeRestClient.Get(topicTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TopicTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerCollection.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerCollection.cs index 784dbfc060b5..64ee88d6db6a 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerCollection.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerCollection.cs @@ -246,6 +246,80 @@ public virtual Response Exists(string verifiedPartnerName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.EventGrid/verifiedPartners/{verifiedPartnerName} + /// + /// + /// Operation Id + /// VerifiedPartners_Get + /// + /// + /// + /// Name of the verified partner. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string verifiedPartnerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(verifiedPartnerName, nameof(verifiedPartnerName)); + + using var scope = _verifiedPartnerClientDiagnostics.CreateScope("VerifiedPartnerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _verifiedPartnerRestClient.GetAsync(verifiedPartnerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VerifiedPartnerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.EventGrid/verifiedPartners/{verifiedPartnerName} + /// + /// + /// Operation Id + /// VerifiedPartners_Get + /// + /// + /// + /// Name of the verified partner. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string verifiedPartnerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(verifiedPartnerName, nameof(verifiedPartnerName)); + + using var scope = _verifiedPartnerClientDiagnostics.CreateScope("VerifiedPartnerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _verifiedPartnerRestClient.Get(verifiedPartnerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VerifiedPartnerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubAuthorizationRuleCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubAuthorizationRuleCollection.cs index ed33ea69f8e0..16fd5cd637ef 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubAuthorizationRuleCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubAuthorizationRuleCollection.cs @@ -167,5 +167,49 @@ public async Task Exists_EventHubAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // EventHubAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventHubAuthorizationRuleGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubAuthorizationRuleGet.json + // this example is just showing the usage of "EventHubs_GetAuthorizationRule" 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 EventHubResource created on azure + // for more information of creating EventHubResource, please refer to the document of EventHubResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-960"; + string eventHubName = "sdk-EventHub-532"; + ResourceIdentifier eventHubResourceId = EventHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, eventHubName); + EventHubResource eventHub = client.GetEventHubResource(eventHubResourceId); + + // get the collection of this EventHubAuthorizationRuleResource + EventHubAuthorizationRuleCollection collection = eventHub.GetEventHubAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "sdk-Authrules-2513"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + EventHubAuthorizationRuleResource 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 + EventHubsAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubCollection.cs index 97bd8931ec68..b72ee1269574 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubCollection.cs @@ -181,5 +181,48 @@ public async Task Exists_EventHubGet() Console.WriteLine($"Succeeded: {result}"); } + + // EventHubGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventHubGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubGet.json + // this example is just showing the usage of "EventHubs_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 EventHubsNamespaceResource created on azure + // for more information of creating EventHubsNamespaceResource, please refer to the document of EventHubsNamespaceResource + string subscriptionId = "e2f361f0-3b27-4503-a9cc-21cfba380093"; + string resourceGroupName = "Default-NotificationHubs-AustraliaEast"; + string namespaceName = "sdk-Namespace-716"; + ResourceIdentifier eventHubsNamespaceResourceId = EventHubsNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventHubsNamespaceResource eventHubsNamespace = client.GetEventHubsNamespaceResource(eventHubsNamespaceResourceId); + + // get the collection of this EventHubResource + EventHubCollection collection = eventHubsNamespace.GetEventHubs(); + + // invoke the operation + string eventHubName = "sdk-EventHub-10"; + NullableResponse response = await collection.GetIfExistsAsync(eventHubName); + EventHubResource 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 + EventHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsApplicationGroupCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsApplicationGroupCollection.cs index 8d2da6800436..0863e9a4e535 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsApplicationGroupCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsApplicationGroupCollection.cs @@ -165,5 +165,48 @@ public async Task Exists_ApplicationGroupGet() Console.WriteLine($"Succeeded: {result}"); } + + // ApplicationGroupGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApplicationGroupGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ApplicationGroup/ApplicationGroupGet.json + // this example is just showing the usage of "ApplicationGroup_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 EventHubsNamespaceResource created on azure + // for more information of creating EventHubsNamespaceResource, please refer to the document of EventHubsNamespaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "contosotest"; + string namespaceName = "contoso-ua-test-eh-system-1"; + ResourceIdentifier eventHubsNamespaceResourceId = EventHubsNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventHubsNamespaceResource eventHubsNamespace = client.GetEventHubsNamespaceResource(eventHubsNamespaceResourceId); + + // get the collection of this EventHubsApplicationGroupResource + EventHubsApplicationGroupCollection collection = eventHubsNamespace.GetEventHubsApplicationGroups(); + + // invoke the operation + string applicationGroupName = "appGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(applicationGroupName); + EventHubsApplicationGroupResource 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 + EventHubsApplicationGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsClusterCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsClusterCollection.cs index 4fe0fe4fa888..9b38ba196dda 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsClusterCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsClusterCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_ClusterGet() Console.WriteLine($"Succeeded: {result}"); } + // ClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ClusterGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClusterGet.json + // this example is just showing the usage of "Clusters_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 = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EventHubsClusterResource + EventHubsClusterCollection collection = resourceGroupResource.GetEventHubsClusters(); + + // invoke the operation + string clusterName = "testCluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + EventHubsClusterResource 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 + EventHubsClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ClusterPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsConsumerGroupCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsConsumerGroupCollection.cs index 6e24d0f59ca5..f18098aeba76 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsConsumerGroupCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsConsumerGroupCollection.cs @@ -126,6 +126,50 @@ public async Task Exists_ConsumerGroupGet() Console.WriteLine($"Succeeded: {result}"); } + // ConsumerGroupGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConsumerGroupGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ConsumerGroup/EHConsumerGroupGet.json + // this example is just showing the usage of "ConsumerGroups_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 EventHubResource created on azure + // for more information of creating EventHubResource, please refer to the document of EventHubResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-2661"; + string eventHubName = "sdk-EventHub-6681"; + ResourceIdentifier eventHubResourceId = EventHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, eventHubName); + EventHubResource eventHub = client.GetEventHubResource(eventHubResourceId); + + // get the collection of this EventHubsConsumerGroupResource + EventHubsConsumerGroupCollection collection = eventHub.GetEventHubsConsumerGroups(); + + // invoke the operation + string consumerGroupName = "sdk-ConsumerGroup-5563"; + NullableResponse response = await collection.GetIfExistsAsync(consumerGroupName); + EventHubsConsumerGroupResource 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 + EventHubsConsumerGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConsumerGroupsListAll [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsDisasterRecoveryAuthorizationRuleCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsDisasterRecoveryAuthorizationRuleCollection.cs index c4b0a494cae1..678dbdef36f4 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsDisasterRecoveryAuthorizationRuleCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsDisasterRecoveryAuthorizationRuleCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_NameSpaceAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // NameSpaceAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpaceAuthorizationRuleGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasAuthorizationRuleGet.json + // this example is just showing the usage of "DisasterRecoveryConfigs_GetAuthorizationRule" 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 EventHubsDisasterRecoveryResource created on azure + // for more information of creating EventHubsDisasterRecoveryResource, please refer to the document of EventHubsDisasterRecoveryResource + string subscriptionId = "exampleSubscriptionId"; + string resourceGroupName = "exampleResourceGroup"; + string namespaceName = "sdk-Namespace-9080"; + string @alias = "sdk-DisasterRecovery-4879"; + ResourceIdentifier eventHubsDisasterRecoveryResourceId = EventHubsDisasterRecoveryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, @alias); + EventHubsDisasterRecoveryResource eventHubsDisasterRecovery = client.GetEventHubsDisasterRecoveryResource(eventHubsDisasterRecoveryResourceId); + + // get the collection of this EventHubsDisasterRecoveryAuthorizationRuleResource + EventHubsDisasterRecoveryAuthorizationRuleCollection collection = eventHubsDisasterRecovery.GetEventHubsDisasterRecoveryAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "sdk-Authrules-4879"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + EventHubsDisasterRecoveryAuthorizationRuleResource 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 + EventHubsAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsDisasterRecoveryCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsDisasterRecoveryCollection.cs index 183448562d88..d4fb406aff31 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsDisasterRecoveryCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsDisasterRecoveryCollection.cs @@ -159,5 +159,48 @@ public async Task Exists_EHAliasGet() Console.WriteLine($"Succeeded: {result}"); } + + // EHAliasGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EHAliasGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasGet.json + // this example is just showing the usage of "DisasterRecoveryConfigs_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 EventHubsNamespaceResource created on azure + // for more information of creating EventHubsNamespaceResource, please refer to the document of EventHubsNamespaceResource + string subscriptionId = "exampleSubscriptionId"; + string resourceGroupName = "exampleResourceGroup"; + string namespaceName = "sdk-Namespace-8859"; + ResourceIdentifier eventHubsNamespaceResourceId = EventHubsNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventHubsNamespaceResource eventHubsNamespace = client.GetEventHubsNamespaceResource(eventHubsNamespaceResourceId); + + // get the collection of this EventHubsDisasterRecoveryResource + EventHubsDisasterRecoveryCollection collection = eventHubsNamespace.GetEventHubsDisasterRecoveries(); + + // invoke the operation + string @alias = "sdk-DisasterRecovery-3814"; + NullableResponse response = await collection.GetIfExistsAsync(@alias); + EventHubsDisasterRecoveryResource 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 + EventHubsDisasterRecoveryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsNamespaceAuthorizationRuleCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsNamespaceAuthorizationRuleCollection.cs index 36dc18f11368..bfa623a58ed9 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsNamespaceAuthorizationRuleCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsNamespaceAuthorizationRuleCollection.cs @@ -163,5 +163,48 @@ public async Task Exists_NameSpaceAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // NameSpaceAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpaceAuthorizationRuleGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceAuthorizationRuleGet.json + // this example is just showing the usage of "Namespaces_GetAuthorizationRule" 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 EventHubsNamespaceResource created on azure + // for more information of creating EventHubsNamespaceResource, please refer to the document of EventHubsNamespaceResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-2702"; + ResourceIdentifier eventHubsNamespaceResourceId = EventHubsNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventHubsNamespaceResource eventHubsNamespace = client.GetEventHubsNamespaceResource(eventHubsNamespaceResourceId); + + // get the collection of this EventHubsNamespaceAuthorizationRuleResource + EventHubsNamespaceAuthorizationRuleCollection collection = eventHubsNamespace.GetEventHubsNamespaceAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "sdk-Authrules-1746"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + EventHubsNamespaceAuthorizationRuleResource 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 + EventHubsAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsNamespaceCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsNamespaceCollection.cs index b9cc646eaefc..7fbf15daf46e 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsNamespaceCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsNamespaceCollection.cs @@ -179,5 +179,47 @@ public async Task Exists_NameSpaceGet() Console.WriteLine($"Succeeded: {result}"); } + + // NameSpaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpaceGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceGet.json + // this example is just showing the usage of "Namespaces_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 = "SampleSubscription"; + string resourceGroupName = "ResurceGroupSample"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EventHubsNamespaceResource + EventHubsNamespaceCollection collection = resourceGroupResource.GetEventHubsNamespaces(); + + // invoke the operation + string namespaceName = "NamespaceSample"; + NullableResponse response = await collection.GetIfExistsAsync(namespaceName); + EventHubsNamespaceResource 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 + EventHubsNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsPrivateEndpointConnectionCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsPrivateEndpointConnectionCollection.cs index 4ea2a4e71897..410ff09c95ce 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsPrivateEndpointConnectionCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsPrivateEndpointConnectionCollection.cs @@ -166,5 +166,48 @@ public async Task Exists_NameSpacePrivateEndPointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + + // NameSpacePrivateEndPointConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpacePrivateEndPointConnectionGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/PrivateEndPointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 EventHubsNamespaceResource created on azure + // for more information of creating EventHubsNamespaceResource, please refer to the document of EventHubsNamespaceResource + string subscriptionId = "subID"; + string resourceGroupName = "SDK-EventHub-4794"; + string namespaceName = "sdk-Namespace-5828"; + ResourceIdentifier eventHubsNamespaceResourceId = EventHubsNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventHubsNamespaceResource eventHubsNamespace = client.GetEventHubsNamespaceResource(eventHubsNamespaceResourceId); + + // get the collection of this EventHubsPrivateEndpointConnectionResource + EventHubsPrivateEndpointConnectionCollection collection = eventHubsNamespace.GetEventHubsPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + EventHubsPrivateEndpointConnectionResource 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 + EventHubsPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsSchemaGroupCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsSchemaGroupCollection.cs index 5641478ff050..f70fec0b56c7 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsSchemaGroupCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/samples/Generated/Samples/Sample_EventHubsSchemaGroupCollection.cs @@ -164,5 +164,48 @@ public async Task Exists_SchemaRegistryGet() Console.WriteLine($"Succeeded: {result}"); } + + // SchemaRegistryGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SchemaRegistryGet() + { + // Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/SchemaRegistry/SchemaRegistryGet.json + // this example is just showing the usage of "SchemaRegistry_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 EventHubsNamespaceResource created on azure + // for more information of creating EventHubsNamespaceResource, please refer to the document of EventHubsNamespaceResource + string subscriptionId = "e8baea74-64ce-459b-bee3-5aa4c47b3ae3"; + string resourceGroupName = "alitest"; + string namespaceName = "ali-ua-test-eh-system-1"; + ResourceIdentifier eventHubsNamespaceResourceId = EventHubsNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + EventHubsNamespaceResource eventHubsNamespace = client.GetEventHubsNamespaceResource(eventHubsNamespaceResourceId); + + // get the collection of this EventHubsSchemaGroupResource + EventHubsSchemaGroupCollection collection = eventHubsNamespace.GetEventHubsSchemaGroups(); + + // invoke the operation + string schemaGroupName = "testSchemaGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(schemaGroupName); + EventHubsSchemaGroupResource 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 + EventHubsSchemaGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubAuthorizationRuleCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubAuthorizationRuleCollection.cs index ddfa838ab411..13387335b3da 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubAuthorizationRuleCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubAuthorizationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// EventHubs_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _eventHubAuthorizationRuleEventHubsClientDiagnostics.CreateScope("EventHubAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubAuthorizationRuleEventHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubAuthorizationRuleResource(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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// EventHubs_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _eventHubAuthorizationRuleEventHubsClientDiagnostics.CreateScope("EventHubAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubAuthorizationRuleEventHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubCollection.cs index e29dcf505344..f534b81624fd 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string eventHubName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName} + /// + /// + /// Operation Id + /// EventHubs_Get + /// + /// + /// + /// The Event Hub name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventHubName, nameof(eventHubName)); + + using var scope = _eventHubClientDiagnostics.CreateScope("EventHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventHubName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubResource(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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName} + /// + /// + /// Operation Id + /// EventHubs_Get + /// + /// + /// + /// The Event Hub name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventHubName, nameof(eventHubName)); + + using var scope = _eventHubClientDiagnostics.CreateScope("EventHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventHubName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsApplicationGroupCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsApplicationGroupCollection.cs index ff9a9b393588..fc19577fdcff 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsApplicationGroupCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsApplicationGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string applicationGroupName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/applicationGroups/{applicationGroupName} + /// + /// + /// Operation Id + /// ApplicationGroup_Get + /// + /// + /// + /// The Application Group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + + using var scope = _eventHubsApplicationGroupApplicationGroupClientDiagnostics.CreateScope("EventHubsApplicationGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsApplicationGroupApplicationGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsApplicationGroupResource(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.EventHub/namespaces/{namespaceName}/applicationGroups/{applicationGroupName} + /// + /// + /// Operation Id + /// ApplicationGroup_Get + /// + /// + /// + /// The Application Group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + + using var scope = _eventHubsApplicationGroupApplicationGroupClientDiagnostics.CreateScope("EventHubsApplicationGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsApplicationGroupApplicationGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsApplicationGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsClusterCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsClusterCollection.cs index 7ac1a3280e0a..5cadef00d731 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsClusterCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the Event Hubs Cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _eventHubsClusterClustersClientDiagnostics.CreateScope("EventHubsClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsClusterResource(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.EventHub/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the Event Hubs Cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _eventHubsClusterClustersClientDiagnostics.CreateScope("EventHubsClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsConsumerGroupCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsConsumerGroupCollection.cs index 10a9b5a87f5a..3f1e8fc002db 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsConsumerGroupCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsConsumerGroupCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string consumerGroupName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName} + /// + /// + /// Operation Id + /// ConsumerGroups_Get + /// + /// + /// + /// The consumer group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string consumerGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(consumerGroupName, nameof(consumerGroupName)); + + using var scope = _eventHubsConsumerGroupConsumerGroupsClientDiagnostics.CreateScope("EventHubsConsumerGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsConsumerGroupConsumerGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, consumerGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsConsumerGroupResource(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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName} + /// + /// + /// Operation Id + /// ConsumerGroups_Get + /// + /// + /// + /// The consumer group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string consumerGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(consumerGroupName, nameof(consumerGroupName)); + + using var scope = _eventHubsConsumerGroupConsumerGroupsClientDiagnostics.CreateScope("EventHubsConsumerGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsConsumerGroupConsumerGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, consumerGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsConsumerGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryAuthorizationRuleCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryAuthorizationRuleCollection.cs index a37d54956c4f..acf0c4019acd 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryAuthorizationRuleCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryAuthorizationRuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// DisasterRecoveryConfigs_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _eventHubsDisasterRecoveryAuthorizationRuleDisasterRecoveryConfigsClientDiagnostics.CreateScope("EventHubsDisasterRecoveryAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsDisasterRecoveryAuthorizationRuleDisasterRecoveryConfigsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsDisasterRecoveryAuthorizationRuleResource(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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// DisasterRecoveryConfigs_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _eventHubsDisasterRecoveryAuthorizationRuleDisasterRecoveryConfigsClientDiagnostics.CreateScope("EventHubsDisasterRecoveryAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsDisasterRecoveryAuthorizationRuleDisasterRecoveryConfigsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsDisasterRecoveryAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryCollection.cs index 6fd231be9a1e..b64739bb5155 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string @alias, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias} + /// + /// + /// Operation Id + /// DisasterRecoveryConfigs_Get + /// + /// + /// + /// The Disaster Recovery configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string @alias, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(@alias, nameof(@alias)); + + using var scope = _eventHubsDisasterRecoveryDisasterRecoveryConfigsClientDiagnostics.CreateScope("EventHubsDisasterRecoveryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsDisasterRecoveryDisasterRecoveryConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alias, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsDisasterRecoveryResource(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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias} + /// + /// + /// Operation Id + /// DisasterRecoveryConfigs_Get + /// + /// + /// + /// The Disaster Recovery configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string @alias, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(@alias, nameof(@alias)); + + using var scope = _eventHubsDisasterRecoveryDisasterRecoveryConfigsClientDiagnostics.CreateScope("EventHubsDisasterRecoveryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsDisasterRecoveryDisasterRecoveryConfigsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alias, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsDisasterRecoveryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceAuthorizationRuleCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceAuthorizationRuleCollection.cs index 54243c40c4e7..2d880fe023eb 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceAuthorizationRuleCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceAuthorizationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _eventHubsNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("EventHubsNamespaceAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsNamespaceAuthorizationRuleResource(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.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _eventHubsNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("EventHubsNamespaceAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceCollection.cs index 1c350684a802..cff74c84461f 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string namespaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The Namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _eventHubsNamespaceNamespacesClientDiagnostics.CreateScope("EventHubsNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsNamespaceNamespacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsNamespaceResource(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.EventHub/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The Namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _eventHubsNamespaceNamespacesClientDiagnostics.CreateScope("EventHubsNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsNamespaceNamespacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsNamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsPrivateEndpointConnectionCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsPrivateEndpointConnectionCollection.cs index c12f5d893ef9..da84c7ba825e 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsPrivateEndpointConnectionCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The PrivateEndpointConnection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _eventHubsPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("EventHubsPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsPrivateEndpointConnectionResource(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.EventHub/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The PrivateEndpointConnection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _eventHubsPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("EventHubsPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsSchemaGroupCollection.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsSchemaGroupCollection.cs index 6fbbd2b58a2a..505e61f4c96a 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsSchemaGroupCollection.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsSchemaGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string schemaGroupName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// + /// The Schema Group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaGroupName, nameof(schemaGroupName)); + + using var scope = _eventHubsSchemaGroupSchemaRegistryClientDiagnostics.CreateScope("EventHubsSchemaGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _eventHubsSchemaGroupSchemaRegistryRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsSchemaGroupResource(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.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName} + /// + /// + /// Operation Id + /// SchemaRegistry_Get + /// + /// + /// + /// The Schema Group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaGroupName, nameof(schemaGroupName)); + + using var scope = _eventHubsSchemaGroupSchemaRegistryClientDiagnostics.CreateScope("EventHubsSchemaGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _eventHubsSchemaGroupSchemaRegistryRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EventHubsSchemaGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/samples/Generated/Samples/Sample_CustomLocationCollection.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/samples/Generated/Samples/Sample_CustomLocationCollection.cs index dcce780a81a7..a64482bb431f 100644 --- a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/samples/Generated/Samples/Sample_CustomLocationCollection.cs +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/samples/Generated/Samples/Sample_CustomLocationCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetCustomLocation() Console.WriteLine($"Succeeded: {result}"); } + // Get Custom Location + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCustomLocation() + { + // Generated from example definition: specification/extendedlocation/resource-manager/Microsoft.ExtendedLocation/stable/2021-08-15/examples/CustomLocationsGet.json + // this example is just showing the usage of "CustomLocations_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 = "11111111-2222-3333-4444-555555555555"; + string resourceGroupName = "testresourcegroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CustomLocationResource + CustomLocationCollection collection = resourceGroupResource.GetCustomLocations(); + + // invoke the operation + string resourceName = "customLocation01"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + CustomLocationResource 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 + CustomLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create/Update Custom Location [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/CustomLocationCollection.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/CustomLocationCollection.cs index e85a1e3f9fb1..dd1e973cc836 100644 --- a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/CustomLocationCollection.cs +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/CustomLocationCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName} + /// + /// + /// Operation Id + /// CustomLocations_Get + /// + /// + /// + /// Custom Locations name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _customLocationClientDiagnostics.CreateScope("CustomLocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _customLocationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomLocationResource(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.ExtendedLocation/customLocations/{resourceName} + /// + /// + /// Operation Id + /// CustomLocations_Get + /// + /// + /// + /// Custom Locations name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _customLocationClientDiagnostics.CreateScope("CustomLocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _customLocationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomLocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/samples/Generated/Samples/Sample_FluidRelayContainerCollection.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/samples/Generated/Samples/Sample_FluidRelayContainerCollection.cs index 7c3f5835e291..c624238895b6 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/samples/Generated/Samples/Sample_FluidRelayContainerCollection.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/samples/Generated/Samples/Sample_FluidRelayContainerCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetFluidRelayContainerDetails() Console.WriteLine($"Succeeded: {result}"); } + // Get Fluid Relay container details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFluidRelayContainerDetails() + { + // Generated from example definition: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Get.json + // this example is just showing the usage of "FluidRelayContainers_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 FluidRelayServerResource created on azure + // for more information of creating FluidRelayServerResource, please refer to the document of FluidRelayServerResource + string subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + string resourceGroup = "myResourceGroup"; + string fluidRelayServerName = "myFluidRelayServer"; + ResourceIdentifier fluidRelayServerResourceId = FluidRelayServerResource.CreateResourceIdentifier(subscriptionId, resourceGroup, fluidRelayServerName); + FluidRelayServerResource fluidRelayServer = client.GetFluidRelayServerResource(fluidRelayServerResourceId); + + // get the collection of this FluidRelayContainerResource + FluidRelayContainerCollection collection = fluidRelayServer.GetFluidRelayContainers(); + + // invoke the operation + string fluidRelayContainerName = "myFluidRelayContainer"; + NullableResponse response = await collection.GetIfExistsAsync(fluidRelayContainerName); + FluidRelayContainerResource 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 + FluidRelayContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all Fluid Relay containers in a Fluid Relay server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/samples/Generated/Samples/Sample_FluidRelayServerCollection.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/samples/Generated/Samples/Sample_FluidRelayServerCollection.cs index 917cc8dc4f9d..fdd8a454005c 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/samples/Generated/Samples/Sample_FluidRelayServerCollection.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/samples/Generated/Samples/Sample_FluidRelayServerCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetFluidRelayServerDetails() Console.WriteLine($"Succeeded: {result}"); } + // Get Fluid Relay server details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFluidRelayServerDetails() + { + // Generated from example definition: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Get.json + // this example is just showing the usage of "FluidRelayServers_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 = "xxxx-xxxx-xxxx-xxxx"; + string resourceGroup = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroup); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FluidRelayServerResource + FluidRelayServerCollection collection = resourceGroupResource.GetFluidRelayServers(); + + // invoke the operation + string fluidRelayServerName = "myFluidRelayServer"; + NullableResponse response = await collection.GetIfExistsAsync(fluidRelayServerName); + FluidRelayServerResource 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 + FluidRelayServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a Fluid Relay server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayContainerCollection.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayContainerCollection.cs index 5fa5076f6541..ef9906a4905f 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayContainerCollection.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayContainerCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string fluidRelayContainerName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/fluidRelayContainers/{fluidRelayContainerName} + /// + /// + /// Operation Id + /// FluidRelayContainers_Get + /// + /// + /// + /// The Fluid Relay container resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string fluidRelayContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fluidRelayContainerName, nameof(fluidRelayContainerName)); + + using var scope = _fluidRelayContainerClientDiagnostics.CreateScope("FluidRelayContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fluidRelayContainerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fluidRelayContainerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FluidRelayContainerResource(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/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/fluidRelayContainers/{fluidRelayContainerName} + /// + /// + /// Operation Id + /// FluidRelayContainers_Get + /// + /// + /// + /// The Fluid Relay container resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fluidRelayContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fluidRelayContainerName, nameof(fluidRelayContainerName)); + + using var scope = _fluidRelayContainerClientDiagnostics.CreateScope("FluidRelayContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fluidRelayContainerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fluidRelayContainerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FluidRelayContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerCollection.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerCollection.cs index fdba1e53cdbe..50603340f4bd 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerCollection.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string fluidRelayServerName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName} + /// + /// + /// Operation Id + /// FluidRelayServers_Get + /// + /// + /// + /// The Fluid Relay server resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string fluidRelayServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fluidRelayServerName, nameof(fluidRelayServerName)); + + using var scope = _fluidRelayServerClientDiagnostics.CreateScope("FluidRelayServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fluidRelayServerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fluidRelayServerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FluidRelayServerResource(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/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName} + /// + /// + /// Operation Id + /// FluidRelayServers_Get + /// + /// + /// + /// The Fluid Relay server resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fluidRelayServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fluidRelayServerName, nameof(fluidRelayServerName)); + + using var scope = _fluidRelayServerClientDiagnostics.CreateScope("FluidRelayServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fluidRelayServerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fluidRelayServerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FluidRelayServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorCollection.cs index 3ce4c9cbb780..133cc138038a 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetFrontDoor() Console.WriteLine($"Succeeded: {result}"); } + // Get Front Door + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFrontDoor() + { + // Generated from example definition: specification/frontdoor/resource-manager/Microsoft.Network/stable/2021-06-01/examples/FrontdoorGet.json + // this example is just showing the usage of "FrontDoors_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FrontDoorResource + FrontDoorCollection collection = resourceGroupResource.GetFrontDoors(); + + // invoke the operation + string frontDoorName = "frontDoor1"; + NullableResponse response = await collection.GetIfExistsAsync(frontDoorName); + FrontDoorResource 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 + FrontDoorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update specific Front Door [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorExperimentCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorExperimentCollection.cs index 3e4905dd5bea..1c9ed9bcec0b 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorExperimentCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorExperimentCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsAnExperimentByExperimentName() Console.WriteLine($"Succeeded: {result}"); } + // Gets an Experiment by ExperimentName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAnExperimentByExperimentName() + { + // Generated from example definition: specification/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentGetExperiment.json + // this example is just showing the usage of "Experiments_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 FrontDoorNetworkExperimentProfileResource created on azure + // for more information of creating FrontDoorNetworkExperimentProfileResource, please refer to the document of FrontDoorNetworkExperimentProfileResource + string subscriptionId = "subid"; + string resourceGroupName = "MyResourceGroup"; + string profileName = "MyProfile"; + ResourceIdentifier frontDoorNetworkExperimentProfileResourceId = FrontDoorNetworkExperimentProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + FrontDoorNetworkExperimentProfileResource frontDoorNetworkExperimentProfile = client.GetFrontDoorNetworkExperimentProfileResource(frontDoorNetworkExperimentProfileResourceId); + + // get the collection of this FrontDoorExperimentResource + FrontDoorExperimentCollection collection = frontDoorNetworkExperimentProfile.GetFrontDoorExperiments(); + + // invoke the operation + string experimentName = "MyExperiment"; + NullableResponse response = await collection.GetIfExistsAsync(experimentName); + FrontDoorExperimentResource 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 + FrontDoorExperimentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates an Experiment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorNetworkExperimentProfileCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorNetworkExperimentProfileCollection.cs index 475ad4b69c8f..72e241975a79 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorNetworkExperimentProfileCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorNetworkExperimentProfileCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetsAnNetworkExperimentProfileByProfileId() Console.WriteLine($"Succeeded: {result}"); } + // Gets an NetworkExperiment Profile by Profile Id + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAnNetworkExperimentProfileByProfileId() + { + // Generated from example definition: specification/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentGetProfile.json + // this example is just showing the usage of "NetworkExperimentProfiles_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 = "subid"; + string resourceGroupName = "MyResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FrontDoorNetworkExperimentProfileResource + FrontDoorNetworkExperimentProfileCollection collection = resourceGroupResource.GetFrontDoorNetworkExperimentProfiles(); + + // invoke the operation + string profileName = "MyProfile"; + NullableResponse response = await collection.GetIfExistsAsync(profileName); + FrontDoorNetworkExperimentProfileResource 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 + FrontDoorNetworkExperimentProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates an NetworkExperiment Profile in a Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorRulesEngineCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorRulesEngineCollection.cs index 6c636c59d4a8..b89dc6def958 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorRulesEngineCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorRulesEngineCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetRulesEngineConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get Rules Engine Configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRulesEngineConfiguration() + { + // Generated from example definition: specification/frontdoor/resource-manager/Microsoft.Network/stable/2021-06-01/examples/FrontdoorRulesEngineGet.json + // this example is just showing the usage of "RulesEngines_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 FrontDoorResource created on azure + // for more information of creating FrontDoorResource, please refer to the document of FrontDoorResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string frontDoorName = "frontDoor1"; + ResourceIdentifier frontDoorResourceId = FrontDoorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, frontDoorName); + FrontDoorResource frontDoor = client.GetFrontDoorResource(frontDoorResourceId); + + // get the collection of this FrontDoorRulesEngineResource + FrontDoorRulesEngineCollection collection = frontDoor.GetFrontDoorRulesEngines(); + + // invoke the operation + string rulesEngineName = "rulesEngine1"; + NullableResponse response = await collection.GetIfExistsAsync(rulesEngineName); + FrontDoorRulesEngineResource 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 + FrontDoorRulesEngineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a specific Rules Engine Configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorWebApplicationFirewallPolicyCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorWebApplicationFirewallPolicyCollection.cs index 7d9126293fa7..24937bffdd8e 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorWebApplicationFirewallPolicyCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontDoorWebApplicationFirewallPolicyCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get Policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPolicy() + { + // Generated from example definition: specification/frontdoor/resource-manager/Microsoft.Network/stable/2022-05-01/examples/WafPolicyGet.json + // this example is just showing the usage of "Policies_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FrontDoorWebApplicationFirewallPolicyResource + FrontDoorWebApplicationFirewallPolicyCollection collection = resourceGroupResource.GetFrontDoorWebApplicationFirewallPolicies(); + + // invoke the operation + string policyName = "Policy1"; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + FrontDoorWebApplicationFirewallPolicyResource 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 + FrontDoorWebApplicationFirewallPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates specific policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontendEndpointCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontendEndpointCollection.cs index 655d38e6ab47..d6d38740263e 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontendEndpointCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/samples/Generated/Samples/Sample_FrontendEndpointCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetFrontendEndpoint() Console.WriteLine($"Succeeded: {result}"); } + + // Get Frontend Endpoint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFrontendEndpoint() + { + // Generated from example definition: specification/frontdoor/resource-manager/Microsoft.Network/stable/2021-06-01/examples/FrontdoorFrontendEndpointGet.json + // this example is just showing the usage of "FrontendEndpoints_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 FrontDoorResource created on azure + // for more information of creating FrontDoorResource, please refer to the document of FrontDoorResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string frontDoorName = "frontDoor1"; + ResourceIdentifier frontDoorResourceId = FrontDoorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, frontDoorName); + FrontDoorResource frontDoor = client.GetFrontDoorResource(frontDoorResourceId); + + // get the collection of this FrontendEndpointResource + FrontendEndpointCollection collection = frontDoor.GetFrontendEndpoints(); + + // invoke the operation + string frontendEndpointName = "frontendEndpoint1"; + NullableResponse response = await collection.GetIfExistsAsync(frontendEndpointName); + FrontendEndpointResource 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 + FrontendEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorCollection.cs index cdc2ac9ed831..fb6138c12082 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string frontDoorName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName} + /// + /// + /// Operation Id + /// FrontDoors_Get + /// + /// + /// + /// Name of the Front Door which is globally unique. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string frontDoorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(frontDoorName, nameof(frontDoorName)); + + using var scope = _frontDoorClientDiagnostics.CreateScope("FrontDoorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, frontDoorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorResource(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.Network/frontDoors/{frontDoorName} + /// + /// + /// Operation Id + /// FrontDoors_Get + /// + /// + /// + /// Name of the Front Door which is globally unique. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string frontDoorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(frontDoorName, nameof(frontDoorName)); + + using var scope = _frontDoorClientDiagnostics.CreateScope("FrontDoorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, frontDoorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorExperimentCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorExperimentCollection.cs index ca20ac52a00d..f88973b97736 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorExperimentCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorExperimentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string experimentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName} + /// + /// + /// Operation Id + /// Experiments_Get + /// + /// + /// + /// The Experiment identifier associated with the Experiment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string experimentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(experimentName, nameof(experimentName)); + + using var scope = _frontDoorExperimentExperimentsClientDiagnostics.CreateScope("FrontDoorExperimentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorExperimentExperimentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, experimentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorExperimentResource(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.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName} + /// + /// + /// Operation Id + /// Experiments_Get + /// + /// + /// + /// The Experiment identifier associated with the Experiment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string experimentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(experimentName, nameof(experimentName)); + + using var scope = _frontDoorExperimentExperimentsClientDiagnostics.CreateScope("FrontDoorExperimentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorExperimentExperimentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, experimentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorExperimentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileCollection.cs index 063f9fd1791c..ce87011280b3 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string profileName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName} + /// + /// + /// Operation Id + /// NetworkExperimentProfiles_Get + /// + /// + /// + /// The Profile identifier associated with the Tenant and Partner. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string profileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); + + using var scope = _frontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics.CreateScope("FrontDoorNetworkExperimentProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, profileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorNetworkExperimentProfileResource(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.Network/NetworkExperimentProfiles/{profileName} + /// + /// + /// Operation Id + /// NetworkExperimentProfiles_Get + /// + /// + /// + /// The Profile identifier associated with the Tenant and Partner. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string profileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); + + using var scope = _frontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics.CreateScope("FrontDoorNetworkExperimentProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, profileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorNetworkExperimentProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorRulesEngineCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorRulesEngineCollection.cs index 01f1076ed288..c7200138efe6 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorRulesEngineCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorRulesEngineCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string rulesEngineName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName} + /// + /// + /// Operation Id + /// RulesEngines_Get + /// + /// + /// + /// Name of the Rules Engine which is unique within the Front Door. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string rulesEngineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rulesEngineName, nameof(rulesEngineName)); + + using var scope = _frontDoorRulesEngineRulesEnginesClientDiagnostics.CreateScope("FrontDoorRulesEngineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorRulesEngineRulesEnginesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesEngineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorRulesEngineResource(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.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName} + /// + /// + /// Operation Id + /// RulesEngines_Get + /// + /// + /// + /// Name of the Rules Engine which is unique within the Front Door. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string rulesEngineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rulesEngineName, nameof(rulesEngineName)); + + using var scope = _frontDoorRulesEngineRulesEnginesClientDiagnostics.CreateScope("FrontDoorRulesEngineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorRulesEngineRulesEnginesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesEngineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorRulesEngineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorWebApplicationFirewallPolicyCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorWebApplicationFirewallPolicyCollection.cs index 2ce2b535d4b0..c37a55e27bf0 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorWebApplicationFirewallPolicyCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorWebApplicationFirewallPolicyCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string policyName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the Web Application Firewall Policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _frontDoorWebApplicationFirewallPolicyPoliciesClientDiagnostics.CreateScope("FrontDoorWebApplicationFirewallPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorWebApplicationFirewallPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorWebApplicationFirewallPolicyResource(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.Network/FrontDoorWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the Web Application Firewall Policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _frontDoorWebApplicationFirewallPolicyPoliciesClientDiagnostics.CreateScope("FrontDoorWebApplicationFirewallPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorWebApplicationFirewallPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorWebApplicationFirewallPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontendEndpointCollection.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontendEndpointCollection.cs index b8a77743122e..31536fd3a729 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontendEndpointCollection.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontendEndpointCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string frontendEndpointName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName} + /// + /// + /// Operation Id + /// FrontendEndpoints_Get + /// + /// + /// + /// Name of the Frontend endpoint which is unique within the Front Door. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string frontendEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(frontendEndpointName, nameof(frontendEndpointName)); + + using var scope = _frontendEndpointClientDiagnostics.CreateScope("FrontendEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontendEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, frontendEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontendEndpointResource(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.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName} + /// + /// + /// Operation Id + /// FrontendEndpoints_Get + /// + /// + /// + /// Name of the Frontend endpoint which is unique within the Front Door. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string frontendEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(frontendEndpointName, nameof(frontendEndpointName)); + + using var scope = _frontendEndpointClientDiagnostics.CreateScope("FrontendEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontendEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, frontendEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontendEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_GrafanaPrivateEndpointConnectionCollection.cs b/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_GrafanaPrivateEndpointConnectionCollection.cs index 680490936508..462663d5a204 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_GrafanaPrivateEndpointConnectionCollection.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_GrafanaPrivateEndpointConnectionCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_PrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2022-08-01/examples/PrivateEndpointConnections_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 ManagedGrafanaResource created on azure + // for more information of creating ManagedGrafanaResource, please refer to the document of ManagedGrafanaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + ResourceIdentifier managedGrafanaResourceId = ManagedGrafanaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + ManagedGrafanaResource managedGrafana = client.GetManagedGrafanaResource(managedGrafanaResourceId); + + // get the collection of this GrafanaPrivateEndpointConnectionResource + GrafanaPrivateEndpointConnectionCollection collection = managedGrafana.GetGrafanaPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + GrafanaPrivateEndpointConnectionResource 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 + GrafanaPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_Approve [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_GrafanaPrivateLinkResourceCollection.cs b/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_GrafanaPrivateLinkResourceCollection.cs index f3e4d9c73e11..7a05062e608c 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_GrafanaPrivateLinkResourceCollection.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_GrafanaPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_PrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2022-08-01/examples/PrivateLinkResources_Get.json + // this example is just showing the usage of "PrivateLinkResources_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 ManagedGrafanaResource created on azure + // for more information of creating ManagedGrafanaResource, please refer to the document of ManagedGrafanaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + ResourceIdentifier managedGrafanaResourceId = ManagedGrafanaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + ManagedGrafanaResource managedGrafana = client.GetManagedGrafanaResource(managedGrafanaResourceId); + + // get the collection of this GrafanaPrivateLinkResource + GrafanaPrivateLinkResourceCollection collection = managedGrafana.GetGrafanaPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "grafana"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + GrafanaPrivateLinkResource 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 + GrafanaPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_ManagedGrafanaCollection.cs b/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_ManagedGrafanaCollection.cs index c4e59e96af6f..d534c2e796ee 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_ManagedGrafanaCollection.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/samples/Generated/Samples/Sample_ManagedGrafanaCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GrafanaGet() Console.WriteLine($"Succeeded: {result}"); } + // Grafana_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GrafanaGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2022-08-01/examples/Grafana_Get.json + // this example is just showing the usage of "Grafana_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedGrafanaResource + ManagedGrafanaCollection collection = resourceGroupResource.GetManagedGrafanas(); + + // invoke the operation + string workspaceName = "myWorkspace"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + ManagedGrafanaResource 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 + ManagedGrafanaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Grafana_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateEndpointConnectionCollection.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateEndpointConnectionCollection.cs index c868f8745ffb..41c54d14487f 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateEndpointConnectionCollection.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The private endpoint connection name of Azure Managed Grafana. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _grafanaPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("GrafanaPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _grafanaPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GrafanaPrivateEndpointConnectionResource(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.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The private endpoint connection name of Azure Managed Grafana. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _grafanaPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("GrafanaPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _grafanaPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GrafanaPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateLinkResourceCollection.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateLinkResourceCollection.cs index 6c27426d0a0b..514eccf54c76 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateLinkResourceCollection.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _grafanaPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("GrafanaPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _grafanaPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GrafanaPrivateLinkResource(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.Dashboard/grafana/{workspaceName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _grafanaPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("GrafanaPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _grafanaPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GrafanaPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaCollection.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaCollection.cs index cb33119a3a3a..df75c7dd89dd 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaCollection.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedGrafanaGrafanaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedGrafanaResource(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.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedGrafanaGrafanaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedGrafanaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/samples/Generated/Samples/Sample_GraphServicesAccountResourceCollection.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/samples/Generated/Samples/Sample_GraphServicesAccountResourceCollection.cs index f5b4ceec5021..8ab74cfc9b14 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/samples/Generated/Samples/Sample_GraphServicesAccountResourceCollection.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/samples/Generated/Samples/Sample_GraphServicesAccountResourceCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetAccounts() Console.WriteLine($"Succeeded: {result}"); } + // Get accounts + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAccounts() + { + // Generated from example definition: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/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 = "testResourceGroupGRAM"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GraphServicesAccountResource + GraphServicesAccountResourceCollection collection = resourceGroupResource.GetGraphServicesAccountResources(); + + // invoke the operation + string resourceName = "11111111-aaaa-1111-bbbb-111111111111"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + GraphServicesAccountResource 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 + GraphServicesAccountResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Account resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResourceCollection.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResourceCollection.cs index 69039ebf6d63..6db1d09db8b4 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResourceCollection.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _graphServicesAccountResourceAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GraphServicesAccountResource(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.GraphServices/accounts/{resourceName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _graphServicesAccountResourceAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GraphServicesAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentCollection.cs index 3e50d0d779e9..73b05e013d5e 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentCollection.cs @@ -142,6 +142,48 @@ public async Task Exists_GetAGuestConfigurationAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get a guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json + // this example is just showing the usage of "GuestConfigurationHCRPAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationHcrpAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string machineName = "myMachineName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.HybridCompute/machines/{2}", subscriptionId, resourceGroupName, machineName)); + GuestConfigurationHcrpAssignmentCollection collection = client.GetGuestConfigurationHcrpAssignments(scopeId); + + // invoke the operation + string guestConfigurationAssignmentName = "SecureProtocol"; + NullableResponse response = await collection.GetIfExistsAsync(guestConfigurationAssignmentName); + GuestConfigurationHcrpAssignmentResource 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 + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all guest configuration assignments for a virtual machine [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentCollection.cs index 27c2610c3478..7c37953a8603 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentCollection.cs @@ -142,6 +142,48 @@ public async Task Exists_GetAGuestConfigurationAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get a guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json + // this example is just showing the usage of "GuestConfigurationAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationVmAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualMachines/{2}", subscriptionId, resourceGroupName, vmName)); + GuestConfigurationVmAssignmentCollection collection = client.GetGuestConfigurationVmAssignments(scopeId); + + // invoke the operation + string guestConfigurationAssignmentName = "SecureProtocol"; + NullableResponse response = await collection.GetIfExistsAsync(guestConfigurationAssignmentName); + GuestConfigurationVmAssignmentResource 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 + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all guest configuration assignments for a virtual machine [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentCollection.cs index f282a0a9964e..2bbbbcd1b6c2 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -80,6 +81,48 @@ public async Task Exists_GetAVMSSGuestConfigurationAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get a VMSS guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVMSSGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json + // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationVmssAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmssName = "myVMSSName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualMachineScaleSets/{2}", subscriptionId, resourceGroupName, vmssName)); + GuestConfigurationVmssAssignmentCollection collection = client.GetGuestConfigurationVmssAssignments(scopeId); + + // invoke the operation + string name = "SecureProtocol"; + NullableResponse response = await collection.GetIfExistsAsync(name); + GuestConfigurationVmssAssignmentResource 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 + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all guest configuration assignments for VMSS [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentCollection.cs index 28a16d14eb62..c6ca0dae7733 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string guestConfigurationAssignmentName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationHCRPAssignments_Get + /// + /// + /// + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationHcrpAssignmentGuestConfigurationHcrpAssignmentsClientDiagnostics.CreateScope("GuestConfigurationHcrpAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _guestConfigurationHcrpAssignmentGuestConfigurationHcrpAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationHcrpAssignmentResource(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.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationHCRPAssignments_Get + /// + /// + /// + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationHcrpAssignmentGuestConfigurationHcrpAssignmentsClientDiagnostics.CreateScope("GuestConfigurationHcrpAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _guestConfigurationHcrpAssignmentGuestConfigurationHcrpAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationHcrpAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentCollection.cs index 0bad696da3d4..b91a8f5e7dc2 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string guestConfigurationAssignmentName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationAssignments_Get + /// + /// + /// + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVmAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVmAssignmentResource(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.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationAssignments_Get + /// + /// + /// + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVmAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVmAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentCollection.cs index a1de5f2e53c3..0bd6ff1f2aaa 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name} + /// + /// + /// Operation Id + /// GuestConfigurationAssignmentsVMSS_Get + /// + /// + /// + /// The guest configuration assignment name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSClientDiagnostics.CreateScope("GuestConfigurationVmssAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVmssAssignmentResource(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.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name} + /// + /// + /// Operation Id + /// GuestConfigurationAssignmentsVMSS_Get + /// + /// + /// + /// The guest configuration assignment name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSClientDiagnostics.CreateScope("GuestConfigurationVmssAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVmssAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_CloudHsmClusterCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_CloudHsmClusterCollection.cs index e03608d78609..f2f20a7cda2f 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_CloudHsmClusterCollection.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_CloudHsmClusterCollection.cs @@ -131,6 +131,48 @@ public async Task Exists_CloudHsmClusterGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // CloudHsmCluster_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CloudHsmClusterGetMaximumSetGen() + { + // Generated from example definition: specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2022-08-31-preview/examples/CloudHsmCluster_Get_MaximumSet_Gen.json + // this example is just showing the usage of "CloudHsmClusters_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 = "rgcloudhsm"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CloudHsmClusterResource + CloudHsmClusterCollection collection = resourceGroupResource.GetCloudHsmClusters(); + + // invoke the operation + string cloudHsmClusterName = "chsm1"; + NullableResponse response = await collection.GetIfExistsAsync(cloudHsmClusterName); + CloudHsmClusterResource 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 + CloudHsmClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_DedicatedHsmCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_DedicatedHsmCollection.cs index ff8084b4e563..da59083f8967 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_DedicatedHsmCollection.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_DedicatedHsmCollection.cs @@ -262,6 +262,48 @@ public async Task Exists_GetADedicatedHSM() Console.WriteLine($"Succeeded: {result}"); } + // Get a dedicated HSM + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADedicatedHSM() + { + // Generated from example definition: specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/DedicatedHsm_Get.json + // this example is just showing the usage of "DedicatedHsm_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 = "hsm-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DedicatedHsmResource + DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms(); + + // invoke the operation + string name = "hsm1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DedicatedHsmResource 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 + DedicatedHsmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a payment HSM [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -326,6 +368,48 @@ public async Task Exists_GetAPaymentHSM() Console.WriteLine($"Succeeded: {result}"); } + // Get a payment HSM + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPaymentHSM() + { + // Generated from example definition: specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get.json + // this example is just showing the usage of "DedicatedHsm_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 = "hsm-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DedicatedHsmResource + DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms(); + + // invoke the operation + string name = "hsm1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DedicatedHsmResource 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 + DedicatedHsmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a payment HSM with 2018-10-31Preview api version [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -390,6 +474,48 @@ public async Task Exists_GetAPaymentHSMWith20181031PreviewApiVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get a payment HSM with 2018-10-31Preview api version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPaymentHSMWith20181031PreviewApiVersion() + { + // Generated from example definition: specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json + // this example is just showing the usage of "DedicatedHsm_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 = "hsm-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DedicatedHsmResource + DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms(); + + // invoke the operation + string name = "hsm1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DedicatedHsmResource 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 + DedicatedHsmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List dedicated HSM devices in a resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_HardwareSecurityModulesPrivateEndpointConnectionCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_HardwareSecurityModulesPrivateEndpointConnectionCollection.cs index b62378a62b00..677b85b042a9 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_HardwareSecurityModulesPrivateEndpointConnectionCollection.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/samples/Generated/Samples/Sample_HardwareSecurityModulesPrivateEndpointConnectionCollection.cs @@ -128,6 +128,49 @@ public async Task Exists_CloudHsmClusterPrivateEndpointConnectionGetMaximumSetGe Console.WriteLine($"Succeeded: {result}"); } + // CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CloudHsmClusterPrivateEndpointConnectionGetMaximumSetGen() + { + // Generated from example definition: specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2022-08-31-preview/examples/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json + // this example is just showing the usage of "CloudHsmClusterPrivateEndpointConnections_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 CloudHsmClusterResource created on azure + // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rgcloudhsm"; + string cloudHsmClusterName = "chsm1"; + ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName); + CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId); + + // get the collection of this HardwareSecurityModulesPrivateEndpointConnectionResource + HardwareSecurityModulesPrivateEndpointConnectionCollection collection = cloudHsmCluster.GetHardwareSecurityModulesPrivateEndpointConnections(); + + // invoke the operation + string peConnectionName = "sample-pec"; + NullableResponse response = await collection.GetIfExistsAsync(peConnectionName); + HardwareSecurityModulesPrivateEndpointConnectionResource 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 + HardwareSecurityModulesPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CloudHsmClusterPrivateEndpointConnection_ListByResource_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterCollection.cs index ef895e9722e9..318882bf985c 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterCollection.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string cloudHsmClusterName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName} + /// + /// + /// Operation Id + /// CloudHsmClusters_Get + /// + /// + /// + /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 24 characters in length. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string cloudHsmClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName)); + + using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cloudHsmClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudHsmClusterResource(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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName} + /// + /// + /// Operation Id + /// CloudHsmClusters_Get + /// + /// + /// + /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 24 characters in length. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string cloudHsmClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName)); + + using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cloudHsmClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudHsmClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/DedicatedHsmCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/DedicatedHsmCollection.cs index 7442dfba44da..1abd2c3b5c71 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/DedicatedHsmCollection.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/DedicatedHsmCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name} + /// + /// + /// Operation Id + /// DedicatedHsm_Get + /// + /// + /// + /// The name of the dedicated HSM. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dedicatedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DedicatedHsmResource(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.HardwareSecurityModules/dedicatedHSMs/{name} + /// + /// + /// Operation Id + /// DedicatedHsm_Get + /// + /// + /// + /// The name of the dedicated HSM. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dedicatedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DedicatedHsmResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/HardwareSecurityModulesPrivateEndpointConnectionCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/HardwareSecurityModulesPrivateEndpointConnectionCollection.cs index f76015076ddc..78d0c222a515 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/HardwareSecurityModulesPrivateEndpointConnectionCollection.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/HardwareSecurityModulesPrivateEndpointConnectionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string peConnectionName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName} + /// + /// + /// Operation Id + /// CloudHsmClusterPrivateEndpointConnections_Get + /// + /// + /// + /// Name of the private endpoint connection associated with the Cloud HSM Cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string peConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName)); + + using var scope = _hardwareSecurityModulesPrivateEndpointConnectionCloudHsmClusterPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwareSecurityModulesPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hardwareSecurityModulesPrivateEndpointConnectionCloudHsmClusterPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HardwareSecurityModulesPrivateEndpointConnectionResource(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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName} + /// + /// + /// Operation Id + /// CloudHsmClusterPrivateEndpointConnections_Get + /// + /// + /// + /// Name of the private endpoint connection associated with the Cloud HSM Cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string peConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName)); + + using var scope = _hardwareSecurityModulesPrivateEndpointConnectionCloudHsmClusterPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwareSecurityModulesPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hardwareSecurityModulesPrivateEndpointConnectionCloudHsmClusterPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HardwareSecurityModulesPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/samples/Generated/Samples/Sample_HDInsightClusterCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/samples/Generated/Samples/Sample_HDInsightClusterCollection.cs index 71d3c7ee13e4..85520feffa64 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/samples/Generated/Samples/Sample_HDInsightClusterCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/samples/Generated/Samples/Sample_HDInsightClusterCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_HDInsightClusterGet() Console.WriteLine($"Succeeded: {result}"); } + // HDInsightClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HDInsightClusterGet() + { + // Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetCluster.json + // this example is just showing the usage of "Clusters_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 HDInsightClusterPoolResource created on azure + // for more information of creating HDInsightClusterPoolResource, please refer to the document of HDInsightClusterPoolResource + string subscriptionId = "10e32bab-26da-4cc4-a441-52b318f824e6"; + string resourceGroupName = "hiloResourcegroup"; + string clusterPoolName = "clusterpool1"; + ResourceIdentifier hdInsightClusterPoolResourceId = HDInsightClusterPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterPoolName); + HDInsightClusterPoolResource hdInsightClusterPool = client.GetHDInsightClusterPoolResource(hdInsightClusterPoolResourceId); + + // get the collection of this HDInsightClusterResource + HDInsightClusterCollection collection = hdInsightClusterPool.GetHDInsightClusters(); + + // invoke the operation + string clusterName = "cluster1"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + HDInsightClusterResource 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 + HDInsightClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HDInsightClusterPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/samples/Generated/Samples/Sample_HDInsightClusterPoolCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/samples/Generated/Samples/Sample_HDInsightClusterPoolCollection.cs index 501917e86f2e..a4de0b3bb9cf 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/samples/Generated/Samples/Sample_HDInsightClusterPoolCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/samples/Generated/Samples/Sample_HDInsightClusterPoolCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_ClusterPoolGet() Console.WriteLine($"Succeeded: {result}"); } + // ClusterPoolGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ClusterPoolGet() + { + // Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterPool.json + // this example is just showing the usage of "ClusterPools_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 = "10e32bab-26da-4cc4-a441-52b318f824e6"; + string resourceGroupName = "hiloResourcegroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HDInsightClusterPoolResource + HDInsightClusterPoolCollection collection = resourceGroupResource.GetHDInsightClusterPools(); + + // invoke the operation + string clusterPoolName = "clusterpool1"; + NullableResponse response = await collection.GetIfExistsAsync(clusterPoolName); + HDInsightClusterPoolResource 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 + HDInsightClusterPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ClusterPoolPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterCollection.cs index 01f580e36032..f2e7f1ad48ee 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the HDInsight cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _hdInsightClusterClustersClientDiagnostics.CreateScope("HDInsightClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hdInsightClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightClusterResource(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.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the HDInsight cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _hdInsightClusterClustersClientDiagnostics.CreateScope("HDInsightClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hdInsightClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolCollection.cs index 5fa6365d5b62..f9ce48781b3a 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterPoolName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName} + /// + /// + /// Operation Id + /// ClusterPools_Get + /// + /// + /// + /// The name of the cluster pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterPoolName, nameof(clusterPoolName)); + + using var scope = _hdInsightClusterPoolClusterPoolsClientDiagnostics.CreateScope("HDInsightClusterPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hdInsightClusterPoolClusterPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightClusterPoolResource(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.HDInsight/clusterpools/{clusterPoolName} + /// + /// + /// Operation Id + /// ClusterPools_Get + /// + /// + /// + /// The name of the cluster pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterPoolName, nameof(clusterPoolName)); + + using var scope = _hdInsightClusterPoolClusterPoolsClientDiagnostics.CreateScope("HDInsightClusterPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hdInsightClusterPoolClusterPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightClusterPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightApplicationCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightApplicationCollection.cs index be9b026e4ad5..1c4d1493772d 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightApplicationCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightApplicationCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetApplicationOnHDInsightClusterCreationInProgress() Console.WriteLine($"Succeeded: {result}"); } + // Get application on HDInsight cluster creation in progress + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetApplicationOnHDInsightClusterCreationInProgress() + { + // Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetApplicationInProgress.json + // this example is just showing the usage of "Applications_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 HDInsightClusterResource created on azure + // for more information of creating HDInsightClusterResource, please refer to the document of HDInsightClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string clusterName = "cluster1"; + ResourceIdentifier hdInsightClusterResourceId = HDInsightClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + HDInsightClusterResource hdInsightCluster = client.GetHDInsightClusterResource(hdInsightClusterResourceId); + + // get the collection of this HDInsightApplicationResource + HDInsightApplicationCollection collection = hdInsightCluster.GetHDInsightApplications(); + + // invoke the operation + string applicationName = "app"; + NullableResponse response = await collection.GetIfExistsAsync(applicationName); + HDInsightApplicationResource 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 + HDInsightApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get application on HDInsight cluster successfully created. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_GetApplicationOnHDInsightClusterSuccessfullyCreated() Console.WriteLine($"Succeeded: {result}"); } + // Get application on HDInsight cluster successfully created. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetApplicationOnHDInsightClusterSuccessfullyCreated() + { + // Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetApplicationCreated.json + // this example is just showing the usage of "Applications_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 HDInsightClusterResource created on azure + // for more information of creating HDInsightClusterResource, please refer to the document of HDInsightClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string clusterName = "cluster1"; + ResourceIdentifier hdInsightClusterResourceId = HDInsightClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + HDInsightClusterResource hdInsightCluster = client.GetHDInsightClusterResource(hdInsightClusterResourceId); + + // get the collection of this HDInsightApplicationResource + HDInsightApplicationCollection collection = hdInsightCluster.GetHDInsightApplications(); + + // invoke the operation + string applicationName = "app"; + NullableResponse response = await collection.GetIfExistsAsync(applicationName); + HDInsightApplicationResource 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 + HDInsightApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Application [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightClusterCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightClusterCollection.cs index fd6b77c966b3..d0edbfa8e785 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightClusterCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightClusterCollection.cs @@ -1674,6 +1674,48 @@ public async Task Exists_GetHadoopOnLinuxCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get Hadoop on Linux cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetHadoopOnLinuxCluster() + { + // Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopCluster.json + // this example is just showing the usage of "Clusters_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HDInsightClusterResource + HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters(); + + // invoke the operation + string clusterName = "cluster1"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + HDInsightClusterResource 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 + HDInsightClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Spark on Linux cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1738,6 +1780,48 @@ public async Task Exists_GetSparkOnLinuxCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get Spark on Linux cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSparkOnLinuxCluster() + { + // Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxSparkCluster.json + // this example is just showing the usage of "Clusters_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HDInsightClusterResource + HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters(); + + // invoke the operation + string clusterName = "cluster1"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + HDInsightClusterResource 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 + HDInsightClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get All Hadoop on Linux clusters in a resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightPrivateEndpointConnectionCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightPrivateEndpointConnectionCollection.cs index ea9a53d8ad8a..978d101b5e3f 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightPrivateEndpointConnectionCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightPrivateEndpointConnectionCollection.cs @@ -161,5 +161,48 @@ public async Task Exists_GetSpecificPrivateEndpointConnectionForASpecificHDInsig Console.WriteLine($"Succeeded: {result}"); } + + // Get specific private endpoint connection for a specific HDInsight cluster. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSpecificPrivateEndpointConnectionForASpecificHDInsightCluster() + { + // Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 HDInsightClusterResource created on azure + // for more information of creating HDInsightClusterResource, please refer to the document of HDInsightClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string clusterName = "cluster1"; + ResourceIdentifier hdInsightClusterResourceId = HDInsightClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + HDInsightClusterResource hdInsightCluster = client.GetHDInsightClusterResource(hdInsightClusterResourceId); + + // get the collection of this HDInsightPrivateEndpointConnectionResource + HDInsightPrivateEndpointConnectionCollection collection = hdInsightCluster.GetHDInsightPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + HDInsightPrivateEndpointConnectionResource 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 + HDInsightPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightPrivateLinkResourceCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightPrivateLinkResourceCollection.cs index fc5f642075cc..c1471cc71ac3 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightPrivateLinkResourceCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/samples/Generated/Samples/Sample_HDInsightPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetSpecificPrivateLinkResourceInASpecificHDInsightClust Console.WriteLine($"Succeeded: {result}"); } + + // Get specific private link resource in a specific HDInsight cluster. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSpecificPrivateLinkResourceInASpecificHDInsightCluster() + { + // Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetPrivateLinkResource.json + // this example is just showing the usage of "PrivateLinkResources_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 HDInsightClusterResource created on azure + // for more information of creating HDInsightClusterResource, please refer to the document of HDInsightClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string clusterName = "cluster1"; + ResourceIdentifier hdInsightClusterResourceId = HDInsightClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + HDInsightClusterResource hdInsightCluster = client.GetHDInsightClusterResource(hdInsightClusterResourceId); + + // get the collection of this HDInsightPrivateLinkResource + HDInsightPrivateLinkResourceCollection collection = hdInsightCluster.GetHDInsightPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "gateway"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + HDInsightPrivateLinkResource 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 + HDInsightPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightApplicationCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightApplicationCollection.cs index 94a691d36ff7..e0e8e4fc9a4a 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightApplicationCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightApplicationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string applicationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The constant value for the application name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _hdInsightApplicationApplicationsClientDiagnostics.CreateScope("HDInsightApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hdInsightApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightApplicationResource(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.HDInsight/clusters/{clusterName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The constant value for the application name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _hdInsightApplicationApplicationsClientDiagnostics.CreateScope("HDInsightApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hdInsightApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterCollection.cs index bd6deb572786..5c73bfda0bfe 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _hdInsightClusterClustersClientDiagnostics.CreateScope("HDInsightClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hdInsightClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightClusterResource(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.HDInsight/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _hdInsightClusterClustersClientDiagnostics.CreateScope("HDInsightClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hdInsightClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateEndpointConnectionCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateEndpointConnectionCollection.cs index 3356c9eef44f..44931181a0af 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateEndpointConnectionCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _hdInsightPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HDInsightPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hdInsightPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightPrivateEndpointConnectionResource(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.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _hdInsightPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HDInsightPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hdInsightPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateLinkResourceCollection.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateLinkResourceCollection.cs index 30fc649ffc7a..6240711828ae 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateLinkResourceCollection.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _hdInsightPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("HDInsightPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hdInsightPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightPrivateLinkResource(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.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _hdInsightPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("HDInsightPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hdInsightPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HDInsightPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/samples/Generated/Samples/Sample_HealthBotCollection.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/samples/Generated/Samples/Sample_HealthBotCollection.cs index bd889d196bdd..27db58f9c86d 100644 --- a/sdk/healthbot/Azure.ResourceManager.HealthBot/samples/Generated/Samples/Sample_HealthBotCollection.cs +++ b/sdk/healthbot/Azure.ResourceManager.HealthBot/samples/Generated/Samples/Sample_HealthBotCollection.cs @@ -130,6 +130,48 @@ public async Task Exists_ResourceInfoGet() Console.WriteLine($"Succeeded: {result}"); } + // ResourceInfoGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ResourceInfoGet() + { + // Generated from example definition: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-08-24/examples/ResourceInfoGet.json + // this example is just showing the usage of "Bots_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 = "subid"; + string resourceGroupName = "healthbotClient"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HealthBotResource + HealthBotCollection collection = resourceGroupResource.GetHealthBots(); + + // invoke the operation + string botName = "samplebotname"; + NullableResponse response = await collection.GetIfExistsAsync(botName); + HealthBotResource 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 + HealthBotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Bots by Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/HealthBotCollection.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/HealthBotCollection.cs index 3bfb3e3e7c62..576b755142c9 100644 --- a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/HealthBotCollection.cs +++ b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/HealthBotCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string botName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName} + /// + /// + /// Operation Id + /// Bots_Get + /// + /// + /// + /// The name of the Bot 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 botName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(botName, nameof(botName)); + + using var scope = _healthBotBotsClientDiagnostics.CreateScope("HealthBotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthBotBotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, botName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthBotResource(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.HealthBot/healthBots/{botName} + /// + /// + /// Operation Id + /// Bots_Get + /// + /// + /// + /// The name of the Bot resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string botName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(botName, nameof(botName)); + + using var scope = _healthBotBotsClientDiagnostics.CreateScope("HealthBotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthBotBotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, botName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthBotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_DicomServiceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_DicomServiceCollection.cs index d9e63d056546..964cc7990b46 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_DicomServiceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_DicomServiceCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetADicomservice() Console.WriteLine($"Succeeded: {result}"); } + // Get a dicomservice + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADicomservice() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/dicomservices/DicomServices_Get.json + // this example is just showing the usage of "DicomServices_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 HealthcareApisWorkspaceResource created on azure + // for more information of creating HealthcareApisWorkspaceResource, please refer to the document of HealthcareApisWorkspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "testRG"; + string workspaceName = "workspace1"; + ResourceIdentifier healthcareApisWorkspaceResourceId = HealthcareApisWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + HealthcareApisWorkspaceResource healthcareApisWorkspace = client.GetHealthcareApisWorkspaceResource(healthcareApisWorkspaceResourceId); + + // get the collection of this DicomServiceResource + DicomServiceCollection collection = healthcareApisWorkspace.GetDicomServices(); + + // invoke the operation + string dicomServiceName = "blue"; + NullableResponse response = await collection.GetIfExistsAsync(dicomServiceName); + DicomServiceResource 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 + DicomServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a Dicom Service [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_FhirServiceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_FhirServiceCollection.cs index f1a1800b1706..284236a079c8 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_FhirServiceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_FhirServiceCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetAFhirService() Console.WriteLine($"Succeeded: {result}"); } + // Get a Fhir Service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAFhirService() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/fhirservices/FhirServices_Get.json + // this example is just showing the usage of "FhirServices_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 HealthcareApisWorkspaceResource created on azure + // for more information of creating HealthcareApisWorkspaceResource, please refer to the document of HealthcareApisWorkspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "testRG"; + string workspaceName = "workspace1"; + ResourceIdentifier healthcareApisWorkspaceResourceId = HealthcareApisWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + HealthcareApisWorkspaceResource healthcareApisWorkspace = client.GetHealthcareApisWorkspaceResource(healthcareApisWorkspaceResourceId); + + // get the collection of this FhirServiceResource + FhirServiceCollection collection = healthcareApisWorkspace.GetFhirServices(); + + // invoke the operation + string fhirServiceName = "fhirservices1"; + NullableResponse response = await collection.GetIfExistsAsync(fhirServiceName); + FhirServiceResource 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 + FhirServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a Fhir Service [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisIotConnectorCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisIotConnectorCollection.cs index 0e2fd138d934..2d0b93614529 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisIotConnectorCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisIotConnectorCollection.cs @@ -123,6 +123,49 @@ public async Task Exists_GetAnIoTConnector() Console.WriteLine($"Succeeded: {result}"); } + // Get an IoT Connector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnIoTConnector() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/iotconnectors/iotconnector_Get.json + // this example is just showing the usage of "IotConnectors_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 HealthcareApisWorkspaceResource created on azure + // for more information of creating HealthcareApisWorkspaceResource, please refer to the document of HealthcareApisWorkspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "testRG"; + string workspaceName = "workspace1"; + ResourceIdentifier healthcareApisWorkspaceResourceId = HealthcareApisWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + HealthcareApisWorkspaceResource healthcareApisWorkspace = client.GetHealthcareApisWorkspaceResource(healthcareApisWorkspaceResourceId); + + // get the collection of this HealthcareApisIotConnectorResource + HealthcareApisIotConnectorCollection collection = healthcareApisWorkspace.GetHealthcareApisIotConnectors(); + + // invoke the operation + string iotConnectorName = "blue"; + NullableResponse response = await collection.GetIfExistsAsync(iotConnectorName); + HealthcareApisIotConnectorResource 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 + HealthcareApisIotConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create an IoT Connector [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisIotFhirDestinationCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisIotFhirDestinationCollection.cs index 11df2585fb73..add57bb49b71 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisIotFhirDestinationCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisIotFhirDestinationCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_GetAnIoTConnectorDestination() Console.WriteLine($"Succeeded: {result}"); } + // Get an IoT Connector destination + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnIoTConnectorDestination() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/iotconnectors/iotconnector_fhirdestination_Get.json + // this example is just showing the usage of "IotConnectorFhirDestination_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 HealthcareApisIotConnectorResource created on azure + // for more information of creating HealthcareApisIotConnectorResource, please refer to the document of HealthcareApisIotConnectorResource + string subscriptionId = "subid"; + string resourceGroupName = "testRG"; + string workspaceName = "workspace1"; + string iotConnectorName = "blue"; + ResourceIdentifier healthcareApisIotConnectorResourceId = HealthcareApisIotConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, iotConnectorName); + HealthcareApisIotConnectorResource healthcareApisIotConnector = client.GetHealthcareApisIotConnectorResource(healthcareApisIotConnectorResourceId); + + // get the collection of this HealthcareApisIotFhirDestinationResource + HealthcareApisIotFhirDestinationCollection collection = healthcareApisIotConnector.GetHealthcareApisIotFhirDestinations(); + + // invoke the operation + string fhirDestinationName = "dest1"; + NullableResponse response = await collection.GetIfExistsAsync(fhirDestinationName); + HealthcareApisIotFhirDestinationResource 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 + HealthcareApisIotFhirDestinationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update an Iot Connector FHIR destination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServiceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServiceCollection.cs index 6c74423aec14..a3d1cac3063f 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServiceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServiceCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetMetadata() Console.WriteLine($"Succeeded: {result}"); } + // Get metadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMetadata() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/legacy/ServiceGet.json + // this example is just showing the usage of "Services_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HealthcareApisServiceResource + HealthcareApisServiceCollection collection = resourceGroupResource.GetHealthcareApisServices(); + + // invoke the operation + string resourceName = "service1"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + HealthcareApisServiceResource 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 + HealthcareApisServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update a service with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServicePrivateEndpointConnectionCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServicePrivateEndpointConnectionCollection.cs index 9e793aa2da0e..b426fa2c8c42 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServicePrivateEndpointConnectionCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServicePrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PrivateEndpointConnectionGetConnection() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnection_GetConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionGetConnection() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/legacy/ServiceGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 HealthcareApisServiceResource created on azure + // for more information of creating HealthcareApisServiceResource, please refer to the document of HealthcareApisServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rgname"; + string resourceName = "service1"; + ResourceIdentifier healthcareApisServiceResourceId = HealthcareApisServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + HealthcareApisServiceResource healthcareApisService = client.GetHealthcareApisServiceResource(healthcareApisServiceResourceId); + + // get the collection of this HealthcareApisServicePrivateEndpointConnectionResource + HealthcareApisServicePrivateEndpointConnectionCollection collection = healthcareApisService.GetHealthcareApisServicePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + HealthcareApisServicePrivateEndpointConnectionResource 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 + HealthcareApisPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnection_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServicePrivateLinkResourceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServicePrivateLinkResourceCollection.cs index 7337c4deb727..874546d628b3 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServicePrivateLinkResourceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisServicePrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_PrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/legacy/PrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_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 HealthcareApisServiceResource created on azure + // for more information of creating HealthcareApisServiceResource, please refer to the document of HealthcareApisServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rgname"; + string resourceName = "service1"; + ResourceIdentifier healthcareApisServiceResourceId = HealthcareApisServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + HealthcareApisServiceResource healthcareApisService = client.GetHealthcareApisServiceResource(healthcareApisServiceResourceId); + + // get the collection of this HealthcareApisServicePrivateLinkResource + HealthcareApisServicePrivateLinkResourceCollection collection = healthcareApisService.GetHealthcareApisServicePrivateLinkResources(); + + // invoke the operation + string groupName = "fhir"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + HealthcareApisServicePrivateLinkResource 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 + HealthcareApisPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspaceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspaceCollection.cs index 079b8a636ce1..e77dfb9ad38f 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspaceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspaceCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetWorkspace() Console.WriteLine($"Succeeded: {result}"); } + // Get workspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspace() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/workspaces/Workspaces_Get.json + // this example is just showing the usage of "Workspaces_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 = "subid"; + string resourceGroupName = "testRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HealthcareApisWorkspaceResource + HealthcareApisWorkspaceCollection collection = resourceGroupResource.GetHealthcareApisWorkspaces(); + + // invoke the operation + string workspaceName = "workspace1"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + HealthcareApisWorkspaceResource 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 + HealthcareApisWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a workspace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspacePrivateEndpointConnectionCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspacePrivateEndpointConnectionCollection.cs index c735b362f549..e8eae525bc9a 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspacePrivateEndpointConnectionCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspacePrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WorkspacePrivateEndpointConnectionGetConnection() Console.WriteLine($"Succeeded: {result}"); } + // WorkspacePrivateEndpointConnection_GetConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkspacePrivateEndpointConnectionGetConnection() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/privatelink/WorkspaceGetPrivateEndpointConnection.json + // this example is just showing the usage of "WorkspacePrivateEndpointConnections_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 HealthcareApisWorkspaceResource created on azure + // for more information of creating HealthcareApisWorkspaceResource, please refer to the document of HealthcareApisWorkspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "testRG"; + string workspaceName = "workspace1"; + ResourceIdentifier healthcareApisWorkspaceResourceId = HealthcareApisWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + HealthcareApisWorkspaceResource healthcareApisWorkspace = client.GetHealthcareApisWorkspaceResource(healthcareApisWorkspaceResourceId); + + // get the collection of this HealthcareApisWorkspacePrivateEndpointConnectionResource + HealthcareApisWorkspacePrivateEndpointConnectionCollection collection = healthcareApisWorkspace.GetHealthcareApisWorkspacePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + HealthcareApisWorkspacePrivateEndpointConnectionResource 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 + HealthcareApisPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkspacePrivateEndpointConnection_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspacePrivateLinkResourceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspacePrivateLinkResourceCollection.cs index 2418c14fb0a0..051a076e0617 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspacePrivateLinkResourceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/samples/Generated/Samples/Sample_HealthcareApisWorkspacePrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_WorkspacePrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // WorkspacePrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkspacePrivateLinkResourcesGet() + { + // Generated from example definition: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2022-06-01/examples/privatelink/WorkspacePrivateLinkResourceGet.json + // this example is just showing the usage of "WorkspacePrivateLinkResources_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 HealthcareApisWorkspaceResource created on azure + // for more information of creating HealthcareApisWorkspaceResource, please refer to the document of HealthcareApisWorkspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "testRG"; + string workspaceName = "workspace1"; + ResourceIdentifier healthcareApisWorkspaceResourceId = HealthcareApisWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + HealthcareApisWorkspaceResource healthcareApisWorkspace = client.GetHealthcareApisWorkspaceResource(healthcareApisWorkspaceResourceId); + + // get the collection of this HealthcareApisWorkspacePrivateLinkResource + HealthcareApisWorkspacePrivateLinkResourceCollection collection = healthcareApisWorkspace.GetHealthcareApisWorkspacePrivateLinkResources(); + + // invoke the operation + string groupName = "healthcareworkspace"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + HealthcareApisWorkspacePrivateLinkResource 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 + HealthcareApisPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/DicomServiceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/DicomServiceCollection.cs index 8a9713c4eb93..0b7ec066f27f 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/DicomServiceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/DicomServiceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string dicomServiceName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName} + /// + /// + /// Operation Id + /// DicomServices_Get + /// + /// + /// + /// The name of DICOM Service 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 dicomServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dicomServiceName, nameof(dicomServiceName)); + + using var scope = _dicomServiceClientDiagnostics.CreateScope("DicomServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dicomServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dicomServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DicomServiceResource(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.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName} + /// + /// + /// Operation Id + /// DicomServices_Get + /// + /// + /// + /// The name of DICOM Service resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dicomServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dicomServiceName, nameof(dicomServiceName)); + + using var scope = _dicomServiceClientDiagnostics.CreateScope("DicomServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dicomServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dicomServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DicomServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/FhirServiceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/FhirServiceCollection.cs index b154dffecc93..4b5d9a5fd0d7 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/FhirServiceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/FhirServiceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string fhirServiceName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName} + /// + /// + /// Operation Id + /// FhirServices_Get + /// + /// + /// + /// The name of FHIR Service 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 fhirServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fhirServiceName, nameof(fhirServiceName)); + + using var scope = _fhirServiceClientDiagnostics.CreateScope("FhirServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fhirServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fhirServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FhirServiceResource(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.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName} + /// + /// + /// Operation Id + /// FhirServices_Get + /// + /// + /// + /// The name of FHIR Service resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fhirServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fhirServiceName, nameof(fhirServiceName)); + + using var scope = _fhirServiceClientDiagnostics.CreateScope("FhirServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fhirServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fhirServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FhirServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorCollection.cs index 2e49cc22df94..4bcfef1ff507 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string iotConnectorName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName} + /// + /// + /// Operation Id + /// IotConnectors_Get + /// + /// + /// + /// The name of IoT Connector 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 iotConnectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(iotConnectorName, nameof(iotConnectorName)); + + using var scope = _healthcareApisIotConnectorIotConnectorsClientDiagnostics.CreateScope("HealthcareApisIotConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthcareApisIotConnectorIotConnectorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, iotConnectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisIotConnectorResource(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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName} + /// + /// + /// Operation Id + /// IotConnectors_Get + /// + /// + /// + /// The name of IoT Connector resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string iotConnectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(iotConnectorName, nameof(iotConnectorName)); + + using var scope = _healthcareApisIotConnectorIotConnectorsClientDiagnostics.CreateScope("HealthcareApisIotConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthcareApisIotConnectorIotConnectorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, iotConnectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisIotConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotFhirDestinationCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotFhirDestinationCollection.cs index 0712d541ec69..4d4430708ca0 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotFhirDestinationCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotFhirDestinationCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string fhirDestinationName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName} + /// + /// + /// Operation Id + /// IotConnectorFhirDestination_Get + /// + /// + /// + /// The name of IoT Connector FHIR destination 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 fhirDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fhirDestinationName, nameof(fhirDestinationName)); + + using var scope = _healthcareApisIotFhirDestinationIotConnectorFhirDestinationClientDiagnostics.CreateScope("HealthcareApisIotFhirDestinationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthcareApisIotFhirDestinationIotConnectorFhirDestinationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, fhirDestinationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisIotFhirDestinationResource(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.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName} + /// + /// + /// Operation Id + /// IotConnectorFhirDestination_Get + /// + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fhirDestinationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fhirDestinationName, nameof(fhirDestinationName)); + + using var scope = _healthcareApisIotFhirDestinationIotConnectorFhirDestinationClientDiagnostics.CreateScope("HealthcareApisIotFhirDestinationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthcareApisIotFhirDestinationIotConnectorFhirDestinationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, fhirDestinationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisIotFhirDestinationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceCollection.cs index e6556f116067..96cc9530d72b 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _healthcareApisServiceServicesClientDiagnostics.CreateScope("HealthcareApisServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthcareApisServiceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisServiceResource(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.HealthcareApis/services/{resourceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _healthcareApisServiceServicesClientDiagnostics.CreateScope("HealthcareApisServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthcareApisServiceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateEndpointConnectionCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateEndpointConnectionCollection.cs index 67e76631c4de..9f6ce637e5d0 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateEndpointConnectionCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _healthcareApisServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HealthcareApisServicePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthcareApisServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisServicePrivateEndpointConnectionResource(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.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _healthcareApisServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HealthcareApisServicePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthcareApisServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisServicePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateLinkResourceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateLinkResourceCollection.cs index b2a42d8a8a60..046926471e9c 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateLinkResourceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _healthcareApisServicePrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("HealthcareApisServicePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthcareApisServicePrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisServicePrivateLinkResource(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.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _healthcareApisServicePrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("HealthcareApisServicePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthcareApisServicePrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisServicePrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceCollection.cs index efa29b4b3d2c..3db8f56f1255 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of workspace 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 workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _healthcareApisWorkspaceWorkspacesClientDiagnostics.CreateScope("HealthcareApisWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthcareApisWorkspaceWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisWorkspaceResource(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.HealthcareApis/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of workspace resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _healthcareApisWorkspaceWorkspacesClientDiagnostics.CreateScope("HealthcareApisWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthcareApisWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateEndpointConnectionCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateEndpointConnectionCollection.cs index 6dd8376567fb..a03da12f1e66 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateEndpointConnectionCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// WorkspacePrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _healthcareApisWorkspacePrivateEndpointConnectionWorkspacePrivateEndpointConnectionsClientDiagnostics.CreateScope("HealthcareApisWorkspacePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthcareApisWorkspacePrivateEndpointConnectionWorkspacePrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisWorkspacePrivateEndpointConnectionResource(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.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// WorkspacePrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _healthcareApisWorkspacePrivateEndpointConnectionWorkspacePrivateEndpointConnectionsClientDiagnostics.CreateScope("HealthcareApisWorkspacePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthcareApisWorkspacePrivateEndpointConnectionWorkspacePrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisWorkspacePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateLinkResourceCollection.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateLinkResourceCollection.cs index b4ab1186140e..5bc96f344289 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateLinkResourceCollection.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// WorkspacePrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _healthcareApisWorkspacePrivateLinkResourceWorkspacePrivateLinkResourcesClientDiagnostics.CreateScope("HealthcareApisWorkspacePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthcareApisWorkspacePrivateLinkResourceWorkspacePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisWorkspacePrivateLinkResource(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.HealthcareApis/workspaces/{workspaceName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// WorkspacePrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _healthcareApisWorkspacePrivateLinkResourceWorkspacePrivateLinkResourcesClientDiagnostics.CreateScope("HealthcareApisWorkspacePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthcareApisWorkspacePrivateLinkResourceWorkspacePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthcareApisWorkspacePrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); From 7583092a5ab8bb584364727319288c36a9f49ce1 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 21 Sep 2023 08:43:02 +0000 Subject: [PATCH 4/8] Update SDK codes --- .../Sample_MetadataEntityCollection.cs | 40 +++ ...le_ResourceRecommendationBaseCollection.cs | 41 +++ .../Sample_SuppressionContractCollection.cs | 42 +++ .../src/Generated/MetadataEntityCollection.cs | 74 +++++ .../ResourceRecommendationBaseCollection.cs | 74 +++++ .../SuppressionContractCollection.cs | 74 +++++ ...formPrivateEndpointConnectionCollection.cs | 43 +++ ...odPlatformPrivateLinkResourceCollection.cs | 44 +++ .../Samples/Sample_ExtensionCollection.cs | 43 +++ .../Samples/Sample_FarmBeatCollection.cs | 42 +++ .../Sample_FarmBeatsExtensionCollection.cs | 40 +++ ...formPrivateEndpointConnectionCollection.cs | 74 +++++ ...odPlatformPrivateLinkResourceCollection.cs | 74 +++++ .../src/Generated/ExtensionCollection.cs | 74 +++++ .../src/Generated/FarmBeatCollection.cs | 74 +++++ .../Generated/FarmBeatsExtensionCollection.cs | 74 +++++ .../Sample_AlertProcessingRuleCollection.cs | 42 +++ .../Samples/Sample_ServiceAlertCollection.cs | 42 +++ .../Samples/Sample_SmartGroupCollection.cs | 42 +++ .../AlertProcessingRuleCollection.cs | 74 +++++ .../src/Generated/ServiceAlertCollection.cs | 66 +++++ .../src/Generated/SmartGroupCollection.cs | 66 +++++ .../src/Generated/AnalysisServerCollection.cs | 74 +++++ .../Sample_ApiCenterServiceCollection.cs | 42 +++ .../Generated/ApiCenterServiceCollection.cs | 74 +++++ .../Generated/Samples/Sample_ApiCollection.cs | 86 ++++++ .../Samples/Sample_ApiDiagnosticCollection.cs | 44 +++ .../Sample_ApiIssueAttachmentCollection.cs | 45 +++ .../Samples/Sample_ApiIssueCollection.cs | 44 +++ .../Sample_ApiIssueCommentCollection.cs | 45 +++ ...ManagementAuthorizationServerCollection.cs | 43 +++ .../Sample_ApiManagementBackendCollection.cs | 43 +++ .../Sample_ApiManagementCacheCollection.cs | 43 +++ ...mple_ApiManagementCertificateCollection.cs | 86 ++++++ ...e_ApiManagementDeletedServiceCollection.cs | 43 +++ ...ample_ApiManagementDiagnosticCollection.cs | 43 +++ ...le_ApiManagementEmailTemplateCollection.cs | 43 +++ ...ntGatewayCertificateAuthorityCollection.cs | 44 +++ .../Sample_ApiManagementGatewayCollection.cs | 43 +++ ...tGatewayHostnameConfigurationCollection.cs | 44 +++ ...ple_ApiManagementGlobalSchemaCollection.cs | 86 ++++++ .../Sample_ApiManagementGroupCollection.cs | 43 +++ ...ApiManagementIdentityProviderCollection.cs | 43 +++ .../Sample_ApiManagementIssueCollection.cs | 44 +++ .../Sample_ApiManagementLoggerCollection.cs | 43 +++ ...ample_ApiManagementNamedValueCollection.cs | 86 ++++++ ...ple_ApiManagementNotificationCollection.cs | 43 +++ ...nagementOpenIdConnectProviderCollection.cs | 43 +++ .../Sample_ApiManagementPolicyCollection.cs | 87 ++++++ ...e_ApiManagementPortalRevisionCollection.cs | 43 +++ ...mentPrivateEndpointConnectionCollection.cs | 43 +++ ...ManagementPrivateLinkResourceCollection.cs | 44 +++ .../Sample_ApiManagementProductCollection.cs | 43 +++ ...le_ApiManagementProductPolicyCollection.cs | 44 +++ ...ample_ApiManagementProductTagCollection.cs | 44 +++ .../Sample_ApiManagementServiceCollection.cs | 126 +++++++++ ...ple_ApiManagementSubscriptionCollection.cs | 43 +++ .../Sample_ApiManagementTagCollection.cs | 43 +++ ...le_ApiManagementTenantSettingCollection.cs | 44 +++ .../Sample_ApiManagementUserCollection.cs | 43 +++ ...ApiManagementUserSubscriptionCollection.cs | 45 +++ .../Samples/Sample_ApiOperationCollection.cs | 88 ++++++ .../Sample_ApiOperationPolicyCollection.cs | 45 +++ .../Sample_ApiOperationTagCollection.cs | 45 +++ .../Samples/Sample_ApiPolicyCollection.cs | 44 +++ .../Samples/Sample_ApiReleaseCollection.cs | 44 +++ .../Samples/Sample_ApiSchemaCollection.cs | 44 +++ .../Samples/Sample_ApiTagCollection.cs | 44 +++ .../Sample_ApiTagDescriptionCollection.cs | 44 +++ .../Samples/Sample_ApiVersionSetCollection.cs | 43 +++ .../Sample_TenantAccessInfoCollection.cs | 86 ++++++ .../src/Generated/ApiCollection.cs | 74 +++++ .../src/Generated/ApiDiagnosticCollection.cs | 74 +++++ .../Generated/ApiIssueAttachmentCollection.cs | 74 +++++ .../src/Generated/ApiIssueCollection.cs | 76 +++++ .../Generated/ApiIssueCommentCollection.cs | 74 +++++ ...ManagementAuthorizationServerCollection.cs | 74 +++++ .../ApiManagementBackendCollection.cs | 74 +++++ .../Generated/ApiManagementCacheCollection.cs | 74 +++++ .../ApiManagementCertificateCollection.cs | 74 +++++ .../ApiManagementDeletedServiceCollection.cs | 76 +++++ .../ApiManagementDiagnosticCollection.cs | 74 +++++ .../ApiManagementEmailTemplateCollection.cs | 66 +++++ ...ntGatewayCertificateAuthorityCollection.cs | 74 +++++ .../ApiManagementGatewayCollection.cs | 74 +++++ ...tGatewayHostnameConfigurationCollection.cs | 74 +++++ .../ApiManagementGlobalSchemaCollection.cs | 74 +++++ .../Generated/ApiManagementGroupCollection.cs | 74 +++++ ...ApiManagementIdentityProviderCollection.cs | 66 +++++ .../Generated/ApiManagementIssueCollection.cs | 74 +++++ .../ApiManagementLoggerCollection.cs | 74 +++++ .../ApiManagementNamedValueCollection.cs | 74 +++++ .../ApiManagementNotificationCollection.cs | 66 +++++ ...nagementOpenIdConnectProviderCollection.cs | 74 +++++ .../ApiManagementPolicyCollection.cs | 68 +++++ .../ApiManagementPortalRevisionCollection.cs | 74 +++++ ...mentPrivateEndpointConnectionCollection.cs | 74 +++++ ...ManagementPrivateLinkResourceCollection.cs | 74 +++++ .../ApiManagementProductCollection.cs | 74 +++++ .../ApiManagementProductPolicyCollection.cs | 68 +++++ .../ApiManagementProductTagCollection.cs | 74 +++++ .../ApiManagementServiceCollection.cs | 74 +++++ .../ApiManagementSubscriptionCollection.cs | 74 +++++ .../Generated/ApiManagementTagCollection.cs | 74 +++++ .../ApiManagementTenantSettingCollection.cs | 66 +++++ .../Generated/ApiManagementUserCollection.cs | 74 +++++ ...ApiManagementUserSubscriptionCollection.cs | 74 +++++ .../src/Generated/ApiOperationCollection.cs | 74 +++++ .../Generated/ApiOperationPolicyCollection.cs | 68 +++++ .../Generated/ApiOperationTagCollection.cs | 74 +++++ .../src/Generated/ApiPolicyCollection.cs | 68 +++++ .../src/Generated/ApiReleaseCollection.cs | 74 +++++ .../src/Generated/ApiSchemaCollection.cs | 74 +++++ .../src/Generated/ApiTagCollection.cs | 74 +++++ .../Generated/ApiTagDescriptionCollection.cs | 74 +++++ .../src/Generated/ApiVersionSetCollection.cs | 74 +++++ .../Generated/TenantAccessInfoCollection.cs | 66 +++++ .../Sample_ReportResourceCollection.cs | 39 +++ .../Sample_SnapshotResourceCollection.cs | 42 +++ .../src/Generated/ReportResourceCollection.cs | 74 +++++ .../Generated/SnapshotResourceCollection.cs | 74 +++++ ...mple_AppConfigurationKeyValueCollection.cs | 43 +++ ...tionPrivateEndpointConnectionCollection.cs | 43 +++ ...figurationPrivateLinkResourceCollection.cs | 44 +++ .../Sample_AppConfigurationStoreCollection.cs | 42 +++ ..._DeletedAppConfigurationStoreCollection.cs | 43 +++ .../AppConfigurationKeyValueCollection.cs | 74 +++++ ...tionPrivateEndpointConnectionCollection.cs | 74 +++++ ...figurationPrivateLinkResourceCollection.cs | 74 +++++ .../AppConfigurationStoreCollection.cs | 74 +++++ .../DeletedAppConfigurationStoreCollection.cs | 76 +++++ ..._ApplicationInsightsComponentCollection.cs | 42 +++ ...ComponentLinkedStorageAccountCollection.cs | 43 +++ .../Samples/Sample_MyWorkbookCollection.cs | 42 +++ .../Samples/Sample_WebTestCollection.cs | 42 +++ .../Samples/Sample_WorkbookCollection.cs | 126 +++++++++ .../Sample_WorkbookRevisionCollection.cs | 44 +++ .../Sample_WorkbookTemplateCollection.cs | 42 +++ .../ApplicationInsightsComponentCollection.cs | 74 +++++ ...ComponentLinkedStorageAccountCollection.cs | 66 +++++ .../src/Generated/MyWorkbookCollection.cs | 74 +++++ .../src/Generated/WebTestCollection.cs | 74 +++++ .../src/Generated/WorkbookCollection.cs | 76 +++++ .../Generated/WorkbookRevisionCollection.cs | 74 +++++ .../Generated/WorkbookTemplateCollection.cs | 74 +++++ .../AppPlatformApiPortalCollection.cs | 74 +++++ ...PlatformApiPortalCustomDomainCollection.cs | 74 +++++ .../src/Generated/AppPlatformAppCollection.cs | 76 +++++ .../Generated/AppPlatformBindingCollection.cs | 74 +++++ .../Generated/AppPlatformBuildCollection.cs | 74 +++++ .../AppPlatformBuildResultCollection.cs | 74 +++++ ...PlatformBuildServiceAgentPoolCollection.cs | 74 +++++ .../AppPlatformBuildServiceCollection.cs | 74 +++++ .../Generated/AppPlatformBuilderCollection.cs | 74 +++++ .../AppPlatformBuildpackBindingCollection.cs | 74 +++++ .../AppPlatformCertificateCollection.cs | 74 +++++ ...pPlatformConfigurationServiceCollection.cs | 74 +++++ .../AppPlatformCustomDomainCollection.cs | 74 +++++ .../AppPlatformDeploymentCollection.cs | 74 +++++ .../Generated/AppPlatformGatewayCollection.cs | 74 +++++ ...ppPlatformGatewayCustomDomainCollection.cs | 74 +++++ ...AppPlatformGatewayRouteConfigCollection.cs | 74 +++++ .../Generated/AppPlatformServiceCollection.cs | 74 +++++ .../AppPlatformServiceRegistryCollection.cs | 74 +++++ .../Generated/AppPlatformStorageCollection.cs | 74 +++++ ...AppPlatformSupportedBuildpackCollection.cs | 74 +++++ .../AppPlatformSupportedStackCollection.cs | 74 +++++ .../Samples/Sample_InventoryItemCollection.cs | 43 +++ .../Sample_ScVmmAvailabilitySetCollection.cs | 42 +++ .../Samples/Sample_ScVmmCloudCollection.cs | 42 +++ .../Samples/Sample_ScVmmServerCollection.cs | 42 +++ .../Sample_ScVmmVirtualMachineCollection.cs | 42 +++ ...e_ScVmmVirtualMachineTemplateCollection.cs | 42 +++ .../Sample_ScVmmVirtualNetworkCollection.cs | 42 +++ .../src/Generated/InventoryItemCollection.cs | 74 +++++ .../ScVmmAvailabilitySetCollection.cs | 74 +++++ .../src/Generated/ScVmmCloudCollection.cs | 74 +++++ .../src/Generated/ScVmmServerCollection.cs | 74 +++++ .../ScVmmVirtualMachineCollection.cs | 74 +++++ .../ScVmmVirtualMachineTemplateCollection.cs | 74 +++++ .../ScVmmVirtualNetworkCollection.cs | 74 +++++ ...tionPrivateEndpointConnectionCollection.cs | 43 +++ .../Sample_AttestationProviderCollection.cs | 42 +++ ...tionPrivateEndpointConnectionCollection.cs | 74 +++++ .../AttestationProviderCollection.cs | 74 +++++ ...ionProviderOperationsMetadataCollection.cs | 40 +++ ...e_AuthorizationRoleDefinitionCollection.cs | 40 +++ .../Sample_DenyAssignmentCollection.cs | 41 +++ .../Sample_RoleAssignmentCollection.cs | 40 +++ ...Sample_RoleAssignmentScheduleCollection.cs | 41 +++ ...oleAssignmentScheduleInstanceCollection.cs | 41 +++ ...RoleAssignmentScheduleRequestCollection.cs | 40 +++ ...ample_RoleEligibilityScheduleCollection.cs | 41 +++ ...leEligibilityScheduleInstanceCollection.cs | 41 +++ ...oleEligibilityScheduleRequestCollection.cs | 40 +++ ...oleManagementPolicyAssignmentCollection.cs | 40 +++ .../Sample_RoleManagementPolicyCollection.cs | 41 +++ ...ionProviderOperationsMetadataCollection.cs | 74 +++++ .../AuthorizationRoleDefinitionCollection.cs | 72 +++++ .../src/Generated/DenyAssignmentCollection.cs | 74 +++++ .../src/Generated/RoleAssignmentCollection.cs | 74 +++++ .../RoleAssignmentScheduleCollection.cs | 74 +++++ ...oleAssignmentScheduleInstanceCollection.cs | 74 +++++ ...RoleAssignmentScheduleRequestCollection.cs | 74 +++++ .../RoleEligibilityScheduleCollection.cs | 74 +++++ ...leEligibilityScheduleInstanceCollection.cs | 74 +++++ ...oleEligibilityScheduleRequestCollection.cs | 74 +++++ ...oleManagementPolicyAssignmentCollection.cs | 74 +++++ .../RoleManagementPolicyCollection.cs | 74 +++++ ...Sample_AutomanageBestPracticeCollection.cs | 40 +++ ...utomanageConfigurationProfileCollection.cs | 42 +++ ...geConfigurationProfileVersionCollection.cs | 43 +++ ...onfigurationProfileAssignmentCollection.cs | 42 +++ ...rationProfileAssignmentReportCollection.cs | 45 +++ ...onfigurationProfileAssignmentCollection.cs | 42 +++ ...rationProfileAssignmentReportCollection.cs | 45 +++ ...onfigurationProfileAssignmentCollection.cs | 42 +++ ...rationProfileAssignmentReportCollection.cs | 45 +++ .../AutomanageBestPracticeCollection.cs | 74 +++++ ...utomanageConfigurationProfileCollection.cs | 74 +++++ ...geConfigurationProfileVersionCollection.cs | 74 +++++ ...onfigurationProfileAssignmentCollection.cs | 74 +++++ ...rationProfileAssignmentReportCollection.cs | 74 +++++ ...onfigurationProfileAssignmentCollection.cs | 74 +++++ ...rationProfileAssignmentReportCollection.cs | 74 +++++ ...onfigurationProfileAssignmentCollection.cs | 74 +++++ ...rationProfileAssignmentReportCollection.cs | 74 +++++ .../Sample_AutomationAccountCollection.cs | 42 +++ ...ample_AutomationAccountModuleCollection.cs | 43 +++ ...tomationAccountPython2PackageCollection.cs | 43 +++ .../Sample_AutomationCertificateCollection.cs | 43 +++ .../Sample_AutomationConnectionCollection.cs | 43 +++ ...mple_AutomationConnectionTypeCollection.cs | 43 +++ .../Sample_AutomationCredentialCollection.cs | 43 +++ .../Samples/Sample_AutomationJobCollection.cs | 43 +++ .../Sample_AutomationJobScheduleCollection.cs | 43 +++ ...tionPrivateEndpointConnectionCollection.cs | 43 +++ .../Sample_AutomationRunbookCollection.cs | 43 +++ .../Sample_AutomationScheduleCollection.cs | 43 +++ ...ample_AutomationSourceControlCollection.cs | 43 +++ .../Sample_AutomationVariableCollection.cs | 43 +++ .../Sample_AutomationWatcherCollection.cs | 43 +++ .../Sample_AutomationWebhookCollection.cs | 43 +++ .../Sample_DscCompilationJobCollection.cs | 43 +++ .../Sample_DscConfigurationCollection.cs | 43 +++ .../Samples/Sample_DscNodeCollection.cs | 44 +++ .../Sample_DscNodeConfigurationCollection.cs | 43 +++ .../Sample_HybridRunbookWorkerCollection.cs | 44 +++ ...mple_HybridRunbookWorkerGroupCollection.cs | 43 +++ ...e_SoftwareUpdateConfigurationCollection.cs | 43 +++ .../Generated/AutomationAccountCollection.cs | 74 +++++ .../AutomationAccountModuleCollection.cs | 74 +++++ ...tomationAccountPython2PackageCollection.cs | 74 +++++ .../AutomationCertificateCollection.cs | 74 +++++ .../AutomationConnectionCollection.cs | 74 +++++ .../AutomationConnectionTypeCollection.cs | 74 +++++ .../AutomationCredentialCollection.cs | 74 +++++ .../src/Generated/AutomationJobCollection.cs | 76 +++++ .../AutomationJobScheduleCollection.cs | 66 +++++ ...tionPrivateEndpointConnectionCollection.cs | 74 +++++ .../Generated/AutomationRunbookCollection.cs | 74 +++++ .../Generated/AutomationScheduleCollection.cs | 74 +++++ .../AutomationSourceControlCollection.cs | 74 +++++ .../Generated/AutomationVariableCollection.cs | 74 +++++ .../Generated/AutomationWatcherCollection.cs | 74 +++++ .../Generated/AutomationWebhookCollection.cs | 74 +++++ .../Generated/DscCompilationJobCollection.cs | 74 +++++ .../Generated/DscConfigurationCollection.cs | 74 +++++ .../src/Generated/DscNodeCollection.cs | 74 +++++ .../DscNodeConfigurationCollection.cs | 74 +++++ .../HybridRunbookWorkerCollection.cs | 74 +++++ .../HybridRunbookWorkerGroupCollection.cs | 74 +++++ .../SoftwareUpdateConfigurationCollection.cs | 76 +++++ .../Samples/Sample_AvsCloudLinkCollection.cs | 43 +++ .../Sample_AvsPrivateCloudAddonCollection.cs | 172 ++++++++++++ ...Sample_AvsPrivateCloudClusterCollection.cs | 43 +++ ...ateCloudClusterVirtualMachineCollection.cs | 45 +++ .../Sample_AvsPrivateCloudCollection.cs | 84 ++++++ ...mple_AvsPrivateCloudDatastoreCollection.cs | 44 +++ ...ple_ExpressRouteAuthorizationCollection.cs | 43 +++ .../Sample_GlobalReachConnectionCollection.cs | 43 +++ .../Sample_HcxEnterpriseSiteCollection.cs | 43 +++ .../Sample_PlacementPolicyCollection.cs | 44 +++ .../Samples/Sample_ScriptCmdletCollection.cs | 45 +++ .../Sample_ScriptExecutionCollection.cs | 43 +++ .../Samples/Sample_ScriptPackageCollection.cs | 44 +++ .../Sample_WorkloadNetworkCollection.cs | 44 +++ .../Sample_WorkloadNetworkDhcpCollection.cs | 43 +++ ...ple_WorkloadNetworkDnsServiceCollection.cs | 43 +++ ...Sample_WorkloadNetworkDnsZoneCollection.cs | 43 +++ ...Sample_WorkloadNetworkGatewayCollection.cs | 44 +++ ...adNetworkPortMirroringProfileCollection.cs | 43 +++ ...ample_WorkloadNetworkPublicIPCollection.cs | 43 +++ ...Sample_WorkloadNetworkSegmentCollection.cs | 43 +++ ...WorkloadNetworkVirtualMachineCollection.cs | 44 +++ ...Sample_WorkloadNetworkVmGroupCollection.cs | 43 +++ .../src/Generated/AvsCloudLinkCollection.cs | 74 +++++ .../AvsPrivateCloudAddonCollection.cs | 74 +++++ .../AvsPrivateCloudClusterCollection.cs | 74 +++++ ...ateCloudClusterVirtualMachineCollection.cs | 74 +++++ .../Generated/AvsPrivateCloudCollection.cs | 74 +++++ .../AvsPrivateCloudDatastoreCollection.cs | 74 +++++ .../ExpressRouteAuthorizationCollection.cs | 74 +++++ .../GlobalReachConnectionCollection.cs | 74 +++++ .../Generated/HcxEnterpriseSiteCollection.cs | 74 +++++ .../Generated/PlacementPolicyCollection.cs | 74 +++++ .../src/Generated/ScriptCmdletCollection.cs | 74 +++++ .../Generated/ScriptExecutionCollection.cs | 74 +++++ .../src/Generated/ScriptPackageCollection.cs | 74 +++++ .../Generated/WorkloadNetworkCollection.cs | 66 +++++ .../WorkloadNetworkDhcpCollection.cs | 74 +++++ .../WorkloadNetworkDnsServiceCollection.cs | 74 +++++ .../WorkloadNetworkDnsZoneCollection.cs | 74 +++++ .../WorkloadNetworkGatewayCollection.cs | 74 +++++ ...adNetworkPortMirroringProfileCollection.cs | 74 +++++ .../WorkloadNetworkPublicIPCollection.cs | 74 +++++ .../WorkloadNetworkSegmentCollection.cs | 74 +++++ ...WorkloadNetworkVirtualMachineCollection.cs | 74 +++++ .../WorkloadNetworkVmGroupCollection.cs | 74 +++++ .../Samples/Sample_ArcExtensionCollection.cs | 44 +++ .../Samples/Sample_ArcSettingCollection.cs | 43 +++ .../Samples/Sample_HciClusterCollection.cs | 42 +++ .../Samples/Sample_HciSkuCollection.cs | 46 ++++ .../Samples/Sample_OfferCollection.cs | 45 +++ .../Samples/Sample_PublisherCollection.cs | 44 +++ .../Samples/Sample_UpdateCollection.cs | 43 +++ .../Samples/Sample_UpdateRunCollection.cs | 44 +++ .../src/Generated/ArcExtensionCollection.cs | 74 +++++ .../src/Generated/ArcSettingCollection.cs | 74 +++++ .../src/Generated/HciClusterCollection.cs | 74 +++++ .../src/Generated/HciSkuCollection.cs | 76 +++++ .../src/Generated/OfferCollection.cs | 76 +++++ .../src/Generated/PublisherCollection.cs | 74 +++++ .../src/Generated/UpdateCollection.cs | 74 +++++ .../src/Generated/UpdateRunCollection.cs | 74 +++++ .../BatchAccountCertificateCollection.cs | 74 +++++ .../src/Generated/BatchAccountCollection.cs | 74 +++++ .../BatchAccountDetectorCollection.cs | 74 +++++ .../Generated/BatchAccountPoolCollection.cs | 74 +++++ .../Generated/BatchApplicationCollection.cs | 74 +++++ .../BatchApplicationPackageCollection.cs | 74 +++++ ...atchPrivateEndpointConnectionCollection.cs | 74 +++++ .../BatchPrivateLinkResourceCollection.cs | 74 +++++ ...e_BillingAccountPaymentMethodCollection.cs | 41 +++ .../Sample_BillingPaymentMethodCollection.cs | 40 +++ ...mple_BillingPaymentMethodLinkCollection.cs | 42 +++ ...mple_BillingSubscriptionAliasCollection.cs | 40 +++ .../Sample_BillingSubscriptionCollection.cs | 41 +++ .../BillingAccountPaymentMethodCollection.cs | 74 +++++ .../BillingPaymentMethodCollection.cs | 74 +++++ .../BillingPaymentMethodLinkCollection.cs | 74 +++++ .../BillingSubscriptionAliasCollection.cs | 74 +++++ .../BillingSubscriptionCollection.cs | 74 +++++ ...BenefitsReservationOrderAliasCollection.cs | 74 +++++ .../BillingBenefitsSavingsPlanCollection.cs | 76 +++++ ...BenefitsSavingsPlanOrderAliasCollection.cs | 74 +++++ ...llingBenefitsSavingsPlanOrderCollection.cs | 76 +++++ .../Samples/Sample_AssignmentCollection.cs | 81 ++++++ .../Sample_AssignmentOperationCollection.cs | 85 ++++++ .../Sample_BlueprintArtifactCollection.cs | 252 +++++++++++++++++ .../Samples/Sample_BlueprintCollection.cs | 80 ++++++ ...mple_BlueprintVersionArtifactCollection.cs | 259 ++++++++++++++++++ .../Sample_PublishedBlueprintCollection.cs | 84 ++++++ .../src/Generated/AssignmentCollection.cs | 74 +++++ .../AssignmentOperationCollection.cs | 74 +++++ .../Generated/BlueprintArtifactCollection.cs | 74 +++++ .../src/Generated/BlueprintCollection.cs | 74 +++++ .../BlueprintVersionArtifactCollection.cs | 74 +++++ .../Generated/PublishedBlueprintCollection.cs | 74 +++++ .../Samples/Sample_BotChannelCollection.cs | 172 ++++++++++++ .../Generated/Samples/Sample_BotCollection.cs | 42 +++ .../Sample_BotConnectionSettingCollection.cs | 43 +++ ...vicePrivateEndpointConnectionCollection.cs | 43 +++ .../src/Generated/BotChannelCollection.cs | 66 +++++ .../src/Generated/BotCollection.cs | 74 +++++ .../BotConnectionSettingCollection.cs | 74 +++++ ...vicePrivateEndpointConnectionCollection.cs | 74 +++++ .../Sample_CdnCustomDomainCollection.cs | 44 +++ .../Samples/Sample_CdnEndpointCollection.cs | 43 +++ .../Samples/Sample_CdnOriginCollection.cs | 44 +++ .../Sample_CdnOriginGroupCollection.cs | 44 +++ ...nWebApplicationFirewallPolicyCollection.cs | 42 +++ .../Sample_FrontDoorCustomDomainCollection.cs | 43 +++ .../Sample_FrontDoorEndpointCollection.cs | 43 +++ .../Sample_FrontDoorOriginCollection.cs | 44 +++ .../Sample_FrontDoorOriginGroupCollection.cs | 43 +++ .../Sample_FrontDoorRouteCollection.cs | 44 +++ .../Samples/Sample_FrontDoorRuleCollection.cs | 44 +++ .../Sample_FrontDoorRuleSetCollection.cs | 43 +++ .../Sample_FrontDoorSecretCollection.cs | 43 +++ ...ample_FrontDoorSecurityPolicyCollection.cs | 43 +++ .../Samples/Sample_ProfileCollection.cs | 42 +++ .../Generated/CdnCustomDomainCollection.cs | 74 +++++ .../src/Generated/CdnEndpointCollection.cs | 74 +++++ .../src/Generated/CdnOriginCollection.cs | 74 +++++ .../src/Generated/CdnOriginGroupCollection.cs | 74 +++++ ...nWebApplicationFirewallPolicyCollection.cs | 74 +++++ .../FrontDoorCustomDomainCollection.cs | 74 +++++ .../Generated/FrontDoorEndpointCollection.cs | 74 +++++ .../Generated/FrontDoorOriginCollection.cs | 74 +++++ .../FrontDoorOriginGroupCollection.cs | 74 +++++ .../src/Generated/FrontDoorRouteCollection.cs | 74 +++++ .../src/Generated/FrontDoorRuleCollection.cs | 74 +++++ .../Generated/FrontDoorRuleSetCollection.cs | 74 +++++ .../Generated/FrontDoorSecretCollection.cs | 74 +++++ .../FrontDoorSecurityPolicyCollection.cs | 74 +++++ .../src/Generated/ProfileCollection.cs | 74 +++++ .../Samples/Sample_CapabilityCollection.cs | 46 ++++ .../Sample_CapabilityTypeCollection.cs | 44 +++ .../Samples/Sample_ExperimentCollection.cs | 42 +++ ...ple_ExperimentExecutionDetailCollection.cs | 44 +++ .../Sample_ExperimentStatusCollection.cs | 44 +++ .../Samples/Sample_TargetCollection.cs | 45 +++ .../Samples/Sample_TargetTypeCollection.cs | 43 +++ .../src/Generated/CapabilityCollection.cs | 74 +++++ .../src/Generated/CapabilityTypeCollection.cs | 74 +++++ .../src/Generated/ExperimentCollection.cs | 74 +++++ .../ExperimentExecutionDetailCollection.cs | 74 +++++ .../Generated/ExperimentStatusCollection.cs | 74 +++++ .../src/Generated/TargetCollection.cs | 74 +++++ .../src/Generated/TargetTypeCollection.cs | 74 +++++ ...mple_CognitiveServicesAccountCollection.cs | 42 +++ ...tiveServicesAccountDeploymentCollection.cs | 43 +++ ...gnitiveServicesCommitmentPlanCollection.cs | 42 +++ ...gnitiveServicesDeletedAccountCollection.cs | 44 +++ ...icesPrivateEndpointConnectionCollection.cs | 44 +++ ...mitmentPlanAccountAssociationCollection.cs | 43 +++ .../Sample_CommitmentPlanCollection.cs | 43 +++ .../CognitiveServicesAccountCollection.cs | 74 +++++ ...tiveServicesAccountDeploymentCollection.cs | 74 +++++ ...gnitiveServicesCommitmentPlanCollection.cs | 74 +++++ ...gnitiveServicesDeletedAccountCollection.cs | 80 ++++++ ...icesPrivateEndpointConnectionCollection.cs | 74 +++++ ...mitmentPlanAccountAssociationCollection.cs | 74 +++++ .../src/Generated/CommitmentPlanCollection.cs | 74 +++++ 435 files changed, 27238 insertions(+) diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_MetadataEntityCollection.cs b/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_MetadataEntityCollection.cs index 32eb0e2a2717..f9e56e0f567a 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_MetadataEntityCollection.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_MetadataEntityCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -74,6 +75,45 @@ public async Task Exists_GetMetadata() Console.WriteLine($"Succeeded: {result}"); } + // GetMetadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMetadata() + { + // Generated from example definition: specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetRecommendationMetadataEntity.json + // this example is just showing the usage of "RecommendationMetadata_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this MetadataEntityResource + MetadataEntityCollection collection = tenantResource.GetMetadataEntities(); + + // invoke the operation + string name = "types"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MetadataEntityResource 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 + MetadataEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetMetadata [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_ResourceRecommendationBaseCollection.cs b/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_ResourceRecommendationBaseCollection.cs index 8d465db9cd7f..870ec01b522a 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_ResourceRecommendationBaseCollection.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_ResourceRecommendationBaseCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -110,5 +111,45 @@ public async Task Exists_GetRecommendationDetail() Console.WriteLine($"Succeeded: {result}"); } + + // GetRecommendationDetail + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRecommendationDetail() + { + // Generated from example definition: specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetRecommendationDetail.json + // this example is just showing the usage of "Recommendations_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ResourceRecommendationBaseResource + string resourceUri = "resourceUri"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + ResourceRecommendationBaseCollection collection = client.GetResourceRecommendationBases(scopeId); + + // invoke the operation + string recommendationId = "recommendationId"; + NullableResponse response = await collection.GetIfExistsAsync(recommendationId); + ResourceRecommendationBaseResource 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 + ResourceRecommendationBaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_SuppressionContractCollection.cs b/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_SuppressionContractCollection.cs index 504f4d662e29..3aedc4d1590c 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_SuppressionContractCollection.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/samples/Generated/Samples/Sample_SuppressionContractCollection.cs @@ -81,6 +81,48 @@ public async Task Exists_GetSuppressionDetail() Console.WriteLine($"Succeeded: {result}"); } + // GetSuppressionDetail + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSuppressionDetail() + { + // Generated from example definition: specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetSuppressionDetail.json + // this example is just showing the usage of "Suppressions_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 ResourceRecommendationBaseResource created on azure + // for more information of creating ResourceRecommendationBaseResource, please refer to the document of ResourceRecommendationBaseResource + string resourceUri = "resourceUri"; + string recommendationId = "recommendationId"; + ResourceIdentifier resourceRecommendationBaseResourceId = ResourceRecommendationBaseResource.CreateResourceIdentifier(resourceUri, recommendationId); + ResourceRecommendationBaseResource resourceRecommendationBase = client.GetResourceRecommendationBaseResource(resourceRecommendationBaseResourceId); + + // get the collection of this SuppressionContractResource + SuppressionContractCollection collection = resourceRecommendationBase.GetSuppressionContracts(); + + // invoke the operation + string name = "suppressionName1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + SuppressionContractResource 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 + SuppressionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateSuppression [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityCollection.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityCollection.cs index dbda0f9dc4b2..e35399c6aed0 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityCollection.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Advisor/metadata/{name} + /// + /// + /// Operation Id + /// RecommendationMetadata_Get + /// + /// + /// + /// Name of metadata entity. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _metadataEntityRecommendationMetadataClientDiagnostics.CreateScope("MetadataEntityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _metadataEntityRecommendationMetadataRestClient.GetAsync(name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MetadataEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Advisor/metadata/{name} + /// + /// + /// Operation Id + /// RecommendationMetadata_Get + /// + /// + /// + /// Name of metadata entity. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _metadataEntityRecommendationMetadataClientDiagnostics.CreateScope("MetadataEntityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _metadataEntityRecommendationMetadataRestClient.Get(name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MetadataEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseCollection.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseCollection.cs index 5844a7f0f61e..6eebf43560a0 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseCollection.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseCollection.cs @@ -237,6 +237,80 @@ public virtual Response Exists(string recommendationId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId} + /// + /// + /// Operation Id + /// Recommendations_Get + /// + /// + /// + /// The recommendation ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recommendationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recommendationId, nameof(recommendationId)); + + using var scope = _resourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("ResourceRecommendationBaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceRecommendationBaseRecommendationsRestClient.GetAsync(Id, recommendationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceRecommendationBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId} + /// + /// + /// Operation Id + /// Recommendations_Get + /// + /// + /// + /// The recommendation ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recommendationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recommendationId, nameof(recommendationId)); + + using var scope = _resourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("ResourceRecommendationBaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceRecommendationBaseRecommendationsRestClient.Get(Id, recommendationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceRecommendationBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractCollection.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractCollection.cs index b032db795b19..85cd81b7da73 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractCollection.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string name, CancellationToken cancellation throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name} + /// + /// + /// Operation Id + /// Suppressions_Get + /// + /// + /// + /// The name of the suppression. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _suppressionContractSuppressionsClientDiagnostics.CreateScope("SuppressionContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _suppressionContractSuppressionsRestClient.GetAsync(Id.Parent, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SuppressionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name} + /// + /// + /// Operation Id + /// Suppressions_Get + /// + /// + /// + /// The name of the suppression. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _suppressionContractSuppressionsClientDiagnostics.CreateScope("SuppressionContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _suppressionContractSuppressionsRestClient.Get(Id.Parent, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SuppressionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_AgFoodPlatformPrivateEndpointConnectionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_AgFoodPlatformPrivateEndpointConnectionCollection.cs index 37e198bfddc2..34b2040b8c95 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_AgFoodPlatformPrivateEndpointConnectionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_AgFoodPlatformPrivateEndpointConnectionCollection.cs @@ -128,6 +128,49 @@ public async Task Exists_PrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 FarmBeatResource created on azure + // for more information of creating FarmBeatResource, please refer to the document of FarmBeatResource + string subscriptionId = "11111111-2222-3333-4444-555555555555"; + string resourceGroupName = "examples-rg"; + string farmBeatsResourceName = "examples-farmbeatsResourceName"; + ResourceIdentifier farmBeatResourceId = FarmBeatResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, farmBeatsResourceName); + FarmBeatResource farmBeat = client.GetFarmBeatResource(farmBeatResourceId); + + // get the collection of this AgFoodPlatformPrivateEndpointConnectionResource + AgFoodPlatformPrivateEndpointConnectionCollection collection = farmBeat.GetAgFoodPlatformPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + AgFoodPlatformPrivateEndpointConnectionResource 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 + AgFoodPlatformPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_ListByResource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_AgFoodPlatformPrivateLinkResourceCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_AgFoodPlatformPrivateLinkResourceCollection.cs index 202002e3cad9..4fcefb5f0c1f 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_AgFoodPlatformPrivateLinkResourceCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_AgFoodPlatformPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_PrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateLinkResources_Get.json + // this example is just showing the usage of "PrivateLinkResources_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 FarmBeatResource created on azure + // for more information of creating FarmBeatResource, please refer to the document of FarmBeatResource + string subscriptionId = "11111111-2222-3333-4444-555555555555"; + string resourceGroupName = "examples-rg"; + string farmBeatsResourceName = "examples-farmbeatsResourceName"; + ResourceIdentifier farmBeatResourceId = FarmBeatResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, farmBeatsResourceName); + FarmBeatResource farmBeat = client.GetFarmBeatResource(farmBeatResourceId); + + // get the collection of this AgFoodPlatformPrivateLinkResource + AgFoodPlatformPrivateLinkResourceCollection collection = farmBeat.GetAgFoodPlatformPrivateLinkResources(); + + // invoke the operation + string subResourceName = "farmbeats"; + NullableResponse response = await collection.GetIfExistsAsync(subResourceName); + AgFoodPlatformPrivateLinkResource 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 + AgFoodPlatformPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_ExtensionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_ExtensionCollection.cs index a455b9fd6b26..363932a4def1 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_ExtensionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_ExtensionCollection.cs @@ -119,6 +119,49 @@ public async Task Exists_ExtensionsGet() Console.WriteLine($"Succeeded: {result}"); } + // Extensions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExtensionsGet() + { + // Generated from example definition: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_Get.json + // this example is just showing the usage of "Extensions_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 FarmBeatResource created on azure + // for more information of creating FarmBeatResource, please refer to the document of FarmBeatResource + string subscriptionId = "11111111-2222-3333-4444-555555555555"; + string resourceGroupName = "examples-rg"; + string farmBeatsResourceName = "examples-farmbeatsResourceName"; + ResourceIdentifier farmBeatResourceId = FarmBeatResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, farmBeatsResourceName); + FarmBeatResource farmBeat = client.GetFarmBeatResource(farmBeatResourceId); + + // get the collection of this ExtensionResource + ExtensionCollection collection = farmBeat.GetExtensions(); + + // invoke the operation + string extensionId = "provider.extension"; + NullableResponse response = await collection.GetIfExistsAsync(extensionId); + ExtensionResource 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 + ExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Extensions_ListByFarmBeats [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_FarmBeatCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_FarmBeatCollection.cs index 6df487b884ea..3a2748a9a57e 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_FarmBeatCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_FarmBeatCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_FarmBeatsModelsGet() Console.WriteLine($"Succeeded: {result}"); } + // FarmBeatsModels_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FarmBeatsModelsGet() + { + // Generated from example definition: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_Get.json + // this example is just showing the usage of "FarmBeatsModels_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 = "11111111-2222-3333-4444-555555555555"; + string resourceGroupName = "examples-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FarmBeatResource + FarmBeatCollection collection = resourceGroupResource.GetFarmBeats(); + + // invoke the operation + string farmBeatsResourceName = "examples-farmBeatsResourceName"; + NullableResponse response = await collection.GetIfExistsAsync(farmBeatsResourceName); + FarmBeatResource 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 + FarmBeatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FarmBeatsModels_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_FarmBeatsExtensionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_FarmBeatsExtensionCollection.cs index c50780f96902..b75be74cd8c6 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_FarmBeatsExtensionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/samples/Generated/Samples/Sample_FarmBeatsExtensionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -106,5 +107,44 @@ public async Task Exists_FarmBeatsExtensionsGet() Console.WriteLine($"Succeeded: {result}"); } + + // FarmBeatsExtensions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FarmBeatsExtensionsGet() + { + // Generated from example definition: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsExtensions_Get.json + // this example is just showing the usage of "FarmBeatsExtensions_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this FarmBeatsExtensionResource + FarmBeatsExtensionCollection collection = tenantResource.GetFarmBeatsExtensions(); + + // invoke the operation + string farmBeatsExtensionId = "DTN.ContentServices"; + NullableResponse response = await collection.GetIfExistsAsync(farmBeatsExtensionId); + FarmBeatsExtensionResource 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 + FarmBeatsExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionCollection.cs index 7f2b19c8b238..edeeb3eee784 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private endpoint connection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AgFoodPlatformPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgFoodPlatformPrivateEndpointConnectionResource(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.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private endpoint connection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AgFoodPlatformPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgFoodPlatformPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceCollection.cs index e3430086196c..82447fc6adcb 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string subResourceName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// Sub resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var scope = _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("AgFoodPlatformPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgFoodPlatformPrivateLinkResource(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.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources/{subResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// Sub resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string subResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subResourceName, nameof(subResourceName)); + + using var scope = _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("AgFoodPlatformPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgFoodPlatformPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionCollection.cs index 56f605399233..7468bddebd31 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionCollection.cs @@ -333,6 +333,80 @@ public virtual Response Exists(string extensionId, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId} + /// + /// + /// Operation Id + /// Extensions_Get + /// + /// + /// + /// Id of extension 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 extensionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionId, nameof(extensionId)); + + using var scope = _extensionClientDiagnostics.CreateScope("ExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _extensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExtensionResource(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.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId} + /// + /// + /// Operation Id + /// Extensions_Get + /// + /// + /// + /// Id of extension resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string extensionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionId, nameof(extensionId)); + + using var scope = _extensionClientDiagnostics.CreateScope("ExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _extensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatCollection.cs index a9c4d2ae1df2..3c569c0799ec 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatCollection.cs @@ -334,6 +334,80 @@ public virtual Response Exists(string farmBeatsResourceName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName} + /// + /// + /// Operation Id + /// FarmBeatsModels_Get + /// + /// + /// + /// FarmBeats resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string farmBeatsResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(farmBeatsResourceName, nameof(farmBeatsResourceName)); + + using var scope = _farmBeatFarmBeatsModelsClientDiagnostics.CreateScope("FarmBeatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _farmBeatFarmBeatsModelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, farmBeatsResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FarmBeatResource(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.AgFoodPlatform/farmBeats/{farmBeatsResourceName} + /// + /// + /// Operation Id + /// FarmBeatsModels_Get + /// + /// + /// + /// FarmBeats resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string farmBeatsResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(farmBeatsResourceName, nameof(farmBeatsResourceName)); + + using var scope = _farmBeatFarmBeatsModelsClientDiagnostics.CreateScope("FarmBeatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _farmBeatFarmBeatsModelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, farmBeatsResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FarmBeatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionCollection.cs index 4b2ac358be3d..ee52902cc40a 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionCollection.cs @@ -258,6 +258,80 @@ public virtual Response Exists(string farmBeatsExtensionId, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions/{farmBeatsExtensionId} + /// + /// + /// Operation Id + /// FarmBeatsExtensions_Get + /// + /// + /// + /// farmBeatsExtensionId to be queried. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string farmBeatsExtensionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(farmBeatsExtensionId, nameof(farmBeatsExtensionId)); + + using var scope = _farmBeatsExtensionClientDiagnostics.CreateScope("FarmBeatsExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _farmBeatsExtensionRestClient.GetAsync(farmBeatsExtensionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FarmBeatsExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions/{farmBeatsExtensionId} + /// + /// + /// Operation Id + /// FarmBeatsExtensions_Get + /// + /// + /// + /// farmBeatsExtensionId to be queried. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string farmBeatsExtensionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(farmBeatsExtensionId, nameof(farmBeatsExtensionId)); + + using var scope = _farmBeatsExtensionClientDiagnostics.CreateScope("FarmBeatsExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _farmBeatsExtensionRestClient.Get(farmBeatsExtensionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FarmBeatsExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_AlertProcessingRuleCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_AlertProcessingRuleCollection.cs index 6a59888017b1..b42d35da7385 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_AlertProcessingRuleCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_AlertProcessingRuleCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetAlertProcessingRuleById() Console.WriteLine($"Succeeded: {result}"); } + // GetAlertProcessingRuleById + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAlertProcessingRuleById() + { + // Generated from example definition: specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_GetById.json + // this example is just showing the usage of "AlertProcessingRules_GetByName" 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 = "1e3ff1c0-771a-4119-a03b-be82a51e232d"; + string resourceGroupName = "alertscorrelationrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AlertProcessingRuleResource + AlertProcessingRuleCollection collection = resourceGroupResource.GetAlertProcessingRules(); + + // invoke the operation + string alertProcessingRuleName = "DailySuppression"; + NullableResponse response = await collection.GetIfExistsAsync(alertProcessingRuleName); + AlertProcessingRuleResource 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 + AlertProcessingRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a rule that adds an action group to all alerts in a subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_ServiceAlertCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_ServiceAlertCollection.cs index cba84cf10dfb..c6efe4fb9c9f 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_ServiceAlertCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_ServiceAlertCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,5 +116,46 @@ public async Task Exists_GetById() Console.WriteLine($"Succeeded: {result}"); } + + // GetById + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetById() + { + // Generated from example definition: specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/Alerts_GetById.json + // this example is just showing the usage of "Alerts_GetById" 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 = "9e261de7-c804-4b9d-9ebf-6f50fe350a9a"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ServiceAlertResource + ServiceAlertCollection collection = subscriptionResource.GetServiceAlerts(); + + // invoke the operation + Guid alertId = Guid.Parse("66114d64-d9d9-478b-95c9-b789d6502100"); + NullableResponse response = await collection.GetIfExistsAsync(alertId); + ServiceAlertResource 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 + ServiceAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_SmartGroupCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_SmartGroupCollection.cs index a76a030a7412..9d3656b77445 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_SmartGroupCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/samples/Generated/Samples/Sample_SmartGroupCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,5 +116,46 @@ public async Task Exists_Get() Console.WriteLine($"Succeeded: {result}"); } + + // Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_Get() + { + // Generated from example definition: specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_GetById.json + // this example is just showing the usage of "SmartGroups_GetById" 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 = "9e261de7-c804-4b9d-9ebf-6f50fe350a9a"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SmartGroupResource + SmartGroupCollection collection = subscriptionResource.GetSmartGroups(); + + // invoke the operation + Guid smartGroupId = Guid.Parse("603675da-9851-4b26-854a-49fc53d32715"); + NullableResponse response = await collection.GetIfExistsAsync(smartGroupId); + SmartGroupResource 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 + SmartGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleCollection.cs index 02b3a54561ad..249d4f929184 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string alertProcessingRuleName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules/{alertProcessingRuleName} + /// + /// + /// Operation Id + /// AlertProcessingRules_GetByName + /// + /// + /// + /// The name of the alert processing rule that needs to be fetched. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string alertProcessingRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertProcessingRuleName, nameof(alertProcessingRuleName)); + + using var scope = _alertProcessingRuleClientDiagnostics.CreateScope("AlertProcessingRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _alertProcessingRuleRestClient.GetByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, alertProcessingRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AlertProcessingRuleResource(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.AlertsManagement/actionRules/{alertProcessingRuleName} + /// + /// + /// Operation Id + /// AlertProcessingRules_GetByName + /// + /// + /// + /// The name of the alert processing rule that needs to be fetched. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string alertProcessingRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertProcessingRuleName, nameof(alertProcessingRuleName)); + + using var scope = _alertProcessingRuleClientDiagnostics.CreateScope("AlertProcessingRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _alertProcessingRuleRestClient.GetByName(Id.SubscriptionId, Id.ResourceGroupName, alertProcessingRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AlertProcessingRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertCollection.cs index 0e88f85e3802..946fcf3bb146 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertCollection.cs @@ -233,6 +233,72 @@ public virtual Response Exists(Guid alertId, CancellationToken cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId} + /// + /// + /// Operation Id + /// Alerts_GetById + /// + /// + /// + /// Unique ID of an alert instance. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid alertId, CancellationToken cancellationToken = default) + { + using var scope = _serviceAlertAlertsClientDiagnostics.CreateScope("ServiceAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceAlertAlertsRestClient.GetByIdAsync(Id.SubscriptionId, alertId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceAlertResource(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}/providers/Microsoft.AlertsManagement/alerts/{alertId} + /// + /// + /// Operation Id + /// Alerts_GetById + /// + /// + /// + /// Unique ID of an alert instance. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid alertId, CancellationToken cancellationToken = default) + { + using var scope = _serviceAlertAlertsClientDiagnostics.CreateScope("ServiceAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceAlertAlertsRestClient.GetById(Id.SubscriptionId, alertId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupCollection.cs index 7ee42b61672e..fa7ee201136e 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupCollection.cs @@ -233,6 +233,72 @@ public virtual Response Exists(Guid smartGroupId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId} + /// + /// + /// Operation Id + /// SmartGroups_GetById + /// + /// + /// + /// Smart group unique id. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid smartGroupId, CancellationToken cancellationToken = default) + { + using var scope = _smartGroupClientDiagnostics.CreateScope("SmartGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _smartGroupRestClient.GetByIdAsync(Id.SubscriptionId, smartGroupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SmartGroupResource(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}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId} + /// + /// + /// Operation Id + /// SmartGroups_GetById + /// + /// + /// + /// Smart group unique id. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid smartGroupId, CancellationToken cancellationToken = default) + { + using var scope = _smartGroupClientDiagnostics.CreateScope("SmartGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _smartGroupRestClient.GetById(Id.SubscriptionId, smartGroupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SmartGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerCollection.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerCollection.cs index cbd4bca2c2c8..05ad16a732df 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerCollection.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string serverName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_GetDetails + /// + /// + /// + /// The name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _analysisServerServersClientDiagnostics.CreateScope("AnalysisServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _analysisServerServersRestClient.GetDetailsAsync(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AnalysisServerResource(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.AnalysisServices/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_GetDetails + /// + /// + /// + /// The name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _analysisServerServersClientDiagnostics.CreateScope("AnalysisServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _analysisServerServersRestClient.GetDetails(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AnalysisServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/samples/Generated/Samples/Sample_ApiCenterServiceCollection.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/samples/Generated/Samples/Sample_ApiCenterServiceCollection.cs index 9e7bcb6f0285..539422b17f42 100644 --- a/sdk/apicenter/Azure.ResourceManager.ApiCenter/samples/Generated/Samples/Sample_ApiCenterServiceCollection.cs +++ b/sdk/apicenter/Azure.ResourceManager.ApiCenter/samples/Generated/Samples/Sample_ApiCenterServiceCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_ServicesGet() Console.WriteLine($"Succeeded: {result}"); } + // Services_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServicesGet() + { + // Generated from example definition: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json + // this example is just showing the usage of "Services_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 = "contoso-resources"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApiCenterServiceResource + ApiCenterServiceCollection collection = resourceGroupResource.GetApiCenterServices(); + + // invoke the operation + string serviceName = "contoso"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + ApiCenterServiceResource 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 + ApiCenterServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Services_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/ApiCenterServiceCollection.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/ApiCenterServiceCollection.cs index d117efcb0039..68ba10094c94 100644 --- a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/ApiCenterServiceCollection.cs +++ b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/ApiCenterServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Service name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _apiCenterServiceServicesClientDiagnostics.CreateScope("ApiCenterServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiCenterServiceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiCenterServiceResource(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.ApiCenter/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Service name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _apiCenterServiceServicesClientDiagnostics.CreateScope("ApiCenterServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiCenterServiceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiCenterServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiCollection.cs index 8e7bbfe1791f..17cd08900859 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetApiContract() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiContract + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiContract() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json + // this example is just showing the usage of "Api_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiResource + ApiCollection collection = apiManagementService.GetApis(); + + // invoke the operation + string apiId = "57d1f7558aa04f15146d9d8a"; + NullableResponse response = await collection.GetIfExistsAsync(apiId); + ApiResource 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 + ApiData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementGetApiRevisionContract [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_ApiManagementGetApiRevisionContract() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiRevisionContract + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiRevisionContract() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json + // this example is just showing the usage of "Api_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiResource + ApiCollection collection = apiManagementService.GetApis(); + + // invoke the operation + string apiId = "echo-api;rev=3"; + NullableResponse response = await collection.GetIfExistsAsync(apiId); + ApiResource 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 + ApiData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApi [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticCollection.cs index 0f80434ab330..7725d29db747 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_ApiManagementGetApiDiagnostic() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiDiagnostic + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiDiagnostic() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiDiagnostic.json + // this example is just showing the usage of "ApiDiagnostic_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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiDiagnosticResource + ApiDiagnosticCollection collection = api.GetApiDiagnostics(); + + // invoke the operation + string diagnosticId = "applicationinsights"; + NullableResponse response = await collection.GetIfExistsAsync(diagnosticId); + ApiDiagnosticResource 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 + DiagnosticContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiDiagnostic [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentCollection.cs index 5700da9bad5a..5d721e68821a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentCollection.cs @@ -126,6 +126,51 @@ public async Task Exists_ApiManagementGetApiIssueAttachment() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiIssueAttachment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiIssueAttachment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueAttachment.json + // this example is just showing the usage of "ApiIssueAttachment_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 ApiIssueResource created on azure + // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + string issueId = "57d2ef278aa04f0ad01d6cdc"; + ResourceIdentifier apiIssueResourceId = ApiIssueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, issueId); + ApiIssueResource apiIssue = client.GetApiIssueResource(apiIssueResourceId); + + // get the collection of this ApiIssueAttachmentResource + ApiIssueAttachmentCollection collection = apiIssue.GetApiIssueAttachments(); + + // invoke the operation + string attachmentId = "57d2ef278aa04f0888cba3f3"; + NullableResponse response = await collection.GetIfExistsAsync(attachmentId); + ApiIssueAttachmentResource 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 + ApiIssueAttachmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiIssueAttachment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCollection.cs index 244f8706c4a6..4ac49f237fe4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_ApiManagementGetApiIssue() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiIssue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiIssue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssue.json + // this example is just showing the usage of "ApiIssue_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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiIssueResource + ApiIssueCollection collection = api.GetApiIssues(); + + // invoke the operation + string issueId = "57d2ef278aa04f0ad01d6cdc"; + NullableResponse response = await collection.GetIfExistsAsync(issueId); + ApiIssueResource 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 + IssueContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiIssue [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentCollection.cs index 0edf171d37c4..a7d901dc8d7c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentCollection.cs @@ -126,6 +126,51 @@ public async Task Exists_ApiManagementGetApiIssueComment() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiIssueComment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiIssueComment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueComment.json + // this example is just showing the usage of "ApiIssueComment_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 ApiIssueResource created on azure + // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + string issueId = "57d2ef278aa04f0ad01d6cdc"; + ResourceIdentifier apiIssueResourceId = ApiIssueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, issueId); + ApiIssueResource apiIssue = client.GetApiIssueResource(apiIssueResourceId); + + // get the collection of this ApiIssueCommentResource + ApiIssueCommentCollection collection = apiIssue.GetApiIssueComments(); + + // invoke the operation + string commentId = "599e29ab193c3c0bd0b3e2fb"; + NullableResponse response = await collection.GetIfExistsAsync(commentId); + ApiIssueCommentResource 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 + ApiIssueCommentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiIssueComment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerCollection.cs index df41b19e7142..13f8dfc7b3e3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetAuthorizationServer() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetAuthorizationServer + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetAuthorizationServer() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetAuthorizationServer.json + // this example is just showing the usage of "AuthorizationServer_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementAuthorizationServerResource + ApiManagementAuthorizationServerCollection collection = apiManagementService.GetApiManagementAuthorizationServers(); + + // invoke the operation + string authsid = "newauthServer2"; + NullableResponse response = await collection.GetIfExistsAsync(authsid); + ApiManagementAuthorizationServerResource 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 + ApiManagementAuthorizationServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateAuthorizationServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendCollection.cs index e04da69e4fe4..050c204923df 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetBackend() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetBackend + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetBackend() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetBackend.json + // this example is just showing the usage of "Backend_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementBackendResource + ApiManagementBackendCollection collection = apiManagementService.GetApiManagementBackends(); + + // invoke the operation + string backendId = "sfbackend"; + NullableResponse response = await collection.GetIfExistsAsync(backendId); + ApiManagementBackendResource 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 + ApiManagementBackendData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateBackendProxyBackend [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheCollection.cs index 22decf30b997..02f39d1e2a7a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ApiManagementGetCache() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetCache + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetCache() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCache.json + // this example is just showing the usage of "Cache_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementCacheResource + ApiManagementCacheCollection collection = apiManagementService.GetApiManagementCaches(); + + // invoke the operation + string cacheId = "c1"; + NullableResponse response = await collection.GetIfExistsAsync(cacheId); + ApiManagementCacheResource 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 + ApiManagementCacheData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateCache [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateCollection.cs index 8cdaeb265b08..8493cd23adde 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetCertificate() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetCertificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetCertificate() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificate.json + // this example is just showing the usage of "Certificate_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementCertificateResource + ApiManagementCertificateCollection collection = apiManagementService.GetApiManagementCertificates(); + + // invoke the operation + string certificateId = "templateCert1"; + NullableResponse response = await collection.GetIfExistsAsync(certificateId); + ApiManagementCertificateResource 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 + ApiManagementCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementGetCertificateWithKeyVault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_ApiManagementGetCertificateWithKeyVault() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetCertificateWithKeyVault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetCertificateWithKeyVault() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificateWithKeyVault.json + // this example is just showing the usage of "Certificate_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementCertificateResource + ApiManagementCertificateCollection collection = apiManagementService.GetApiManagementCertificates(); + + // invoke the operation + string certificateId = "templateCertkv"; + NullableResponse response = await collection.GetIfExistsAsync(certificateId); + ApiManagementCertificateResource 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 + ApiManagementCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateCertificate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceCollection.cs index a60919da574d..47656bda9ea9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -80,5 +81,47 @@ public async Task Exists_ApiManagementGetDeletedServiceByName() Console.WriteLine($"Succeeded: {result}"); } + + // ApiManagementGetDeletedServiceByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetDeletedServiceByName() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDeletedServiceByName.json + // this example is just showing the usage of "DeletedServices_GetByName" 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 = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ApiManagementDeletedServiceResource + ApiManagementDeletedServiceCollection collection = subscriptionResource.GetApiManagementDeletedServices(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + string serviceName = "apimService3"; + NullableResponse response = await collection.GetIfExistsAsync(location, serviceName); + ApiManagementDeletedServiceResource 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 + ApiManagementDeletedServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticCollection.cs index eaca13f1d6cf..ebbc3b7fcc77 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetDiagnostic() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetDiagnostic + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetDiagnostic() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDiagnostic.json + // this example is just showing the usage of "Diagnostic_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementDiagnosticResource + ApiManagementDiagnosticCollection collection = apiManagementService.GetApiManagementDiagnostics(); + + // invoke the operation + string diagnosticId = "applicationinsights"; + NullableResponse response = await collection.GetIfExistsAsync(diagnosticId); + ApiManagementDiagnosticResource 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 + DiagnosticContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateDiagnostic [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateCollection.cs index beb26969e9fe..27a117015fea 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetTemplate() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetTemplate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetTemplate() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTemplate.json + // this example is just showing the usage of "EmailTemplate_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementEmailTemplateResource + ApiManagementEmailTemplateCollection collection = apiManagementService.GetApiManagementEmailTemplates(); + + // invoke the operation + TemplateName templateName = TemplateName.NewIssueNotificationMessage; + NullableResponse response = await collection.GetIfExistsAsync(templateName); + ApiManagementEmailTemplateResource 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 + ApiManagementEmailTemplateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateTemplate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityCollection.cs index a135673759eb..a05cf0e4a7db 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_ApiManagementGetGatewayCertificateAuthority() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetGatewayCertificateAuthority + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetGatewayCertificateAuthority() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayCertificateAuthority.json + // this example is just showing the usage of "GatewayCertificateAuthority_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 ApiManagementGatewayResource created on azure + // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string gatewayId = "gw1"; + ResourceIdentifier apiManagementGatewayResourceId = ApiManagementGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, gatewayId); + ApiManagementGatewayResource apiManagementGateway = client.GetApiManagementGatewayResource(apiManagementGatewayResourceId); + + // get the collection of this ApiManagementGatewayCertificateAuthorityResource + ApiManagementGatewayCertificateAuthorityCollection collection = apiManagementGateway.GetApiManagementGatewayCertificateAuthorities(); + + // invoke the operation + string certificateId = "cert1"; + NullableResponse response = await collection.GetIfExistsAsync(certificateId); + ApiManagementGatewayCertificateAuthorityResource 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 + ApiManagementGatewayCertificateAuthorityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateGatewayCertificateAuthority [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCollection.cs index 3d882ff18ecc..9066d33ee99e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetGateway() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetGateway + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetGateway() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGateway.json + // this example is just showing the usage of "Gateway_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementGatewayResource + ApiManagementGatewayCollection collection = apiManagementService.GetApiManagementGateways(); + + // invoke the operation + string gatewayId = "gw1"; + NullableResponse response = await collection.GetIfExistsAsync(gatewayId); + ApiManagementGatewayResource 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 + ApiManagementGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateGateway [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationCollection.cs index 693a1c93881e..3dad54e229e3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_ApiManagementGetGatewayHostnameConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetGatewayHostnameConfiguration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetGatewayHostnameConfiguration() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayHostnameConfiguration.json + // this example is just showing the usage of "GatewayHostnameConfiguration_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 ApiManagementGatewayResource created on azure + // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string gatewayId = "gw1"; + ResourceIdentifier apiManagementGatewayResourceId = ApiManagementGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, gatewayId); + ApiManagementGatewayResource apiManagementGateway = client.GetApiManagementGatewayResource(apiManagementGatewayResourceId); + + // get the collection of this ApiManagementGatewayHostnameConfigurationResource + ApiManagementGatewayHostnameConfigurationCollection collection = apiManagementGateway.GetApiManagementGatewayHostnameConfigurations(); + + // invoke the operation + string hcId = "default"; + NullableResponse response = await collection.GetIfExistsAsync(hcId); + ApiManagementGatewayHostnameConfigurationResource 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 + ApiManagementGatewayHostnameConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateGatewayHostnameConfiguration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaCollection.cs index 14314f7c194e..ae4cf6a530f9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_ApiManagementGetSchema1() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetSchema1 + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetSchema1() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema1.json + // this example is just showing the usage of "GlobalSchema_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementGlobalSchemaResource + ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + + // invoke the operation + string schemaId = "schema1"; + NullableResponse response = await collection.GetIfExistsAsync(schemaId); + ApiManagementGlobalSchemaResource 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 + ApiManagementGlobalSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementGetSchema2 [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -188,6 +231,49 @@ public async Task Exists_ApiManagementGetSchema2() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetSchema2 + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetSchema2() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema2.json + // this example is just showing the usage of "GlobalSchema_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementGlobalSchemaResource + ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + + // invoke the operation + string schemaId = "schema2"; + NullableResponse response = await collection.GetIfExistsAsync(schemaId); + ApiManagementGlobalSchemaResource 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 + ApiManagementGlobalSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateSchema1 [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupCollection.cs index 59568f02a530..7c3385402ade 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetGroup() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGroup.json + // this example is just showing the usage of "Group_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementGroupResource + ApiManagementGroupCollection collection = apiManagementService.GetApiManagementGroups(); + + // invoke the operation + string groupId = "59306a29e4bbd510dc24e5f9"; + NullableResponse response = await collection.GetIfExistsAsync(groupId); + ApiManagementGroupResource 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 + ApiManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderCollection.cs index 138680049056..20f04fc29b80 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetIdentityProvider() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetIdentityProvider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetIdentityProvider() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIdentityProvider.json + // this example is just showing the usage of "IdentityProvider_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementIdentityProviderResource + ApiManagementIdentityProviderCollection collection = apiManagementService.GetApiManagementIdentityProviders(); + + // invoke the operation + IdentityProviderType identityProviderName = IdentityProviderType.AadB2C; + NullableResponse response = await collection.GetIfExistsAsync(identityProviderName); + ApiManagementIdentityProviderResource 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 + ApiManagementIdentityProviderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateIdentityProvider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueCollection.cs index f5ddba2c9625..bc75552f6e90 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_ApiManagementGetIssue() Console.WriteLine($"Succeeded: {result}"); } + + // ApiManagementGetIssue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetIssue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIssue.json + // this example is just showing the usage of "Issue_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementIssueResource + ApiManagementIssueCollection collection = apiManagementService.GetApiManagementIssues(); + + // invoke the operation + string issueId = "57d2ef278aa04f0ad01d6cdc"; + NullableResponse response = await collection.GetIfExistsAsync(issueId); + ApiManagementIssueResource 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 + IssueContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerCollection.cs index 7d66504b8ab4..ffa87a52e2b6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetLogger() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetLogger + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetLogger() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetLogger.json + // this example is just showing the usage of "Logger_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementLoggerResource + ApiManagementLoggerCollection collection = apiManagementService.GetApiManagementLoggers(); + + // invoke the operation + string loggerId = "templateLogger"; + NullableResponse response = await collection.GetIfExistsAsync(loggerId); + ApiManagementLoggerResource 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 + ApiManagementLoggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateAILogger [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueCollection.cs index c0dc138f52b4..ef74092927be 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetNamedValue() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValue.json + // this example is just showing the usage of "NamedValue_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementNamedValueResource + ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + + // invoke the operation + string namedValueId = "testarmTemplateproperties2"; + NullableResponse response = await collection.GetIfExistsAsync(namedValueId); + ApiManagementNamedValueResource 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementGetNamedValueWithKeyVault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_ApiManagementGetNamedValueWithKeyVault() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetNamedValueWithKeyVault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetNamedValueWithKeyVault() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValueWithKeyVault.json + // this example is just showing the usage of "NamedValue_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementNamedValueResource + ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + + // invoke the operation + string namedValueId = "testprop6"; + NullableResponse response = await collection.GetIfExistsAsync(namedValueId); + ApiManagementNamedValueResource 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateNamedValue [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationCollection.cs index 14ca2801c474..59bf37d74163 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetNotification() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetNotification + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetNotification() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNotification.json + // this example is just showing the usage of "Notification_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementNotificationResource + ApiManagementNotificationCollection collection = apiManagementService.GetApiManagementNotifications(); + + // invoke the operation + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + NullableResponse response = await collection.GetIfExistsAsync(notificationName); + ApiManagementNotificationResource 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 + ApiManagementNotificationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateNotification [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderCollection.cs index ae83672b40fb..0172734dfc86 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ApiManagementGetOpenIdConnectProvider() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetOpenIdConnectProvider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetOpenIdConnectProvider() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetOpenIdConnectProvider.json + // this example is just showing the usage of "OpenIdConnectProvider_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementOpenIdConnectProviderResource + ApiManagementOpenIdConnectProviderCollection collection = apiManagementService.GetApiManagementOpenIdConnectProviders(); + + // invoke the operation + string openId = "templateOpenIdConnect2"; + NullableResponse response = await collection.GetIfExistsAsync(openId); + ApiManagementOpenIdConnectProviderResource 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 + ApiManagementOpenIdConnectProviderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateOpenIdConnectProvider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyCollection.cs index d3e8bfd8d243..aa6b16663b58 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetPolicy() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicy.json + // this example is just showing the usage of "Policy_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementPolicyResource + ApiManagementPolicyCollection collection = apiManagementService.GetApiManagementPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ApiManagementPolicyResource 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 + PolicyContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementGetPolicyFormat [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -189,6 +232,50 @@ public async Task Exists_ApiManagementGetPolicyFormat() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetPolicyFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetPolicyFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicyFormat.json + // this example is just showing the usage of "Policy_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementPolicyResource + ApiManagementPolicyCollection collection = apiManagementService.GetApiManagementPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + PolicyExportFormat? format = PolicyExportFormat.RawXml; + NullableResponse response = await collection.GetIfExistsAsync(policyId, format: format); + ApiManagementPolicyResource 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 + PolicyContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreatePolicy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionCollection.cs index 9dc2f38c703b..053a0ea0a840 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ApiManagementGetPortalRevision() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetPortalRevision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetPortalRevision() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPortalRevision.json + // this example is just showing the usage of "PortalRevision_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementPortalRevisionResource + ApiManagementPortalRevisionCollection collection = apiManagementService.GetApiManagementPortalRevisions(); + + // invoke the operation + string portalRevisionId = "20201112101010"; + NullableResponse response = await collection.GetIfExistsAsync(portalRevisionId); + ApiManagementPortalRevisionResource 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 + ApiManagementPortalRevisionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreatePortalRevision [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionCollection.cs index 50e3f927b094..0f4641dc55c9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetPrivateEndpointConnection() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_GetByName" 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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementPrivateEndpointConnectionResource + ApiManagementPrivateEndpointConnectionCollection collection = apiManagementService.GetApiManagementPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + ApiManagementPrivateEndpointConnectionResource 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 + ApiManagementPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementApproveOrRejectPrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResourceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResourceCollection.cs index 0db84f818280..e4b99ed9e1ff 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResourceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_ApiManagementGetPrivateLinkGroupResource() Console.WriteLine($"Succeeded: {result}"); } + + // ApiManagementGetPrivateLinkGroupResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetPrivateLinkGroupResource() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateLinkGroupResource.json + // this example is just showing the usage of "PrivateEndpointConnection_GetPrivateLinkResource" 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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementPrivateLinkResource + ApiManagementPrivateLinkResourceCollection collection = apiManagementService.GetApiManagementPrivateLinkResources(); + + // invoke the operation + string privateLinkSubResourceName = "privateLinkSubResourceName"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkSubResourceName); + ApiManagementPrivateLinkResource 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 + ApiManagementPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductCollection.cs index b6d517924922..0df12fb9abbe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ApiManagementGetProduct() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProduct.json + // this example is just showing the usage of "Product_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementProductResource + ApiManagementProductCollection collection = apiManagementService.GetApiManagementProducts(); + + // invoke the operation + string productId = "unlimited"; + NullableResponse response = await collection.GetIfExistsAsync(productId); + ApiManagementProductResource 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 + ApiManagementProductData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateProduct [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyCollection.cs index 31ae17f286d7..01f4866eb7c2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_ApiManagementGetProductPolicy() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductPolicy.json + // this example is just showing the usage of "ProductPolicy_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 ApiManagementProductResource created on azure + // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "kjoshiarmTemplateProduct4"; + ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + + // get the collection of this ApiManagementProductPolicyResource + ApiManagementProductPolicyCollection collection = apiManagementProduct.GetApiManagementProductPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ApiManagementProductPolicyResource 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 + PolicyContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateProductPolicy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagCollection.cs index ca877dffaa17..04c066c61035 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_ApiManagementGetProductTag() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetProductTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetProductTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductTag.json + // this example is just showing the usage of "Tag_GetByProduct" 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 ApiManagementProductResource created on azure + // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "59d6bb8f1f7fab13dc67ec9b"; + ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + + // get the collection of this ApiManagementProductTagResource + ApiManagementProductTagCollection collection = apiManagementProduct.GetApiManagementProductTags(); + + // invoke the operation + string tagId = "59306a29e4bbd510dc24e5f9"; + NullableResponse response = await collection.GetIfExistsAsync(tagId); + ApiManagementProductTagResource 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 + TagContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateProductTag [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceCollection.cs index 5c608b074acb..3a9ab03e0e28 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceCollection.cs @@ -556,6 +556,48 @@ public async Task Exists_ApiManagementServiceGetMultiRegionInternalVnet() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementServiceGetMultiRegionInternalVnet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementServiceGetMultiRegionInternalVnet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetMultiRegionInternalVnet.json + // this example is just showing the usage of "ApiManagementService_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApiManagementServiceResource + ApiManagementServiceCollection collection = resourceGroupResource.GetApiManagementServices(); + + // invoke the operation + string serviceName = "apimService1"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + ApiManagementServiceResource 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 + ApiManagementServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementServiceGetService [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -620,6 +662,48 @@ public async Task Exists_ApiManagementServiceGetService() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementServiceGetService + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementServiceGetService() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetService.json + // this example is just showing the usage of "ApiManagementService_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApiManagementServiceResource + ApiManagementServiceCollection collection = resourceGroupResource.GetApiManagementServices(); + + // invoke the operation + string serviceName = "apimService1"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + ApiManagementServiceResource 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 + ApiManagementServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementServiceGetServiceHavingMsi [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -684,6 +768,48 @@ public async Task Exists_ApiManagementServiceGetServiceHavingMsi() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementServiceGetServiceHavingMsi + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementServiceGetServiceHavingMsi() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetServiceHavingMsi.json + // this example is just showing the usage of "ApiManagementService_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApiManagementServiceResource + ApiManagementServiceCollection collection = resourceGroupResource.GetApiManagementServices(); + + // invoke the operation + string serviceName = "apimService1"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + ApiManagementServiceResource 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 + ApiManagementServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementListServiceBySubscriptionAndResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionCollection.cs index 44d177d76398..f45fba3ab2fc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetSubscription() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetSubscription.json + // this example is just showing the usage of "Subscription_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementSubscriptionResource + ApiManagementSubscriptionCollection collection = apiManagementService.GetApiManagementSubscriptions(); + + // invoke the operation + string sid = "5931a769d8d14f0ad8ce13b8"; + NullableResponse response = await collection.GetIfExistsAsync(sid); + ApiManagementSubscriptionResource 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 + SubscriptionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateSubscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagCollection.cs index 5d0523bc0b7a..72d858c19c0c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetTag() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTag.json + // this example is just showing the usage of "Tag_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementTagResource + ApiManagementTagCollection collection = apiManagementService.GetApiManagementTags(); + + // invoke the operation + string tagId = "59306a29e4bbd510dc24e5f9"; + NullableResponse response = await collection.GetIfExistsAsync(tagId); + ApiManagementTagResource 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 + TagContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateTag [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingCollection.cs index e8fd4b957bb6..e1ed9210e5ca 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,5 +120,48 @@ public async Task Exists_ApiManagementGetTenantSettings() Console.WriteLine($"Succeeded: {result}"); } + + // ApiManagementGetTenantSettings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetTenantSettings() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantSettings.json + // this example is just showing the usage of "TenantSettings_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementTenantSettingResource + ApiManagementTenantSettingCollection collection = apiManagementService.GetApiManagementTenantSettings(); + + // invoke the operation + SettingsType settingsType = SettingsType.Public; + NullableResponse response = await collection.GetIfExistsAsync(settingsType); + ApiManagementTenantSettingResource 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 + ApiManagementTenantSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserCollection.cs index 66f66fc628c5..374ddef4b0ae 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetUser() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetUser() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUser.json + // this example is just showing the usage of "User_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiManagementUserResource + ApiManagementUserCollection collection = apiManagementService.GetApiManagementUsers(); + + // invoke the operation + string userId = "5931a75ae4bbd512a88c680b"; + NullableResponse response = await collection.GetIfExistsAsync(userId); + ApiManagementUserResource 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 + UserContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateUser [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionCollection.cs index 1817597f23e5..9fc940a8fd33 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_ApiManagementGetUserSubscription() Console.WriteLine($"Succeeded: {result}"); } + + // ApiManagementGetUserSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetUserSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUserSubscription.json + // this example is just showing the usage of "UserSubscription_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 ApiManagementUserResource created on azure + // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string userId = "1"; + ResourceIdentifier apiManagementUserResourceId = ApiManagementUserResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, userId); + ApiManagementUserResource apiManagementUser = client.GetApiManagementUserResource(apiManagementUserResourceId); + + // get the collection of this ApiManagementUserSubscriptionResource + ApiManagementUserSubscriptionCollection collection = apiManagementUser.GetApiManagementUserSubscriptions(); + + // invoke the operation + string sid = "5fa9b096f3df14003c070001"; + NullableResponse response = await collection.GetIfExistsAsync(sid); + ApiManagementUserSubscriptionResource 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 + SubscriptionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationCollection.cs index 099f86d8bb2b..00e03b31dfab 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_ApiManagementGetApiOperation() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperation.json + // this example is just showing the usage of "ApiOperation_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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiOperationResource + ApiOperationCollection collection = api.GetApiOperations(); + + // invoke the operation + string operationId = "57d2ef278aa04f0ad01d6cdc"; + NullableResponse response = await collection.GetIfExistsAsync(operationId); + ApiOperationResource 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 + ApiOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementGetApiOperationPetStore [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -192,6 +236,50 @@ public async Task Exists_ApiManagementGetApiOperationPetStore() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiOperationPetStore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiOperationPetStore() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPetStore.json + // this example is just showing the usage of "ApiOperation_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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "swagger-petstore"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiOperationResource + ApiOperationCollection collection = api.GetApiOperations(); + + // invoke the operation + string operationId = "loginUser"; + NullableResponse response = await collection.GetIfExistsAsync(operationId); + ApiOperationResource 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 + ApiOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiOperation [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyCollection.cs index 72bcc4fb0cba..3fa98f2122bb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_ApiManagementGetApiOperationPolicy() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPolicy.json + // this example is just showing the usage of "ApiOperationPolicy_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 ApiOperationResource created on azure + // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b539c53f5b0062040001"; + string operationId = "5600b53ac53f5b0062080006"; + ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + + // get the collection of this ApiOperationPolicyResource + ApiOperationPolicyCollection collection = apiOperation.GetApiOperationPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ApiOperationPolicyResource 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 + PolicyContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiOperationPolicy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagCollection.cs index 025ad8ea5cf4..6218fa6e32af 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagCollection.cs @@ -126,6 +126,51 @@ public async Task Exists_ApiManagementGetApiOperationTag() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiOperationTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiOperationTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationTag.json + // this example is just showing the usage of "Tag_GetByOperation" 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 ApiOperationResource created on azure + // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + string operationId = "59d6bb8f1f7fab13dc67ec9a"; + ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + + // get the collection of this ApiOperationTagResource + ApiOperationTagCollection collection = apiOperation.GetApiOperationTags(); + + // invoke the operation + string tagId = "59306a29e4bbd510dc24e5f9"; + NullableResponse response = await collection.GetIfExistsAsync(tagId); + ApiOperationTagResource 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 + TagContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiOperationTag [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyCollection.cs index 0f7866b40048..69a997dc8545 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_ApiManagementGetApiPolicy() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiPolicy.json + // this example is just showing the usage of "ApiPolicy_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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b59475ff190048040001"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiPolicyResource + ApiPolicyCollection collection = api.GetApiPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ApiPolicyResource 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 + PolicyContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiPolicy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseCollection.cs index b5529032457a..aa572c0db30f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_ApiManagementGetApiRelease() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRelease.json + // this example is just showing the usage of "ApiRelease_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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "a1"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiReleaseResource + ApiReleaseCollection collection = api.GetApiReleases(); + + // invoke the operation + string releaseId = "5a7cb545298324c53224a799"; + NullableResponse response = await collection.GetIfExistsAsync(releaseId); + ApiReleaseResource 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 + ApiReleaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiRelease [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaCollection.cs index be563ed1c064..4cbec153e638 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_ApiManagementGetApiSchema() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiSchema.json + // this example is just showing the usage of "ApiSchema_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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiSchemaResource + ApiSchemaCollection collection = api.GetApiSchemas(); + + // invoke the operation + string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; + NullableResponse response = await collection.GetIfExistsAsync(schemaId); + ApiSchemaResource 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 + ApiSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiSchema [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagCollection.cs index a69d0d5bd3cd..70f1dfdf1db9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_ApiManagementGetApiTag() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTag.json + // this example is just showing the usage of "Tag_GetByApi" 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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiTagResource + ApiTagCollection collection = api.GetApiTags(); + + // invoke the operation + string tagId = "59306a29e4bbd510dc24e5f9"; + NullableResponse response = await collection.GetIfExistsAsync(tagId); + ApiTagResource 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 + TagContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiTag [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionCollection.cs index 024647a87d3f..c9ab5fdf29f0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_ApiManagementGetApiTagDescription() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiTagDescription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiTagDescription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTagDescription.json + // this example is just showing the usage of "ApiTagDescription_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 ApiResource created on azure + // for more information of creating ApiResource, please refer to the document of ApiResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ApiResource api = client.GetApiResource(apiResourceId); + + // get the collection of this ApiTagDescriptionResource + ApiTagDescriptionCollection collection = api.GetApiTagDescriptions(); + + // invoke the operation + string tagDescriptionId = "59306a29e4bbd510dc24e5f9"; + NullableResponse response = await collection.GetIfExistsAsync(tagDescriptionId); + ApiTagDescriptionResource 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 + ApiTagDescriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiTagDescription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetCollection.cs index 83f1af8db885..989aac4df500 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetApiVersionSet() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiVersionSet.json + // this example is just showing the usage of "ApiVersionSet_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this ApiVersionSetResource + ApiVersionSetCollection collection = apiManagementService.GetApiVersionSets(); + + // invoke the operation + string versionSetId = "vs1"; + NullableResponse response = await collection.GetIfExistsAsync(versionSetId); + ApiVersionSetResource 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 + ApiVersionSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateApiVersionSet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoCollection.cs index 0a489d2f7480..e388b789d238 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ApiManagementGetTenantAccess() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetTenantAccess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetTenantAccess() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantAccess.json + // this example is just showing the usage of "TenantAccess_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this TenantAccessInfoResource + TenantAccessInfoCollection collection = apiManagementService.GetTenantAccessInfos(); + + // invoke the operation + AccessName accessName = AccessName.TenantAccess; + NullableResponse response = await collection.GetIfExistsAsync(accessName); + TenantAccessInfoResource 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 + TenantAccessInfoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementGetTenantGitAccess [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_ApiManagementGetTenantGitAccess() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGetTenantGitAccess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetTenantGitAccess() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantGitAccess.json + // this example is just showing the usage of "TenantAccess_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 ApiManagementServiceResource created on azure + // for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId); + + // get the collection of this TenantAccessInfoResource + TenantAccessInfoCollection collection = apiManagementService.GetTenantAccessInfos(); + + // invoke the operation + AccessName accessName = AccessName.TenantGitAccess; + NullableResponse response = await collection.GetIfExistsAsync(accessName); + TenantAccessInfoResource 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 + TenantAccessInfoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ApiManagementCreateTenantAccess [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs index 8a8d15ccc338..cfe519da3975 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs @@ -336,6 +336,80 @@ public virtual Response Exists(string apiId, CancellationToken cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId} + /// + /// + /// Operation Id + /// Api_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiResource(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.ApiManagement/service/{serviceName}/apis/{apiId} + /// + /// + /// Operation Id + /// Api_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs index fff6ad568c0e..08e1f015f9e1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string diagnosticId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId} + /// + /// + /// Operation Id + /// ApiDiagnostic_Get + /// + /// + /// + /// Diagnostic identifier. Must be unique in the current API Management service 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 diagnosticId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticId, nameof(diagnosticId)); + + using var scope = _apiDiagnosticClientDiagnostics.CreateScope("ApiDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiDiagnosticRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diagnosticId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiDiagnosticResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId} + /// + /// + /// Operation Id + /// ApiDiagnostic_Get + /// + /// + /// + /// Diagnostic identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diagnosticId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticId, nameof(diagnosticId)); + + using var scope = _apiDiagnosticClientDiagnostics.CreateScope("ApiDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiDiagnosticRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diagnosticId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiDiagnosticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentCollection.cs index b2d2865dd4b4..8d8743773b44 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string attachmentId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId} + /// + /// + /// Operation Id + /// ApiIssueAttachment_Get + /// + /// + /// + /// Attachment identifier within an Issue. Must be unique in the current Issue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string attachmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachmentId, nameof(attachmentId)); + + using var scope = _apiIssueAttachmentClientDiagnostics.CreateScope("ApiIssueAttachmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiIssueAttachmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, attachmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiIssueAttachmentResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId} + /// + /// + /// Operation Id + /// ApiIssueAttachment_Get + /// + /// + /// + /// Attachment identifier within an Issue. Must be unique in the current Issue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string attachmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachmentId, nameof(attachmentId)); + + using var scope = _apiIssueAttachmentClientDiagnostics.CreateScope("ApiIssueAttachmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiIssueAttachmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, attachmentId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiIssueAttachmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs index 30f702bdb86d..b21ec3c943c0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs @@ -337,6 +337,82 @@ public virtual Response Exists(string issueId, bool? expandCommentsAttachm } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId} + /// + /// + /// Operation Id + /// ApiIssue_Get + /// + /// + /// + /// Issue identifier. Must be unique in the current API Management service instance. + /// Expand the comment attachments. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string issueId, bool? expandCommentsAttachments = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(issueId, nameof(issueId)); + + using var scope = _apiIssueClientDiagnostics.CreateScope("ApiIssueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiIssueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, issueId, expandCommentsAttachments, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiIssueResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId} + /// + /// + /// Operation Id + /// ApiIssue_Get + /// + /// + /// + /// Issue identifier. Must be unique in the current API Management service instance. + /// Expand the comment attachments. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string issueId, bool? expandCommentsAttachments = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(issueId, nameof(issueId)); + + using var scope = _apiIssueClientDiagnostics.CreateScope("ApiIssueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiIssueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, issueId, expandCommentsAttachments, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiIssueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentCollection.cs index 9a477239b530..1bb6558ec773 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string commentId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId} + /// + /// + /// Operation Id + /// ApiIssueComment_Get + /// + /// + /// + /// Comment identifier within an Issue. Must be unique in the current Issue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string commentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commentId, nameof(commentId)); + + using var scope = _apiIssueCommentClientDiagnostics.CreateScope("ApiIssueCommentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiIssueCommentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, commentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiIssueCommentResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId} + /// + /// + /// Operation Id + /// ApiIssueComment_Get + /// + /// + /// + /// Comment identifier within an Issue. Must be unique in the current Issue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string commentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commentId, nameof(commentId)); + + using var scope = _apiIssueCommentClientDiagnostics.CreateScope("ApiIssueCommentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiIssueCommentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, commentId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiIssueCommentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerCollection.cs index 6648a87e8b36..d50a34b1cb08 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string authsid, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid} + /// + /// + /// Operation Id + /// AuthorizationServer_Get + /// + /// + /// + /// Identifier of the authorization server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authsid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authsid, nameof(authsid)); + + using var scope = _apiManagementAuthorizationServerAuthorizationServerClientDiagnostics.CreateScope("ApiManagementAuthorizationServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementAuthorizationServerAuthorizationServerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authsid, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementAuthorizationServerResource(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.ApiManagement/service/{serviceName}/authorizationServers/{authsid} + /// + /// + /// Operation Id + /// AuthorizationServer_Get + /// + /// + /// + /// Identifier of the authorization server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authsid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authsid, nameof(authsid)); + + using var scope = _apiManagementAuthorizationServerAuthorizationServerClientDiagnostics.CreateScope("ApiManagementAuthorizationServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementAuthorizationServerAuthorizationServerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authsid, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementAuthorizationServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendCollection.cs index f105537ba369..24fab0cf36cc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string backendId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId} + /// + /// + /// Operation Id + /// Backend_Get + /// + /// + /// + /// Identifier of the Backend entity. Must be unique in the current API Management service 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 backendId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backendId, nameof(backendId)); + + using var scope = _apiManagementBackendBackendClientDiagnostics.CreateScope("ApiManagementBackendCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementBackendBackendRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backendId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementBackendResource(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.ApiManagement/service/{serviceName}/backends/{backendId} + /// + /// + /// Operation Id + /// Backend_Get + /// + /// + /// + /// Identifier of the Backend entity. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backendId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backendId, nameof(backendId)); + + using var scope = _apiManagementBackendBackendClientDiagnostics.CreateScope("ApiManagementBackendCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementBackendBackendRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backendId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementBackendResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheCollection.cs index dae6eb5d9080..5b7b6cf7aa0b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string cacheId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId} + /// + /// + /// Operation Id + /// Cache_Get + /// + /// + /// + /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string cacheId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheId, nameof(cacheId)); + + using var scope = _apiManagementCacheCacheClientDiagnostics.CreateScope("ApiManagementCacheCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementCacheCacheRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cacheId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementCacheResource(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.ApiManagement/service/{serviceName}/caches/{cacheId} + /// + /// + /// Operation Id + /// Cache_Get + /// + /// + /// + /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string cacheId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheId, nameof(cacheId)); + + using var scope = _apiManagementCacheCacheClientDiagnostics.CreateScope("ApiManagementCacheCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementCacheCacheRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cacheId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementCacheResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateCollection.cs index db44f6c664bb..d721d9ec2c7e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateCollection.cs @@ -334,6 +334,80 @@ public virtual Response Exists(string certificateId, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId} + /// + /// + /// Operation Id + /// Certificate_Get + /// + /// + /// + /// Identifier of the certificate entity. Must be unique in the current API Management service 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 certificateId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateId, nameof(certificateId)); + + using var scope = _apiManagementCertificateCertificateClientDiagnostics.CreateScope("ApiManagementCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementCertificateCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementCertificateResource(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.ApiManagement/service/{serviceName}/certificates/{certificateId} + /// + /// + /// Operation Id + /// Certificate_Get + /// + /// + /// + /// Identifier of the certificate entity. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateId, nameof(certificateId)); + + using var scope = _apiManagementCertificateCertificateClientDiagnostics.CreateScope("ApiManagementCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementCertificateCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceCollection.cs index 9dac35781881..c213def9b4de 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceCollection.cs @@ -198,5 +198,81 @@ public virtual Response Exists(AzureLocation location, string serviceName, throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName} + /// + /// + /// Operation Id + /// DeletedServices_GetByName + /// + /// + /// + /// The location of the deleted API Management service. + /// The name of the API Management service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _apiManagementDeletedServiceDeletedServicesClientDiagnostics.CreateScope("ApiManagementDeletedServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementDeletedServiceDeletedServicesRestClient.GetByNameAsync(Id.SubscriptionId, location, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementDeletedServiceResource(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}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName} + /// + /// + /// Operation Id + /// DeletedServices_GetByName + /// + /// + /// + /// The location of the deleted API Management service. + /// The name of the API Management service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(AzureLocation location, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _apiManagementDeletedServiceDeletedServicesClientDiagnostics.CreateScope("ApiManagementDeletedServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementDeletedServiceDeletedServicesRestClient.GetByName(Id.SubscriptionId, location, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementDeletedServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticCollection.cs index 6d017a1d7646..4df6473cad57 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string diagnosticId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId} + /// + /// + /// Operation Id + /// Diagnostic_Get + /// + /// + /// + /// Diagnostic identifier. Must be unique in the current API Management service 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 diagnosticId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticId, nameof(diagnosticId)); + + using var scope = _apiManagementDiagnosticDiagnosticClientDiagnostics.CreateScope("ApiManagementDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementDiagnosticDiagnosticRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, diagnosticId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementDiagnosticResource(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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId} + /// + /// + /// Operation Id + /// Diagnostic_Get + /// + /// + /// + /// Diagnostic identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diagnosticId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticId, nameof(diagnosticId)); + + using var scope = _apiManagementDiagnosticDiagnosticClientDiagnostics.CreateScope("ApiManagementDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementDiagnosticDiagnosticRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, diagnosticId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementDiagnosticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateCollection.cs index 9e92578e0535..1ac09da880d7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateCollection.cs @@ -312,6 +312,72 @@ public virtual Response Exists(TemplateName templateName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName} + /// + /// + /// Operation Id + /// EmailTemplate_Get + /// + /// + /// + /// Email Template Name Identifier. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(TemplateName templateName, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementEmailTemplateEmailTemplateClientDiagnostics.CreateScope("ApiManagementEmailTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementEmailTemplateEmailTemplateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, templateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementEmailTemplateResource(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.ApiManagement/service/{serviceName}/templates/{templateName} + /// + /// + /// Operation Id + /// EmailTemplate_Get + /// + /// + /// + /// Email Template Name Identifier. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(TemplateName templateName, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementEmailTemplateEmailTemplateClientDiagnostics.CreateScope("ApiManagementEmailTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementEmailTemplateEmailTemplateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, templateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementEmailTemplateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityCollection.cs index 926aa62ea5cf..ee1743eba336 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string certificateId, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId} + /// + /// + /// Operation Id + /// GatewayCertificateAuthority_Get + /// + /// + /// + /// Identifier of the certificate entity. Must be unique in the current API Management service 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 certificateId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateId, nameof(certificateId)); + + using var scope = _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityClientDiagnostics.CreateScope("ApiManagementGatewayCertificateAuthorityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, certificateId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGatewayCertificateAuthorityResource(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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId} + /// + /// + /// Operation Id + /// GatewayCertificateAuthority_Get + /// + /// + /// + /// Identifier of the certificate entity. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateId, nameof(certificateId)); + + using var scope = _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityClientDiagnostics.CreateScope("ApiManagementGatewayCertificateAuthorityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, certificateId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGatewayCertificateAuthorityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCollection.cs index c73117527cfa..07a060779d21 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string gatewayId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId} + /// + /// + /// Operation Id + /// Gateway_Get + /// + /// + /// + /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gatewayId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + + using var scope = _apiManagementGatewayGatewayClientDiagnostics.CreateScope("ApiManagementGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementGatewayGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGatewayResource(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.ApiManagement/service/{serviceName}/gateways/{gatewayId} + /// + /// + /// Operation Id + /// Gateway_Get + /// + /// + /// + /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gatewayId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + + using var scope = _apiManagementGatewayGatewayClientDiagnostics.CreateScope("ApiManagementGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementGatewayGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationCollection.cs index 479629df7564..210fa4a4ceaa 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string hcId, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId} + /// + /// + /// Operation Id + /// GatewayHostnameConfiguration_Get + /// + /// + /// + /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hcId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hcId, nameof(hcId)); + + using var scope = _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationClientDiagnostics.CreateScope("ApiManagementGatewayHostnameConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hcId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGatewayHostnameConfigurationResource(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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId} + /// + /// + /// Operation Id + /// GatewayHostnameConfiguration_Get + /// + /// + /// + /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hcId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hcId, nameof(hcId)); + + using var scope = _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationClientDiagnostics.CreateScope("ApiManagementGatewayHostnameConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hcId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGatewayHostnameConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs index ffa78bddaf9c..d9a7fe96c06c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string schemaId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId} + /// + /// + /// Operation Id + /// GlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service 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 schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGlobalSchemaResource(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.ApiManagement/service/{serviceName}/schemas/{schemaId} + /// + /// + /// Operation Id + /// GlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs index 101288203fc2..d5862a09ad34 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string groupId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId} + /// + /// + /// Operation Id + /// Group_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service 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 groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGroupResource(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.ApiManagement/service/{serviceName}/groups/{groupId} + /// + /// + /// Operation Id + /// Group_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderCollection.cs index 8144d34a6b24..4fa4e2bb0bef 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderCollection.cs @@ -306,6 +306,72 @@ public virtual Response Exists(IdentityProviderType identityProviderName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName} + /// + /// + /// Operation Id + /// IdentityProvider_Get + /// + /// + /// + /// Identity Provider Type identifier. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(IdentityProviderType identityProviderName, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementIdentityProviderIdentityProviderClientDiagnostics.CreateScope("ApiManagementIdentityProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementIdentityProviderIdentityProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, identityProviderName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementIdentityProviderResource(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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName} + /// + /// + /// Operation Id + /// IdentityProvider_Get + /// + /// + /// + /// Identity Provider Type identifier. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(IdentityProviderType identityProviderName, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementIdentityProviderIdentityProviderClientDiagnostics.CreateScope("ApiManagementIdentityProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementIdentityProviderIdentityProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, identityProviderName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementIdentityProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueCollection.cs index e157c1d3b495..9574a59663f4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string issueId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId} + /// + /// + /// Operation Id + /// Issue_Get + /// + /// + /// + /// Issue identifier. Must be unique in the current API Management service 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 issueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(issueId, nameof(issueId)); + + using var scope = _apiManagementIssueIssueClientDiagnostics.CreateScope("ApiManagementIssueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementIssueIssueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, issueId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementIssueResource(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.ApiManagement/service/{serviceName}/issues/{issueId} + /// + /// + /// Operation Id + /// Issue_Get + /// + /// + /// + /// Issue identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string issueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(issueId, nameof(issueId)); + + using var scope = _apiManagementIssueIssueClientDiagnostics.CreateScope("ApiManagementIssueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementIssueIssueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, issueId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementIssueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerCollection.cs index 12a748fdb3fd..57b71d899649 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string loggerId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId} + /// + /// + /// Operation Id + /// Logger_Get + /// + /// + /// + /// Logger identifier. Must be unique in the API Management service 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 loggerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loggerId, nameof(loggerId)); + + using var scope = _apiManagementLoggerLoggerClientDiagnostics.CreateScope("ApiManagementLoggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementLoggerLoggerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loggerId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementLoggerResource(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.ApiManagement/service/{serviceName}/loggers/{loggerId} + /// + /// + /// Operation Id + /// Logger_Get + /// + /// + /// + /// Logger identifier. Must be unique in the API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string loggerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loggerId, nameof(loggerId)); + + using var scope = _apiManagementLoggerLoggerClientDiagnostics.CreateScope("ApiManagementLoggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementLoggerLoggerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loggerId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementLoggerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs index a9de3624d6d4..9075f45e9fa1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs @@ -334,6 +334,80 @@ public virtual Response Exists(string namedValueId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// NamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementNamedValueResource(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.ApiManagement/service/{serviceName}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// NamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs index 8752f983ab25..0c4dfd055462 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs @@ -302,6 +302,72 @@ public virtual Response Exists(NotificationName notificationName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName} + /// + /// + /// Operation Id + /// Notification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementNotificationResource(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.ApiManagement/service/{serviceName}/notifications/{notificationName} + /// + /// + /// Operation Id + /// Notification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderCollection.cs index 5fab5fd523c8..2b768fbd9f98 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string openId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid} + /// + /// + /// Operation Id + /// OpenIdConnectProvider_Get + /// + /// + /// + /// Identifier of the OpenID Connect Provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string openId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(openId, nameof(openId)); + + using var scope = _apiManagementOpenIdConnectProviderOpenIdConnectProviderClientDiagnostics.CreateScope("ApiManagementOpenIdConnectProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementOpenIdConnectProviderOpenIdConnectProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, openId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementOpenIdConnectProviderResource(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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid} + /// + /// + /// Operation Id + /// OpenIdConnectProvider_Get + /// + /// + /// + /// Identifier of the OpenID Connect Provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string openId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(openId, nameof(openId)); + + using var scope = _apiManagementOpenIdConnectProviderOpenIdConnectProviderClientDiagnostics.CreateScope("ApiManagementOpenIdConnectProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementOpenIdConnectProviderOpenIdConnectProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, openId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementOpenIdConnectProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs index 5a4cc477f785..dea123826436 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs @@ -308,6 +308,74 @@ public virtual Response Exists(PolicyName policyId, PolicyExportFormat? fo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementPolicyPolicyClientDiagnostics.CreateScope("ApiManagementPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementPolicyPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementPolicyResource(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.ApiManagement/service/{serviceName}/policies/{policyId} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementPolicyPolicyClientDiagnostics.CreateScope("ApiManagementPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementPolicyPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionCollection.cs index edc1165364e2..db5bf4e1b73c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionCollection.cs @@ -345,6 +345,80 @@ public virtual Response Exists(string portalRevisionId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId} + /// + /// + /// Operation Id + /// PortalRevision_Get + /// + /// + /// + /// Portal revision identifier. Must be unique in the current API Management service 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 portalRevisionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalRevisionId, nameof(portalRevisionId)); + + using var scope = _apiManagementPortalRevisionPortalRevisionClientDiagnostics.CreateScope("ApiManagementPortalRevisionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementPortalRevisionPortalRevisionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalRevisionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementPortalRevisionResource(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.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId} + /// + /// + /// Operation Id + /// PortalRevision_Get + /// + /// + /// + /// Portal revision identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string portalRevisionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalRevisionId, nameof(portalRevisionId)); + + using var scope = _apiManagementPortalRevisionPortalRevisionClientDiagnostics.CreateScope("ApiManagementPortalRevisionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementPortalRevisionPortalRevisionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalRevisionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementPortalRevisionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionCollection.cs index 84b5504946d8..6c608ba33fe5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_GetByName + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics.CreateScope("ApiManagementPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionRestClient.GetByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementPrivateEndpointConnectionResource(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.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_GetByName + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics.CreateScope("ApiManagementPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionRestClient.GetByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceCollection.cs index fc890585133e..b6efa497b158 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string privateLinkSubResourceName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_GetPrivateLinkResource + /// + /// + /// + /// Name of the private link 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 privateLinkSubResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkSubResourceName, nameof(privateLinkSubResourceName)); + + using var scope = _apiManagementPrivateLinkResourcePrivateEndpointConnectionClientDiagnostics.CreateScope("ApiManagementPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementPrivateLinkResourcePrivateEndpointConnectionRestClient.GetPrivateLinkResourceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkSubResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementPrivateLinkResource(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.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_GetPrivateLinkResource + /// + /// + /// + /// Name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkSubResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkSubResourceName, nameof(privateLinkSubResourceName)); + + using var scope = _apiManagementPrivateLinkResourcePrivateEndpointConnectionClientDiagnostics.CreateScope("ApiManagementPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementPrivateLinkResourcePrivateEndpointConnectionRestClient.GetPrivateLinkResource(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkSubResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs index f6d86d96921c..94450b98fe6d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs @@ -335,6 +335,80 @@ public virtual Response Exists(string productId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId} + /// + /// + /// Operation Id + /// Product_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service 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 productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementProductResource(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.ApiManagement/service/{serviceName}/products/{productId} + /// + /// + /// Operation Id + /// Product_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs index 649391062225..06bb801efda2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs @@ -308,6 +308,74 @@ public virtual Response Exists(PolicyName policyId, PolicyExportFormat? fo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// ProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementProductPolicyProductPolicyClientDiagnostics.CreateScope("ApiManagementProductPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementProductPolicyProductPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementProductPolicyResource(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.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// ProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementProductPolicyProductPolicyClientDiagnostics.CreateScope("ApiManagementProductPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementProductPolicyProductPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs index d9f3c488e3d2..fb91d7be01f2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string tagId, CancellationToken cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId} + /// + /// + /// Operation Id + /// Tag_GetByProduct + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service 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 tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _apiManagementProductTagTagClientDiagnostics.CreateScope("ApiManagementProductTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementProductTagTagRestClient.GetByProductAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementProductTagResource(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.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId} + /// + /// + /// Operation Id + /// Tag_GetByProduct + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _apiManagementProductTagTagClientDiagnostics.CreateScope("ApiManagementProductTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementProductTagTagRestClient.GetByProduct(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementProductTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceCollection.cs index f2d2703eda12..d7738502b538 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName} + /// + /// + /// Operation Id + /// ApiManagementService_Get + /// + /// + /// + /// The name of the API Management service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _apiManagementServiceClientDiagnostics.CreateScope("ApiManagementServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementServiceResource(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.ApiManagement/service/{serviceName} + /// + /// + /// Operation Id + /// ApiManagementService_Get + /// + /// + /// + /// The name of the API Management service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _apiManagementServiceClientDiagnostics.CreateScope("ApiManagementServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs index 25365e617e2e..74d03e6e5a83 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs @@ -344,6 +344,80 @@ public virtual Response Exists(string sid, CancellationToken cancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid} + /// + /// + /// Operation Id + /// Subscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementSubscriptionSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementSubscriptionResource(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.ApiManagement/service/{serviceName}/subscriptions/{sid} + /// + /// + /// Operation Id + /// Subscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementSubscriptionSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagCollection.cs index 0fd6e35057f2..77b1629a93b8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagCollection.cs @@ -334,6 +334,80 @@ public virtual Response Exists(string tagId, CancellationToken cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId} + /// + /// + /// Operation Id + /// Tag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service 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 tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _apiManagementTagTagClientDiagnostics.CreateScope("ApiManagementTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementTagTagRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementTagResource(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.ApiManagement/service/{serviceName}/tags/{tagId} + /// + /// + /// Operation Id + /// Tag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _apiManagementTagTagClientDiagnostics.CreateScope("ApiManagementTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementTagTagRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingCollection.cs index 68a5a0bf9360..254582ae972d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingCollection.cs @@ -228,6 +228,72 @@ public virtual Response Exists(SettingsType settingsType, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType} + /// + /// + /// Operation Id + /// TenantSettings_Get + /// + /// + /// + /// The identifier of the settings. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SettingsType settingsType, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementTenantSettingTenantSettingsClientDiagnostics.CreateScope("ApiManagementTenantSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementTenantSettingTenantSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, settingsType, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementTenantSettingResource(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.ApiManagement/service/{serviceName}/settings/{settingsType} + /// + /// + /// Operation Id + /// TenantSettings_Get + /// + /// + /// + /// The identifier of the settings. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SettingsType settingsType, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementTenantSettingTenantSettingsClientDiagnostics.CreateScope("ApiManagementTenantSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementTenantSettingTenantSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, settingsType, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementTenantSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserCollection.cs index 9e5aaeffa60a..c5cbe3870b9a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserCollection.cs @@ -336,6 +336,80 @@ public virtual Response Exists(string userId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// + /// User identifier. Must be unique in the current API Management service 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 userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _apiManagementUserUserClientDiagnostics.CreateScope("ApiManagementUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementUserUserRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementUserResource(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.ApiManagement/service/{serviceName}/users/{userId} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _apiManagementUserUserClientDiagnostics.CreateScope("ApiManagementUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementUserUserRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionCollection.cs index 8b263e7f70eb..7137ff8cdfce 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string sid, CancellationToken cancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// UserSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _apiManagementUserSubscriptionUserSubscriptionClientDiagnostics.CreateScope("ApiManagementUserSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiManagementUserSubscriptionUserSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementUserSubscriptionResource(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.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// UserSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _apiManagementUserSubscriptionUserSubscriptionClientDiagnostics.CreateScope("ApiManagementUserSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiManagementUserSubscriptionUserSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiManagementUserSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs index dd4ceba88bfe..025aae493892 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs @@ -333,6 +333,80 @@ public virtual Response Exists(string operationId, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// ApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service 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 operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiOperationResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// ApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs index b8ce7ad654a6..d9c24ac32e0a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs @@ -308,6 +308,74 @@ public virtual Response Exists(PolicyName policyId, PolicyExportFormat? fo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// ApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _apiOperationPolicyClientDiagnostics.CreateScope("ApiOperationPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiOperationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiOperationPolicyResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// ApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _apiOperationPolicyClientDiagnostics.CreateScope("ApiOperationPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiOperationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs index 83e11eaedbd2..09457c7615e5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string tagId, CancellationToken cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId} + /// + /// + /// Operation Id + /// Tag_GetByOperation + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service 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 tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _apiOperationTagTagClientDiagnostics.CreateScope("ApiOperationTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiOperationTagTagRestClient.GetByOperationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiOperationTagResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId} + /// + /// + /// Operation Id + /// Tag_GetByOperation + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _apiOperationTagTagClientDiagnostics.CreateScope("ApiOperationTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiOperationTagTagRestClient.GetByOperation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiOperationTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs index d272fad3e862..87d857b3be3a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs @@ -308,6 +308,74 @@ public virtual Response Exists(PolicyName policyId, PolicyExportFormat? fo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// ApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _apiPolicyClientDiagnostics.CreateScope("ApiPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiPolicyResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// ApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _apiPolicyClientDiagnostics.CreateScope("ApiPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs index 06b41605e221..d6e6f4022540 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string releaseId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// ApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service 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 releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiReleaseResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// ApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs index e1bb445eeee8..df9753fca12d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string schemaId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// ApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service 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 schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiSchemaResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// ApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs index badcea2e2ae1..62778f39f37c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string tagId, CancellationToken cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId} + /// + /// + /// Operation Id + /// Tag_GetByApi + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service 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 tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _apiTagTagClientDiagnostics.CreateScope("ApiTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiTagTagRestClient.GetByApiAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiTagResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId} + /// + /// + /// Operation Id + /// Tag_GetByApi + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _apiTagTagClientDiagnostics.CreateScope("ApiTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiTagTagRestClient.GetByApi(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs index 62ce459b364c..15320d90c80d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string tagDescriptionId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId} + /// + /// + /// Operation Id + /// ApiTagDescription_Get + /// + /// + /// + /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tagDescriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagDescriptionId, nameof(tagDescriptionId)); + + using var scope = _apiTagDescriptionClientDiagnostics.CreateScope("ApiTagDescriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiTagDescriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagDescriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiTagDescriptionResource(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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId} + /// + /// + /// Operation Id + /// ApiTagDescription_Get + /// + /// + /// + /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tagDescriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagDescriptionId, nameof(tagDescriptionId)); + + using var scope = _apiTagDescriptionClientDiagnostics.CreateScope("ApiTagDescriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiTagDescriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagDescriptionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiTagDescriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs index 6f8222ef8dc6..c14af21f8338 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string versionSetId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// ApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service 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 versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _apiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiVersionSetResource(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.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// ApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _apiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoCollection.cs index ce3193d82d29..c68499c7fe76 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoCollection.cs @@ -308,6 +308,72 @@ public virtual Response Exists(AccessName accessName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName} + /// + /// + /// Operation Id + /// TenantAccess_Get + /// + /// + /// + /// The identifier of the Access configuration. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AccessName accessName, CancellationToken cancellationToken = default) + { + using var scope = _tenantAccessInfoTenantAccessClientDiagnostics.CreateScope("TenantAccessInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantAccessInfoTenantAccessRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantAccessInfoResource(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.ApiManagement/service/{serviceName}/tenant/{accessName} + /// + /// + /// Operation Id + /// TenantAccess_Get + /// + /// + /// + /// The identifier of the Access configuration. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AccessName accessName, CancellationToken cancellationToken = default) + { + using var scope = _tenantAccessInfoTenantAccessClientDiagnostics.CreateScope("TenantAccessInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantAccessInfoTenantAccessRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantAccessInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/samples/Generated/Samples/Sample_ReportResourceCollection.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/samples/Generated/Samples/Sample_ReportResourceCollection.cs index a5f3187fcf3b..c57b464481b7 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/samples/Generated/Samples/Sample_ReportResourceCollection.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/samples/Generated/Samples/Sample_ReportResourceCollection.cs @@ -113,6 +113,45 @@ public async Task Exists_ReportGet() Console.WriteLine($"Succeeded: {result}"); } + // Report_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ReportGet() + { + // Generated from example definition: specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/preview/2022-11-16-preview/examples/Report_Get.json + // this example is just showing the usage of "Report_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ReportResource + ReportResourceCollection collection = tenantResource.GetReportResources(); + + // invoke the operation + string reportName = "testReport"; + NullableResponse response = await collection.GetIfExistsAsync(reportName); + ReportResource 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 + ReportResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Report_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/samples/Generated/Samples/Sample_SnapshotResourceCollection.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/samples/Generated/Samples/Sample_SnapshotResourceCollection.cs index d79e5bb5b6a4..3e8fdc82d384 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/samples/Generated/Samples/Sample_SnapshotResourceCollection.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/samples/Generated/Samples/Sample_SnapshotResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,46 @@ public async Task Exists_SnapshotGet() Console.WriteLine($"Succeeded: {result}"); } + + // Snapshot_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SnapshotGet() + { + // Generated from example definition: specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/preview/2022-11-16-preview/examples/Snapshot_Get.json + // this example is just showing the usage of "Snapshot_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 ReportResource created on azure + // for more information of creating ReportResource, please refer to the document of ReportResource + string reportName = "testReportName"; + ResourceIdentifier reportResourceId = ReportResource.CreateResourceIdentifier(reportName); + ReportResource reportResource = client.GetReportResource(reportResourceId); + + // get the collection of this SnapshotResource + SnapshotResourceCollection collection = reportResource.GetSnapshotResources(); + + // invoke the operation + string snapshotName = "testSnapshot"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotName); + SnapshotResource 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 + SnapshotResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceCollection.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceCollection.cs index b188c8652646..bebc0e919cb1 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceCollection.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceCollection.cs @@ -339,6 +339,80 @@ public virtual Response Exists(string reportName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.AppComplianceAutomation/reports/{reportName} + /// + /// + /// Operation Id + /// Report_Get + /// + /// + /// + /// Report Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string reportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportName, nameof(reportName)); + + using var scope = _reportResourceReportClientDiagnostics.CreateScope("ReportResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _reportResourceReportRestClient.GetAsync(reportName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.AppComplianceAutomation/reports/{reportName} + /// + /// + /// Operation Id + /// Report_Get + /// + /// + /// + /// Report Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string reportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportName, nameof(reportName)); + + using var scope = _reportResourceReportClientDiagnostics.CreateScope("ReportResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _reportResourceReportRestClient.Get(reportName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceCollection.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceCollection.cs index fee2a1fc3bb2..45690378fd95 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceCollection.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceCollection.cs @@ -256,6 +256,80 @@ public virtual Response Exists(string snapshotName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.AppComplianceAutomation/reports/{reportName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// Snapshot_Get + /// + /// + /// + /// Snapshot Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _snapshotResourceSnapshotClientDiagnostics.CreateScope("SnapshotResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _snapshotResourceSnapshotRestClient.GetAsync(Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.AppComplianceAutomation/reports/{reportName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// Snapshot_Get + /// + /// + /// + /// Snapshot Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _snapshotResourceSnapshotClientDiagnostics.CreateScope("SnapshotResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _snapshotResourceSnapshotRestClient.Get(Id.Name, snapshotName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationKeyValueCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationKeyValueCollection.cs index f60a1344e54b..eb8290409b9b 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationKeyValueCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationKeyValueCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_KeyValuesGet() Console.WriteLine($"Succeeded: {result}"); } + // KeyValues_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KeyValuesGet() + { + // Generated from example definition: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresGetKeyValue.json + // this example is just showing the usage of "KeyValues_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 AppConfigurationStoreResource created on azure + // for more information of creating AppConfigurationStoreResource, please refer to the document of AppConfigurationStoreResource + string subscriptionId = "c80fb759-c965-4c6a-9110-9b2b2d038882"; + string resourceGroupName = "myResourceGroup"; + string configStoreName = "contoso"; + ResourceIdentifier appConfigurationStoreResourceId = AppConfigurationStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configStoreName); + AppConfigurationStoreResource appConfigurationStore = client.GetAppConfigurationStoreResource(appConfigurationStoreResourceId); + + // get the collection of this AppConfigurationKeyValueResource + AppConfigurationKeyValueCollection collection = appConfigurationStore.GetAppConfigurationKeyValues(); + + // invoke the operation + string keyValueName = "myKey$myLabel"; + NullableResponse response = await collection.GetIfExistsAsync(keyValueName); + AppConfigurationKeyValueResource 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 + AppConfigurationKeyValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KeyValues_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationPrivateEndpointConnectionCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationPrivateEndpointConnectionCollection.cs index 619857cd3563..50ce11b948b8 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationPrivateEndpointConnectionCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PrivateEndpointConnectionGetConnection() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnection_GetConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionGetConnection() + { + // Generated from example definition: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 AppConfigurationStoreResource created on azure + // for more information of creating AppConfigurationStoreResource, please refer to the document of AppConfigurationStoreResource + string subscriptionId = "c80fb759-c965-4c6a-9110-9b2b2d038882"; + string resourceGroupName = "myResourceGroup"; + string configStoreName = "contoso"; + ResourceIdentifier appConfigurationStoreResourceId = AppConfigurationStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configStoreName); + AppConfigurationStoreResource appConfigurationStore = client.GetAppConfigurationStoreResource(appConfigurationStoreResourceId); + + // get the collection of this AppConfigurationPrivateEndpointConnectionResource + AppConfigurationPrivateEndpointConnectionCollection collection = appConfigurationStore.GetAppConfigurationPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + AppConfigurationPrivateEndpointConnectionResource 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 + AppConfigurationPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnection_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationPrivateLinkResourceCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationPrivateLinkResourceCollection.cs index 2c5df8dd93c6..7930bcf3f797 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationPrivateLinkResourceCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_PrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/PrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_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 AppConfigurationStoreResource created on azure + // for more information of creating AppConfigurationStoreResource, please refer to the document of AppConfigurationStoreResource + string subscriptionId = "c80fb759-c965-4c6a-9110-9b2b2d038882"; + string resourceGroupName = "myResourceGroup"; + string configStoreName = "contoso"; + ResourceIdentifier appConfigurationStoreResourceId = AppConfigurationStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configStoreName); + AppConfigurationStoreResource appConfigurationStore = client.GetAppConfigurationStoreResource(appConfigurationStoreResourceId); + + // get the collection of this AppConfigurationPrivateLinkResource + AppConfigurationPrivateLinkResourceCollection collection = appConfigurationStore.GetAppConfigurationPrivateLinkResources(); + + // invoke the operation + string groupName = "configurationStores"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + AppConfigurationPrivateLinkResource 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 + AppConfigurationPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationStoreCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationStoreCollection.cs index 25daf915adc2..dd65d3c2b229 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationStoreCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_AppConfigurationStoreCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_ConfigurationStoresGet() Console.WriteLine($"Succeeded: {result}"); } + // ConfigurationStores_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConfigurationStoresGet() + { + // Generated from example definition: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/ConfigurationStoresGet.json + // this example is just showing the usage of "ConfigurationStores_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 = "c80fb759-c965-4c6a-9110-9b2b2d038882"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppConfigurationStoreResource + AppConfigurationStoreCollection collection = resourceGroupResource.GetAppConfigurationStores(); + + // invoke the operation + string configStoreName = "contoso"; + NullableResponse response = await collection.GetIfExistsAsync(configStoreName); + AppConfigurationStoreResource 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 + AppConfigurationStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConfigurationStores_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_DeletedAppConfigurationStoreCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_DeletedAppConfigurationStoreCollection.cs index 5ee03dd1d5e7..17d2a4b18c21 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_DeletedAppConfigurationStoreCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/samples/Generated/Samples/Sample_DeletedAppConfigurationStoreCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,5 +116,47 @@ public async Task Exists_DeletedConfigurationStoresGet() Console.WriteLine($"Succeeded: {result}"); } + + // DeletedConfigurationStores_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DeletedConfigurationStoresGet() + { + // Generated from example definition: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2022-05-01/examples/DeletedConfigurationStoresGet.json + // this example is just showing the usage of "ConfigurationStores_GetDeleted" 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 = "c80fb759-c965-4c6a-9110-9b2b2d038882"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this DeletedAppConfigurationStoreResource + DeletedAppConfigurationStoreCollection collection = subscriptionResource.GetDeletedAppConfigurationStores(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + string configStoreName = "contoso"; + NullableResponse response = await collection.GetIfExistsAsync(location, configStoreName); + DeletedAppConfigurationStoreResource 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 + DeletedAppConfigurationStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueCollection.cs index 44641b7705f4..48ff18a57f0e 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string keyValueName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName} + /// + /// + /// Operation Id + /// KeyValues_Get + /// + /// + /// + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string keyValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _appConfigurationKeyValueKeyValuesClientDiagnostics.CreateScope("AppConfigurationKeyValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appConfigurationKeyValueKeyValuesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyValueName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppConfigurationKeyValueResource(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.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName} + /// + /// + /// Operation Id + /// KeyValues_Get + /// + /// + /// + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string keyValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _appConfigurationKeyValueKeyValuesClientDiagnostics.CreateScope("AppConfigurationKeyValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appConfigurationKeyValueKeyValuesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyValueName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppConfigurationKeyValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionCollection.cs index fc525bccf599..3496c3e41a32 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private endpoint connection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AppConfigurationPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppConfigurationPrivateEndpointConnectionResource(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.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Private endpoint connection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AppConfigurationPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppConfigurationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceCollection.cs index 8b2814e3909d..3a6f8aa82cac 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _appConfigurationPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("AppConfigurationPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appConfigurationPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppConfigurationPrivateLinkResource(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.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _appConfigurationPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("AppConfigurationPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appConfigurationPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppConfigurationPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreCollection.cs index a775a42aeb1a..f43b54f40601 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string configStoreName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName} + /// + /// + /// Operation Id + /// ConfigurationStores_Get + /// + /// + /// + /// The name of the configuration store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configStoreName, nameof(configStoreName)); + + using var scope = _appConfigurationStoreConfigurationStoresClientDiagnostics.CreateScope("AppConfigurationStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appConfigurationStoreConfigurationStoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configStoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppConfigurationStoreResource(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.AppConfiguration/configurationStores/{configStoreName} + /// + /// + /// Operation Id + /// ConfigurationStores_Get + /// + /// + /// + /// The name of the configuration store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configStoreName, nameof(configStoreName)); + + using var scope = _appConfigurationStoreConfigurationStoresClientDiagnostics.CreateScope("AppConfigurationStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appConfigurationStoreConfigurationStoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configStoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppConfigurationStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreCollection.cs index 537c63a21803..a695ce798767 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreCollection.cs @@ -250,6 +250,82 @@ public virtual Response Exists(AzureLocation location, string configStoreN } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName} + /// + /// + /// Operation Id + /// ConfigurationStores_GetDeleted + /// + /// + /// + /// The location in which uniqueness will be verified. + /// The name of the configuration store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string configStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configStoreName, nameof(configStoreName)); + + using var scope = _deletedAppConfigurationStoreConfigurationStoresClientDiagnostics.CreateScope("DeletedAppConfigurationStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deletedAppConfigurationStoreConfigurationStoresRestClient.GetDeletedAsync(Id.SubscriptionId, location, configStoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedAppConfigurationStoreResource(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}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName} + /// + /// + /// Operation Id + /// ConfigurationStores_GetDeleted + /// + /// + /// + /// The location in which uniqueness will be verified. + /// The name of the configuration store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(AzureLocation location, string configStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configStoreName, nameof(configStoreName)); + + using var scope = _deletedAppConfigurationStoreConfigurationStoresClientDiagnostics.CreateScope("DeletedAppConfigurationStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deletedAppConfigurationStoreConfigurationStoresRestClient.GetDeleted(Id.SubscriptionId, location, configStoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedAppConfigurationStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_ApplicationInsightsComponentCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_ApplicationInsightsComponentCollection.cs index b80179d06f1a..721f0c702083 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_ApplicationInsightsComponentCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_ApplicationInsightsComponentCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_ComponentGet() Console.WriteLine($"Succeeded: {result}"); } + // ComponentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ComponentGet() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsGet.json + // this example is just showing the usage of "Components_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 = "subid"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApplicationInsightsComponentResource + ApplicationInsightsComponentCollection collection = resourceGroupResource.GetApplicationInsightsComponents(); + + // invoke the operation + string resourceName = "my-component"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + ApplicationInsightsComponentResource 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 + ApplicationInsightsComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ComponentCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_ComponentLinkedStorageAccountCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_ComponentLinkedStorageAccountCollection.cs index 9475dd0e1eb3..45694df46775 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_ComponentLinkedStorageAccountCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_ComponentLinkedStorageAccountCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ComponentLinkedStorageAccountsGet() Console.WriteLine($"Succeeded: {result}"); } + // ComponentLinkedStorageAccountsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ComponentLinkedStorageAccountsGet() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsGet.json + // this example is just showing the usage of "ComponentLinkedStorageAccounts_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 ApplicationInsightsComponentResource created on azure + // for more information of creating ApplicationInsightsComponentResource, please refer to the document of ApplicationInsightsComponentResource + string subscriptionId = "86dc51d3-92ed-4d7e-947a-775ea79b4918"; + string resourceGroupName = "someResourceGroupName"; + string resourceName = "myComponent"; + ResourceIdentifier applicationInsightsComponentResourceId = ApplicationInsightsComponentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + ApplicationInsightsComponentResource applicationInsightsComponent = client.GetApplicationInsightsComponentResource(applicationInsightsComponentResourceId); + + // get the collection of this ComponentLinkedStorageAccountResource + ComponentLinkedStorageAccountCollection collection = applicationInsightsComponent.GetComponentLinkedStorageAccounts(); + + // invoke the operation + StorageType storageType = StorageType.ServiceProfiler; + NullableResponse response = await collection.GetIfExistsAsync(storageType); + ComponentLinkedStorageAccountResource 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 + ComponentLinkedStorageAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ComponentLinkedStorageAccountsCreateAndUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_MyWorkbookCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_MyWorkbookCollection.cs index 3cfd96d8e067..74e5073c0710 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_MyWorkbookCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_MyWorkbookCollection.cs @@ -157,6 +157,48 @@ public async Task Exists_WorkbookGet() Console.WriteLine($"Succeeded: {result}"); } + // WorkbookGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkbookGet() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookGet.json + // this example is just showing the usage of "MyWorkbooks_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 = "6b643656-33eb-422f-aee8-3ac145d124af"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MyWorkbookResource + MyWorkbookCollection collection = resourceGroupResource.GetMyWorkbooks(); + + // invoke the operation + string resourceName = "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + MyWorkbookResource 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 + MyWorkbookData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkbookAdd [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WebTestCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WebTestCollection.cs index 61f6379547aa..2fce9dd7093d 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WebTestCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WebTestCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_WebTestGet() Console.WriteLine($"Succeeded: {result}"); } + // webTestGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WebTestGet() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestGet.json + // this example is just showing the usage of "WebTests_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 = "subid"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebTestResource + WebTestCollection collection = resourceGroupResource.GetWebTests(); + + // invoke the operation + string webTestName = "my-webtest-01-mywebservice"; + NullableResponse response = await collection.GetIfExistsAsync(webTestName); + WebTestResource 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 + WebTestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // webTestCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookCollection.cs index 9ea52db35678..702f94c83721 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookCollection.cs @@ -160,6 +160,48 @@ public async Task Exists_WorkbookGet() Console.WriteLine($"Succeeded: {result}"); } + // WorkbookGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkbookGet() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookGet.json + // this example is just showing the usage of "Workbooks_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 = "6b643656-33eb-422f-aee8-3ac145d124af"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WorkbookResource + WorkbookCollection collection = resourceGroupResource.GetWorkbooks(); + + // invoke the operation + string resourceName = "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + WorkbookResource 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 + WorkbookData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkbookGet1 [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -224,6 +266,48 @@ public async Task Exists_WorkbookGet1() Console.WriteLine($"Succeeded: {result}"); } + // WorkbookGet1 + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkbookGet1() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookGet1.json + // this example is just showing the usage of "Workbooks_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 = "6b643656-33eb-422f-aee8-3ac145d124af"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WorkbookResource + WorkbookCollection collection = resourceGroupResource.GetWorkbooks(); + + // invoke the operation + string resourceName = "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + WorkbookResource 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 + WorkbookData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkbookManagedGet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -288,6 +372,48 @@ public async Task Exists_WorkbookManagedGet() Console.WriteLine($"Succeeded: {result}"); } + // WorkbookManagedGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkbookManagedGet() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookManagedGet.json + // this example is just showing the usage of "Workbooks_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 = "6b643656-33eb-422f-aee8-3ac145d124af"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WorkbookResource + WorkbookCollection collection = resourceGroupResource.GetWorkbooks(); + + // invoke the operation + string resourceName = "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + WorkbookResource 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 + WorkbookData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkbookAdd [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookRevisionCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookRevisionCollection.cs index 9804d02e2080..80809374c2bd 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookRevisionCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookRevisionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_WorkbookRevisionGet() Console.WriteLine($"Succeeded: {result}"); } + + // WorkbookRevisionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkbookRevisionGet() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookRevisionGet.json + // this example is just showing the usage of "Workbooks_RevisionGet" 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 WorkbookResource created on azure + // for more information of creating WorkbookResource, please refer to the document of WorkbookResource + string subscriptionId = "6b643656-33eb-422f-aee8-3ac145d124af"; + string resourceGroupName = "my-resource-group"; + string resourceName = "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"; + ResourceIdentifier workbookResourceId = WorkbookResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + WorkbookResource workbook = client.GetWorkbookResource(workbookResourceId); + + // get the collection of this WorkbookRevisionResource + WorkbookRevisionCollection collection = workbook.GetWorkbookRevisions(); + + // invoke the operation + string revisionId = "1e2f8435b98248febee70c64ac22e1ab"; + NullableResponse response = await collection.GetIfExistsAsync(revisionId); + WorkbookRevisionResource 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 + WorkbookData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookTemplateCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookTemplateCollection.cs index e075d9f09d3d..7b7925d826b6 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookTemplateCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/samples/Generated/Samples/Sample_WorkbookTemplateCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_WorkbookTemplateGet() Console.WriteLine($"Succeeded: {result}"); } + // WorkbookTemplateGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkbookTemplateGet() + { + // Generated from example definition: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateGet.json + // this example is just showing the usage of "WorkbookTemplates_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 = "6b643656-33eb-422f-aee8-3ac145d124af"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WorkbookTemplateResource + WorkbookTemplateCollection collection = resourceGroupResource.GetWorkbookTemplates(); + + // invoke the operation + string resourceName = "my-resource-name"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + WorkbookTemplateResource 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 + WorkbookTemplateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkbookTemplateAdd [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentCollection.cs index 9b203903cd5e..3f7ab1abd547 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the Application Insights component 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _applicationInsightsComponentComponentsClientDiagnostics.CreateScope("ApplicationInsightsComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _applicationInsightsComponentComponentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationInsightsComponentResource(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.Insights/components/{resourceName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _applicationInsightsComponentComponentsClientDiagnostics.CreateScope("ApplicationInsightsComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _applicationInsightsComponentComponentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationInsightsComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountCollection.cs index ab6cbdc59de9..ce1f206b4d0d 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountCollection.cs @@ -256,5 +256,71 @@ public virtual Response Exists(StorageType storageType, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType} + /// + /// + /// Operation Id + /// ComponentLinkedStorageAccounts_Get + /// + /// + /// + /// The type of the Application Insights component data source for the linked storage account. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(StorageType storageType, CancellationToken cancellationToken = default) + { + using var scope = _componentLinkedStorageAccountClientDiagnostics.CreateScope("ComponentLinkedStorageAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _componentLinkedStorageAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageType, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComponentLinkedStorageAccountResource(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.insights/components/{resourceName}/linkedStorageAccounts/{storageType} + /// + /// + /// Operation Id + /// ComponentLinkedStorageAccounts_Get + /// + /// + /// + /// The type of the Application Insights component data source for the linked storage account. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(StorageType storageType, CancellationToken cancellationToken = default) + { + using var scope = _componentLinkedStorageAccountClientDiagnostics.CreateScope("ComponentLinkedStorageAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _componentLinkedStorageAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageType, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComponentLinkedStorageAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookCollection.cs index 99d9fcb5b284..fda4cd29c664 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookCollection.cs @@ -333,5 +333,79 @@ public virtual Response Exists(string resourceName, CancellationToken canc throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName} + /// + /// + /// Operation Id + /// MyWorkbooks_Get + /// + /// + /// + /// The name of the Application Insights component 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _myWorkbookClientDiagnostics.CreateScope("MyWorkbookCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _myWorkbookRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MyWorkbookResource(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.Insights/myWorkbooks/{resourceName} + /// + /// + /// Operation Id + /// MyWorkbooks_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _myWorkbookClientDiagnostics.CreateScope("MyWorkbookCollection.GetIfExists"); + scope.Start(); + try + { + var response = _myWorkbookRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MyWorkbookResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestCollection.cs index d7bcc5c0720b..037940616914 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string webTestName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName} + /// + /// + /// Operation Id + /// WebTests_Get + /// + /// + /// + /// The name of the Application Insights WebTest 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 webTestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webTestName, nameof(webTestName)); + + using var scope = _webTestClientDiagnostics.CreateScope("WebTestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webTestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, webTestName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebTestResource(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.Insights/webtests/{webTestName} + /// + /// + /// Operation Id + /// WebTests_Get + /// + /// + /// + /// The name of the Application Insights WebTest resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webTestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webTestName, nameof(webTestName)); + + using var scope = _webTestClientDiagnostics.CreateScope("WebTestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webTestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, webTestName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebTestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookCollection.cs index cbf563e933db..99b43d1f259b 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookCollection.cs @@ -337,5 +337,81 @@ public virtual Response Exists(string resourceName, bool? canFetchContent throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName} + /// + /// + /// Operation Id + /// Workbooks_Get + /// + /// + /// + /// The name of the resource. + /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, bool? canFetchContent = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _workbookClientDiagnostics.CreateScope("WorkbookCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workbookRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, canFetchContent, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkbookResource(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.Insights/workbooks/{resourceName} + /// + /// + /// Operation Id + /// Workbooks_Get + /// + /// + /// + /// The name of the resource. + /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, bool? canFetchContent = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _workbookClientDiagnostics.CreateScope("WorkbookCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workbookRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, canFetchContent, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkbookResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionCollection.cs index 112e128b7732..c9dc51760d04 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string revisionId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId} + /// + /// + /// Operation Id + /// Workbooks_RevisionGet + /// + /// + /// + /// The id of the workbook's revision. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string revisionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(revisionId, nameof(revisionId)); + + using var scope = _workbookRevisionWorkbooksClientDiagnostics.CreateScope("WorkbookRevisionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workbookRevisionWorkbooksRestClient.RevisionGetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, revisionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkbookRevisionResource(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.Insights/workbooks/{resourceName}/revisions/{revisionId} + /// + /// + /// Operation Id + /// Workbooks_RevisionGet + /// + /// + /// + /// The id of the workbook's revision. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string revisionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(revisionId, nameof(revisionId)); + + using var scope = _workbookRevisionWorkbooksClientDiagnostics.CreateScope("WorkbookRevisionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workbookRevisionWorkbooksRestClient.RevisionGet(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, revisionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkbookRevisionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateCollection.cs index 9f5c984c24d0..dae90b601685 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName} + /// + /// + /// Operation Id + /// WorkbookTemplates_Get + /// + /// + /// + /// The name of the Application Insights component 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _workbookTemplateClientDiagnostics.CreateScope("WorkbookTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workbookTemplateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkbookTemplateResource(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.Insights/workbooktemplates/{resourceName} + /// + /// + /// Operation Id + /// WorkbookTemplates_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _workbookTemplateClientDiagnostics.CreateScope("WorkbookTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workbookTemplateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkbookTemplateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCollection.cs index 920fc11d7ae3..ddc83821d24d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string apiPortalName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName} + /// + /// + /// Operation Id + /// ApiPortals_Get + /// + /// + /// + /// The name of API portal. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string apiPortalName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiPortalName, nameof(apiPortalName)); + + using var scope = _appPlatformApiPortalApiPortalsClientDiagnostics.CreateScope("AppPlatformApiPortalCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformApiPortalApiPortalsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiPortalName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformApiPortalResource(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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName} + /// + /// + /// Operation Id + /// ApiPortals_Get + /// + /// + /// + /// The name of API portal. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string apiPortalName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiPortalName, nameof(apiPortalName)); + + using var scope = _appPlatformApiPortalApiPortalsClientDiagnostics.CreateScope("AppPlatformApiPortalCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformApiPortalApiPortalsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiPortalName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformApiPortalResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainCollection.cs index 529a6cd3c9c0..9c012cb422cb 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string domainName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName} + /// + /// + /// Operation Id + /// ApiPortalCustomDomains_Get + /// + /// + /// + /// The name of the API portal custom domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _appPlatformApiPortalCustomDomainApiPortalCustomDomainsClientDiagnostics.CreateScope("AppPlatformApiPortalCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformApiPortalCustomDomainApiPortalCustomDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, domainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformApiPortalCustomDomainResource(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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName} + /// + /// + /// Operation Id + /// ApiPortalCustomDomains_Get + /// + /// + /// + /// The name of the API portal custom domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _appPlatformApiPortalCustomDomainApiPortalCustomDomainsClientDiagnostics.CreateScope("AppPlatformApiPortalCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformApiPortalCustomDomainApiPortalCustomDomainsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, domainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformApiPortalCustomDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppCollection.cs index 56ea868cb95e..737695bbb0a3 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string appName, string syncStatus = null, C } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName} + /// + /// + /// Operation Id + /// Apps_Get + /// + /// + /// + /// The name of the App resource. + /// Indicates whether sync status. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string appName, string syncStatus = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var scope = _appPlatformAppAppsClientDiagnostics.CreateScope("AppPlatformAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformAppAppsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, appName, syncStatus, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformAppResource(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.AppPlatform/Spring/{serviceName}/apps/{appName} + /// + /// + /// Operation Id + /// Apps_Get + /// + /// + /// + /// The name of the App resource. + /// Indicates whether sync status. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string appName, string syncStatus = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var scope = _appPlatformAppAppsClientDiagnostics.CreateScope("AppPlatformAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformAppAppsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, appName, syncStatus, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingCollection.cs index 801e690f95d8..8e176b4470ad 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string bindingName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName} + /// + /// + /// Operation Id + /// Bindings_Get + /// + /// + /// + /// The name of the Binding 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 bindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bindingName, nameof(bindingName)); + + using var scope = _appPlatformBindingBindingsClientDiagnostics.CreateScope("AppPlatformBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformBindingBindingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, bindingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBindingResource(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.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName} + /// + /// + /// Operation Id + /// Bindings_Get + /// + /// + /// + /// The name of the Binding resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string bindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bindingName, nameof(bindingName)); + + using var scope = _appPlatformBindingBindingsClientDiagnostics.CreateScope("AppPlatformBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformBindingBindingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, bindingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildCollection.cs index 8b5c5e14cdf3..bf5e5303e0c9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string buildName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName} + /// + /// + /// Operation Id + /// BuildService_GetBuild + /// + /// + /// + /// The name of the build 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 buildName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildName, nameof(buildName)); + + using var scope = _appPlatformBuildBuildServiceClientDiagnostics.CreateScope("AppPlatformBuildCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformBuildBuildServiceRestClient.GetBuildAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, buildName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildResource(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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName} + /// + /// + /// Operation Id + /// BuildService_GetBuild + /// + /// + /// + /// The name of the build resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string buildName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildName, nameof(buildName)); + + using var scope = _appPlatformBuildBuildServiceClientDiagnostics.CreateScope("AppPlatformBuildCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformBuildBuildServiceRestClient.GetBuild(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, buildName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultCollection.cs index 4def9256ae1e..18e122dcfe80 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string buildResultName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName} + /// + /// + /// Operation Id + /// BuildService_GetBuildResult + /// + /// + /// + /// The name of the build result 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 buildResultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildResultName, nameof(buildResultName)); + + using var scope = _appPlatformBuildResultBuildServiceClientDiagnostics.CreateScope("AppPlatformBuildResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformBuildResultBuildServiceRestClient.GetBuildResultAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, buildResultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildResultResource(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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName} + /// + /// + /// Operation Id + /// BuildService_GetBuildResult + /// + /// + /// + /// The name of the build result resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string buildResultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildResultName, nameof(buildResultName)); + + using var scope = _appPlatformBuildResultBuildServiceClientDiagnostics.CreateScope("AppPlatformBuildResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformBuildResultBuildServiceRestClient.GetBuildResult(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, buildResultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolCollection.cs index 9827ce23c2b8..830bea4db3a1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string agentPoolName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// BuildServiceAgentPool_Get + /// + /// + /// + /// The name of the build service agent pool 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 agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolClientDiagnostics.CreateScope("AppPlatformBuildServiceAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, agentPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildServiceAgentPoolResource(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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// BuildServiceAgentPool_Get + /// + /// + /// + /// The name of the build service agent pool resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolClientDiagnostics.CreateScope("AppPlatformBuildServiceAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, agentPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildServiceAgentPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceCollection.cs index e476b05a4100..1b86f3cd6184 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string buildServiceName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName} + /// + /// + /// Operation Id + /// BuildService_GetBuildService + /// + /// + /// + /// The name of the build service 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 buildServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildServiceName, nameof(buildServiceName)); + + using var scope = _appPlatformBuildServiceBuildServiceClientDiagnostics.CreateScope("AppPlatformBuildServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformBuildServiceBuildServiceRestClient.GetBuildServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, buildServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildServiceResource(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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName} + /// + /// + /// Operation Id + /// BuildService_GetBuildService + /// + /// + /// + /// The name of the build service resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string buildServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildServiceName, nameof(buildServiceName)); + + using var scope = _appPlatformBuildServiceBuildServiceClientDiagnostics.CreateScope("AppPlatformBuildServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformBuildServiceBuildServiceRestClient.GetBuildService(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, buildServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderCollection.cs index d4ac47f79245..02537eb697c7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string builderName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName} + /// + /// + /// Operation Id + /// BuildServiceBuilder_Get + /// + /// + /// + /// The name of the builder 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 builderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(builderName, nameof(builderName)); + + using var scope = _appPlatformBuilderBuildServiceBuilderClientDiagnostics.CreateScope("AppPlatformBuilderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformBuilderBuildServiceBuilderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, builderName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuilderResource(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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName} + /// + /// + /// Operation Id + /// BuildServiceBuilder_Get + /// + /// + /// + /// The name of the builder resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string builderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(builderName, nameof(builderName)); + + using var scope = _appPlatformBuilderBuildServiceBuilderClientDiagnostics.CreateScope("AppPlatformBuilderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformBuilderBuildServiceBuilderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, builderName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuilderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingCollection.cs index 541066975741..937454181ff0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string buildpackBindingName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName} + /// + /// + /// Operation Id + /// BuildpackBinding_Get + /// + /// + /// + /// The name of the Buildpack Binding Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string buildpackBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildpackBindingName, nameof(buildpackBindingName)); + + using var scope = _appPlatformBuildpackBindingBuildpackBindingClientDiagnostics.CreateScope("AppPlatformBuildpackBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformBuildpackBindingBuildpackBindingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, buildpackBindingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildpackBindingResource(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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName} + /// + /// + /// Operation Id + /// BuildpackBinding_Get + /// + /// + /// + /// The name of the Buildpack Binding Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string buildpackBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildpackBindingName, nameof(buildpackBindingName)); + + using var scope = _appPlatformBuildpackBindingBuildpackBindingClientDiagnostics.CreateScope("AppPlatformBuildpackBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformBuildpackBindingBuildpackBindingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, buildpackBindingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformBuildpackBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateCollection.cs index 16c383574adf..15fabfbef9f5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// The name of the certificate 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 certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _appPlatformCertificateCertificatesClientDiagnostics.CreateScope("AppPlatformCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformCertificateCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformCertificateResource(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.AppPlatform/Spring/{serviceName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// The name of the certificate resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _appPlatformCertificateCertificatesClientDiagnostics.CreateScope("AppPlatformCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformCertificateCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceCollection.cs index 8a52227acf68..fef4942509c5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string configurationServiceName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName} + /// + /// + /// Operation Id + /// ConfigurationServices_Get + /// + /// + /// + /// The name of Application Configuration Service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationServiceName, nameof(configurationServiceName)); + + using var scope = _appPlatformConfigurationServiceConfigurationServicesClientDiagnostics.CreateScope("AppPlatformConfigurationServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformConfigurationServiceConfigurationServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformConfigurationServiceResource(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.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName} + /// + /// + /// Operation Id + /// ConfigurationServices_Get + /// + /// + /// + /// The name of Application Configuration Service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationServiceName, nameof(configurationServiceName)); + + using var scope = _appPlatformConfigurationServiceConfigurationServicesClientDiagnostics.CreateScope("AppPlatformConfigurationServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformConfigurationServiceConfigurationServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformConfigurationServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainCollection.cs index ca9dd0078394..76cf0c747e8f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string domainName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName} + /// + /// + /// Operation Id + /// CustomDomains_Get + /// + /// + /// + /// The name of the custom domain 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 domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _appPlatformCustomDomainCustomDomainsClientDiagnostics.CreateScope("AppPlatformCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformCustomDomainCustomDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, domainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformCustomDomainResource(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.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName} + /// + /// + /// Operation Id + /// CustomDomains_Get + /// + /// + /// + /// The name of the custom domain resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _appPlatformCustomDomainCustomDomainsClientDiagnostics.CreateScope("AppPlatformCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformCustomDomainCustomDomainsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, domainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformCustomDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentCollection.cs index 096bde7df59d..2e2b100e587a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string deploymentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The name of the Deployment 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 deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _appPlatformDeploymentDeploymentsClientDiagnostics.CreateScope("AppPlatformDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformDeploymentDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformDeploymentResource(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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The name of the Deployment resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _appPlatformDeploymentDeploymentsClientDiagnostics.CreateScope("AppPlatformDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformDeploymentDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCollection.cs index fb48c939a7fb..e770392499a6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string gatewayName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName} + /// + /// + /// Operation Id + /// Gateways_Get + /// + /// + /// + /// The name of Spring Cloud Gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _appPlatformGatewayGatewaysClientDiagnostics.CreateScope("AppPlatformGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformGatewayGatewaysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformGatewayResource(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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName} + /// + /// + /// Operation Id + /// Gateways_Get + /// + /// + /// + /// The name of Spring Cloud Gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _appPlatformGatewayGatewaysClientDiagnostics.CreateScope("AppPlatformGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformGatewayGatewaysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainCollection.cs index 4a0be01db9b4..f5804ac70abf 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string domainName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName} + /// + /// + /// Operation Id + /// GatewayCustomDomains_Get + /// + /// + /// + /// The name of the Spring Cloud Gateway custom domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _appPlatformGatewayCustomDomainGatewayCustomDomainsClientDiagnostics.CreateScope("AppPlatformGatewayCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformGatewayCustomDomainGatewayCustomDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, domainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformGatewayCustomDomainResource(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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName} + /// + /// + /// Operation Id + /// GatewayCustomDomains_Get + /// + /// + /// + /// The name of the Spring Cloud Gateway custom domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _appPlatformGatewayCustomDomainGatewayCustomDomainsClientDiagnostics.CreateScope("AppPlatformGatewayCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformGatewayCustomDomainGatewayCustomDomainsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, domainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformGatewayCustomDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigCollection.cs index de39e0735515..581d75867187 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string routeConfigName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName} + /// + /// + /// Operation Id + /// GatewayRouteConfigs_Get + /// + /// + /// + /// The name of the Spring Cloud Gateway route config. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routeConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeConfigName, nameof(routeConfigName)); + + using var scope = _appPlatformGatewayRouteConfigGatewayRouteConfigsClientDiagnostics.CreateScope("AppPlatformGatewayRouteConfigCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformGatewayRouteConfigGatewayRouteConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, routeConfigName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformGatewayRouteConfigResource(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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName} + /// + /// + /// Operation Id + /// GatewayRouteConfigs_Get + /// + /// + /// + /// The name of the Spring Cloud Gateway route config. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routeConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeConfigName, nameof(routeConfigName)); + + using var scope = _appPlatformGatewayRouteConfigGatewayRouteConfigsClientDiagnostics.CreateScope("AppPlatformGatewayRouteConfigCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformGatewayRouteConfigGatewayRouteConfigsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, routeConfigName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformGatewayRouteConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceCollection.cs index a3bdd3827663..34a3f493684e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the Service 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 serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _appPlatformServiceServicesClientDiagnostics.CreateScope("AppPlatformServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformServiceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformServiceResource(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.AppPlatform/Spring/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the Service resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _appPlatformServiceServicesClientDiagnostics.CreateScope("AppPlatformServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformServiceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryCollection.cs index f55c11e56027..ef22cff74f09 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryCollection.cs @@ -319,6 +319,80 @@ public virtual Response Exists(string serviceRegistryName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName} + /// + /// + /// Operation Id + /// ServiceRegistries_Get + /// + /// + /// + /// The name of Service Registry. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceRegistryName, nameof(serviceRegistryName)); + + using var scope = _appPlatformServiceRegistryServiceRegistriesClientDiagnostics.CreateScope("AppPlatformServiceRegistryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformServiceRegistryServiceRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceRegistryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformServiceRegistryResource(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.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName} + /// + /// + /// Operation Id + /// ServiceRegistries_Get + /// + /// + /// + /// The name of Service Registry. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceRegistryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceRegistryName, nameof(serviceRegistryName)); + + using var scope = _appPlatformServiceRegistryServiceRegistriesClientDiagnostics.CreateScope("AppPlatformServiceRegistryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformServiceRegistryServiceRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceRegistryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformServiceRegistryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageCollection.cs index 11d1ed995cc7..7ac75192003d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string storageName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName} + /// + /// + /// Operation Id + /// Storages_Get + /// + /// + /// + /// The name of the storage 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 storageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageName, nameof(storageName)); + + using var scope = _appPlatformStorageStoragesClientDiagnostics.CreateScope("AppPlatformStorageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformStorageStoragesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformStorageResource(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.AppPlatform/Spring/{serviceName}/storages/{storageName} + /// + /// + /// Operation Id + /// Storages_Get + /// + /// + /// + /// The name of the storage resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageName, nameof(storageName)); + + using var scope = _appPlatformStorageStoragesClientDiagnostics.CreateScope("AppPlatformStorageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformStorageStoragesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformStorageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackCollection.cs index c8e8192dfce2..af7817e32ed7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string buildpackName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName} + /// + /// + /// Operation Id + /// BuildService_GetSupportedBuildpack + /// + /// + /// + /// The name of the buildpack 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 buildpackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildpackName, nameof(buildpackName)); + + using var scope = _appPlatformSupportedBuildpackBuildServiceClientDiagnostics.CreateScope("AppPlatformSupportedBuildpackCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformSupportedBuildpackBuildServiceRestClient.GetSupportedBuildpackAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, buildpackName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformSupportedBuildpackResource(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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName} + /// + /// + /// Operation Id + /// BuildService_GetSupportedBuildpack + /// + /// + /// + /// The name of the buildpack resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string buildpackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(buildpackName, nameof(buildpackName)); + + using var scope = _appPlatformSupportedBuildpackBuildServiceClientDiagnostics.CreateScope("AppPlatformSupportedBuildpackCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformSupportedBuildpackBuildServiceRestClient.GetSupportedBuildpack(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, buildpackName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformSupportedBuildpackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackCollection.cs index 3d926d4f08ed..33cc284c391e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string stackName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName} + /// + /// + /// Operation Id + /// BuildService_GetSupportedStack + /// + /// + /// + /// The name of the stack 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 stackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stackName, nameof(stackName)); + + using var scope = _appPlatformSupportedStackBuildServiceClientDiagnostics.CreateScope("AppPlatformSupportedStackCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appPlatformSupportedStackBuildServiceRestClient.GetSupportedStackAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, stackName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformSupportedStackResource(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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName} + /// + /// + /// Operation Id + /// BuildService_GetSupportedStack + /// + /// + /// + /// The name of the stack resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string stackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stackName, nameof(stackName)); + + using var scope = _appPlatformSupportedStackBuildServiceClientDiagnostics.CreateScope("AppPlatformSupportedStackCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appPlatformSupportedStackBuildServiceRestClient.GetSupportedStack(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, stackName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppPlatformSupportedStackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_InventoryItemCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_InventoryItemCollection.cs index 4f8138f104f9..e48103ba1df7 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_InventoryItemCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_InventoryItemCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetInventoryItem() Console.WriteLine($"Succeeded: {result}"); } + // GetInventoryItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInventoryItem() + { + // Generated from example definition: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetInventoryItem.json + // this example is just showing the usage of "InventoryItems_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 ScVmmServerResource created on azure + // for more information of creating ScVmmServerResource, please refer to the document of ScVmmServerResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + string vmmServerName = "ContosoVMMServer"; + ResourceIdentifier scVmmServerResourceId = ScVmmServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmmServerName); + ScVmmServerResource scVmmServer = client.GetScVmmServerResource(scVmmServerResourceId); + + // get the collection of this InventoryItemResource + InventoryItemCollection collection = scVmmServer.GetInventoryItems(); + + // invoke the operation + string inventoryItemName = "12345678-1234-1234-1234-123456789abc"; + NullableResponse response = await collection.GetIfExistsAsync(inventoryItemName); + InventoryItemResource 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 + InventoryItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // InventoryItemsListByVMMServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmAvailabilitySetCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmAvailabilitySetCollection.cs index feb324e0c845..2ae125d03951 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmAvailabilitySetCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmAvailabilitySetCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetAvailabilitySet() Console.WriteLine($"Succeeded: {result}"); } + // GetAvailabilitySet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAvailabilitySet() + { + // Generated from example definition: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetAvailabilitySet.json + // this example is just showing the usage of "AvailabilitySets_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ScVmmAvailabilitySetResource + ScVmmAvailabilitySetCollection collection = resourceGroupResource.GetScVmmAvailabilitySets(); + + // invoke the operation + string availabilitySetName = "HRAvailabilitySet"; + NullableResponse response = await collection.GetIfExistsAsync(availabilitySetName); + ScVmmAvailabilitySetResource 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 + ScVmmAvailabilitySetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateAvailabilitySet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmCloudCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmCloudCollection.cs index 5dd14b3a255f..3fa7448f0b7a 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmCloudCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmCloudCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetCloud() Console.WriteLine($"Succeeded: {result}"); } + // GetCloud + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCloud() + { + // Generated from example definition: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetCloud.json + // this example is just showing the usage of "Clouds_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ScVmmCloudResource + ScVmmCloudCollection collection = resourceGroupResource.GetScVmmClouds(); + + // invoke the operation + string cloudName = "HRCloud"; + NullableResponse response = await collection.GetIfExistsAsync(cloudName); + ScVmmCloudResource 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 + ScVmmCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateCloud [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmServerCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmServerCollection.cs index 63078b97f7b5..a9af18c977f7 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmServerCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmServerCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetVMMServer() Console.WriteLine($"Succeeded: {result}"); } + // GetVMMServer + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVMMServer() + { + // Generated from example definition: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVMMServer.json + // this example is just showing the usage of "VmmServers_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ScVmmServerResource + ScVmmServerCollection collection = resourceGroupResource.GetScVmmServers(); + + // invoke the operation + string vmmServerName = "ContosoVMMServer"; + NullableResponse response = await collection.GetIfExistsAsync(vmmServerName); + ScVmmServerResource 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 + ScVmmServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateVMMServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualMachineCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualMachineCollection.cs index c71fcfe43596..378edfa8ca28 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualMachineCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualMachineCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualMachine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachine() + { + // Generated from example definition: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachine.json + // this example is just showing the usage of "VirtualMachines_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ScVmmVirtualMachineResource + ScVmmVirtualMachineCollection collection = resourceGroupResource.GetScVmmVirtualMachines(); + + // invoke the operation + string virtualMachineName = "DemoVM"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineName); + ScVmmVirtualMachineResource 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 + ScVmmVirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateVirtualMachine [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualMachineTemplateCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualMachineTemplateCollection.cs index 2b8936b469b2..e15a9b45e90d 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualMachineTemplateCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualMachineTemplateCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetVirtualMachineTemplate() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualMachineTemplate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachineTemplate() + { + // Generated from example definition: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachineTemplate.json + // this example is just showing the usage of "VirtualMachineTemplates_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ScVmmVirtualMachineTemplateResource + ScVmmVirtualMachineTemplateCollection collection = resourceGroupResource.GetScVmmVirtualMachineTemplates(); + + // invoke the operation + string virtualMachineTemplateName = "HRVirtualMachineTemplate"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineTemplateName); + ScVmmVirtualMachineTemplateResource 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 + ScVmmVirtualMachineTemplateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateVirtualMachineTemplate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualNetworkCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualNetworkCollection.cs index 7230ec8926fa..f001c534af70 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualNetworkCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/samples/Generated/Samples/Sample_ScVmmVirtualNetworkCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetVirtualNetwork() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualNetwork + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetwork() + { + // Generated from example definition: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualNetwork.json + // this example is just showing the usage of "VirtualNetworks_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ScVmmVirtualNetworkResource + ScVmmVirtualNetworkCollection collection = resourceGroupResource.GetScVmmVirtualNetworks(); + + // invoke the operation + string virtualNetworkName = "HRVirtualNetwork"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkName); + ScVmmVirtualNetworkResource 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 + ScVmmVirtualNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateVirtualNetwork [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemCollection.cs index 67c06d547798..70c24ede7d32 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string inventoryItemName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName} + /// + /// + /// Operation Id + /// InventoryItems_Get + /// + /// + /// + /// Name of the inventoryItem. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string inventoryItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryItemName, nameof(inventoryItemName)); + + using var scope = _inventoryItemClientDiagnostics.CreateScope("InventoryItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _inventoryItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inventoryItemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InventoryItemResource(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.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName} + /// + /// + /// Operation Id + /// InventoryItems_Get + /// + /// + /// + /// Name of the inventoryItem. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string inventoryItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryItemName, nameof(inventoryItemName)); + + using var scope = _inventoryItemClientDiagnostics.CreateScope("InventoryItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _inventoryItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inventoryItemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InventoryItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetCollection.cs index c9ddb2972f42..b58e1ba6cc7b 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string availabilitySetName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName} + /// + /// + /// Operation Id + /// AvailabilitySets_Get + /// + /// + /// + /// Name of the AvailabilitySet. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string availabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(availabilitySetName, nameof(availabilitySetName)); + + using var scope = _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics.CreateScope("ScVmmAvailabilitySetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scVmmAvailabilitySetAvailabilitySetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, availabilitySetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmAvailabilitySetResource(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.ScVmm/availabilitySets/{availabilitySetName} + /// + /// + /// Operation Id + /// AvailabilitySets_Get + /// + /// + /// + /// Name of the AvailabilitySet. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string availabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(availabilitySetName, nameof(availabilitySetName)); + + using var scope = _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics.CreateScope("ScVmmAvailabilitySetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scVmmAvailabilitySetAvailabilitySetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, availabilitySetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmAvailabilitySetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudCollection.cs index 1147c401409a..f58138dad4cb 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string cloudName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName} + /// + /// + /// Operation Id + /// Clouds_Get + /// + /// + /// + /// Name of the Cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string cloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudName, nameof(cloudName)); + + using var scope = _scVmmCloudCloudsClientDiagnostics.CreateScope("ScVmmCloudCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scVmmCloudCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, cloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmCloudResource(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.ScVmm/clouds/{cloudName} + /// + /// + /// Operation Id + /// Clouds_Get + /// + /// + /// + /// Name of the Cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string cloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudName, nameof(cloudName)); + + using var scope = _scVmmCloudCloudsClientDiagnostics.CreateScope("ScVmmCloudCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scVmmCloudCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, cloudName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmCloudResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerCollection.cs index 1e330cb5a371..36cc55e7eb5f 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string vmmServerName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName} + /// + /// + /// Operation Id + /// VmmServers_Get + /// + /// + /// + /// Name of the VMMServer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vmmServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmmServerName, nameof(vmmServerName)); + + using var scope = _scVmmServerVmmServersClientDiagnostics.CreateScope("ScVmmServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scVmmServerVmmServersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vmmServerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmServerResource(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.ScVmm/vmmServers/{vmmServerName} + /// + /// + /// Operation Id + /// VmmServers_Get + /// + /// + /// + /// Name of the VMMServer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vmmServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmmServerName, nameof(vmmServerName)); + + using var scope = _scVmmServerVmmServersClientDiagnostics.CreateScope("ScVmmServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scVmmServerVmmServersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vmmServerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineCollection.cs index 39cdb20b5ce9..28b3f9df76e9 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualMachineName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Name of the VirtualMachine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); + + using var scope = _scVmmVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("ScVmmVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scVmmVirtualMachineVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmVirtualMachineResource(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.ScVmm/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Name of the VirtualMachine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); + + using var scope = _scVmmVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("ScVmmVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scVmmVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateCollection.cs index 25315fafec81..a8963d4d10fa 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualMachineTemplateName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName} + /// + /// + /// Operation Id + /// VirtualMachineTemplates_Get + /// + /// + /// + /// Name of the VirtualMachineTemplate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualMachineTemplateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineTemplateName, nameof(virtualMachineTemplateName)); + + using var scope = _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics.CreateScope("ScVmmVirtualMachineTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineTemplateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmVirtualMachineTemplateResource(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.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName} + /// + /// + /// Operation Id + /// VirtualMachineTemplates_Get + /// + /// + /// + /// Name of the VirtualMachineTemplate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineTemplateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineTemplateName, nameof(virtualMachineTemplateName)); + + using var scope = _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics.CreateScope("ScVmmVirtualMachineTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineTemplateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmVirtualMachineTemplateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkCollection.cs index d43dbd0e6936..efc9e4f424bb 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualNetworkName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// Name of the VirtualNetwork. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var scope = _scVmmVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("ScVmmVirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scVmmVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmVirtualNetworkResource(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.ScVmm/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// Name of the VirtualNetwork. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var scope = _scVmmVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("ScVmmVirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scVmmVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScVmmVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/samples/Generated/Samples/Sample_AttestationPrivateEndpointConnectionCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/samples/Generated/Samples/Sample_AttestationPrivateEndpointConnectionCollection.cs index ddcc757107b8..4bc00512374e 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/samples/Generated/Samples/Sample_AttestationPrivateEndpointConnectionCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/samples/Generated/Samples/Sample_AttestationPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_AttestationProviderGetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // AttestationProviderGetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AttestationProviderGetPrivateEndpointConnection() + { + // Generated from example definition: specification/attestation/resource-manager/Microsoft.Attestation/preview/2021-06-01-preview/examples/AttestationProviderGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 AttestationProviderResource created on azure + // for more information of creating AttestationProviderResource, please refer to the document of AttestationProviderResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res6977"; + string providerName = "sto2527"; + ResourceIdentifier attestationProviderResourceId = AttestationProviderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, providerName); + AttestationProviderResource attestationProvider = client.GetAttestationProviderResource(attestationProviderResourceId); + + // get the collection of this AttestationPrivateEndpointConnectionResource + AttestationPrivateEndpointConnectionCollection collection = attestationProvider.GetAttestationPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "{privateEndpointConnectionName}"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + AttestationPrivateEndpointConnectionResource 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 + AttestationPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AttestationProviderPutPrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/samples/Generated/Samples/Sample_AttestationProviderCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/samples/Generated/Samples/Sample_AttestationProviderCollection.cs index ec713a65dc6b..283dbc33de31 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/samples/Generated/Samples/Sample_AttestationProviderCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/samples/Generated/Samples/Sample_AttestationProviderCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_AttestationProvidersGet() Console.WriteLine($"Succeeded: {result}"); } + // AttestationProviders_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AttestationProvidersGet() + { + // Generated from example definition: specification/attestation/resource-manager/Microsoft.Attestation/preview/2021-06-01-preview/examples/Get_AttestationProvider.json + // this example is just showing the usage of "AttestationProviders_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 = "MyResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AttestationProviderResource + AttestationProviderCollection collection = resourceGroupResource.GetAttestationProviders(); + + // invoke the operation + string providerName = "myattestationprovider"; + NullableResponse response = await collection.GetIfExistsAsync(providerName); + AttestationProviderResource 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 + AttestationProviderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AttestationProviders_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs index 2ebc377e53b1..6c397c44f497 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AttestationPrivateEndpointConnectionResource(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.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs index c7b0acdbb667..2a538079fefe 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string providerName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// + /// + /// Operation Id + /// AttestationProviders_Get + /// + /// + /// + /// Name of the attestation provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string providerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + + using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _attestationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AttestationProviderResource(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.Attestation/attestationProviders/{providerName} + /// + /// + /// Operation Id + /// AttestationProviders_Get + /// + /// + /// + /// Name of the attestation provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string providerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + + using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _attestationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, providerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_AuthorizationProviderOperationsMetadataCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_AuthorizationProviderOperationsMetadataCollection.cs index 8a745c4a9dee..0860bcdf0e7e 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_AuthorizationProviderOperationsMetadataCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_AuthorizationProviderOperationsMetadataCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -74,6 +75,45 @@ public async Task Exists_ListProviderOperationsMetadataForResourceProvider() Console.WriteLine($"Succeeded: {result}"); } + // List provider operations metadata for resource provider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ListProviderOperationsMetadataForResourceProvider() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetProviderOperationsRP.json + // this example is just showing the usage of "ProviderOperationsMetadata_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this AuthorizationProviderOperationsMetadataResource + AuthorizationProviderOperationsMetadataCollection collection = tenantResource.GetAllAuthorizationProviderOperationsMetadata(); + + // invoke the operation + string resourceProviderNamespace = "resourceProviderNamespace"; + NullableResponse response = await collection.GetIfExistsAsync(resourceProviderNamespace); + AuthorizationProviderOperationsMetadataResource 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 + AuthorizationProviderOperationsMetadataData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List provider operations metadata for all resource providers [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_AuthorizationRoleDefinitionCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_AuthorizationRoleDefinitionCollection.cs index 34e3333dac6d..503b705dd75d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_AuthorizationRoleDefinitionCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_AuthorizationRoleDefinitionCollection.cs @@ -77,6 +77,46 @@ public async Task Exists_GetRoleDefinitionByName() Console.WriteLine($"Succeeded: {result}"); } + // Get role definition by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleDefinitionByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionByName.json + // this example is just showing the usage of "RoleDefinitions_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this AuthorizationRoleDefinitionResource + string scope = "scope"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + AuthorizationRoleDefinitionCollection collection = client.GetAuthorizationRoleDefinitions(scopeId); + + // invoke the operation + ResourceIdentifier roleDefinitionId = new ResourceIdentifier("roleDefinitionId"); + NullableResponse response = await collection.GetIfExistsAsync(roleDefinitionId); + AuthorizationRoleDefinitionResource 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 + AuthorizationRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create role definition [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_DenyAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_DenyAssignmentCollection.cs index ec1ae82b2bef..e9ec4ff78bb4 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_DenyAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_DenyAssignmentCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -184,6 +185,46 @@ public async Task Exists_GetDenyAssignmentByName() Console.WriteLine($"Succeeded: {result}"); } + // Get deny assignment by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDenyAssignmentByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByNameId.json + // this example is just showing the usage of "DenyAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DenyAssignmentResource + string scope = "subscriptions/subId/resourcegroups/rgname"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + DenyAssignmentCollection collection = client.GetDenyAssignments(scopeId); + + // invoke the operation + string denyAssignmentId = "denyAssignmentId"; + NullableResponse response = await collection.GetIfExistsAsync(denyAssignmentId); + DenyAssignmentResource 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 + DenyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List deny assignments for scope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentCollection.cs index ed157ee1245b..d064542fb7dc 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentCollection.cs @@ -78,6 +78,46 @@ public async Task Exists_GetRoleAssignmentByScopeAndName() Console.WriteLine($"Succeeded: {result}"); } + // Get role assignment by scope and name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleAssignmentByScopeAndName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Get.json + // this example is just showing the usage of "RoleAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleAssignmentResource + string scope = "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleAssignmentCollection collection = client.GetRoleAssignments(scopeId); + + // invoke the operation + string roleAssignmentName = "b0f43c54-e787-4862-89b1-a653fa9cf747"; + NullableResponse response = await collection.GetIfExistsAsync(roleAssignmentName); + RoleAssignmentResource 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 + RoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create role assignment for resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleCollection.cs index e07a36a06f39..27a525049cff 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -76,6 +77,46 @@ public async Task Exists_GetRoleAssignmentScheduleByName() Console.WriteLine($"Succeeded: {result}"); } + // GetRoleAssignmentScheduleByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleAssignmentScheduleByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleByName.json + // this example is just showing the usage of "RoleAssignmentSchedules_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleAssignmentScheduleResource + string scope = "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleAssignmentScheduleCollection collection = client.GetRoleAssignmentSchedules(scopeId); + + // invoke the operation + string roleAssignmentScheduleName = "c9e264ff-3133-4776-a81a-ebc7c33c8ec6"; + NullableResponse response = await collection.GetIfExistsAsync(roleAssignmentScheduleName); + RoleAssignmentScheduleResource 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 + RoleAssignmentScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetRoleAssignmentSchedulesByScope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleInstanceCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleInstanceCollection.cs index 84cb1be87a1c..3a8a6f9f54f5 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleInstanceCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleInstanceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -110,5 +111,45 @@ public async Task Exists_GetRoleAssignmentScheduleInstanceByName() Console.WriteLine($"Succeeded: {result}"); } + + // GetRoleAssignmentScheduleInstanceByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleAssignmentScheduleInstanceByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleInstanceByName.json + // this example is just showing the usage of "RoleAssignmentScheduleInstances_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleAssignmentScheduleInstanceResource + string scope = "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleAssignmentScheduleInstanceCollection collection = client.GetRoleAssignmentScheduleInstances(scopeId); + + // invoke the operation + string roleAssignmentScheduleInstanceName = "ed9b8180-cef7-4c77-a63c-b8566ecfc412"; + NullableResponse response = await collection.GetIfExistsAsync(roleAssignmentScheduleInstanceName); + RoleAssignmentScheduleInstanceResource 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 + RoleAssignmentScheduleInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleRequestCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleRequestCollection.cs index e9131277ff84..d7a36656fdae 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleRequestCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleAssignmentScheduleRequestCollection.cs @@ -125,6 +125,46 @@ public async Task Exists_GetRoleAssignmentScheduleRequestByName() Console.WriteLine($"Succeeded: {result}"); } + // GetRoleAssignmentScheduleRequestByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleAssignmentScheduleRequestByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleRequestByName.json + // this example is just showing the usage of "RoleAssignmentScheduleRequests_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleAssignmentScheduleRequestResource + string scope = "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleAssignmentScheduleRequestCollection collection = client.GetRoleAssignmentScheduleRequests(scopeId); + + // invoke the operation + string roleAssignmentScheduleRequestName = "fea7a502-9a96-4806-a26f-eee560e52045"; + NullableResponse response = await collection.GetIfExistsAsync(roleAssignmentScheduleRequestName); + RoleAssignmentScheduleRequestResource 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 + RoleAssignmentScheduleRequestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetRoleAssignmentScheduleRequestByScope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleCollection.cs index e77e53e83e7e..b01aedc3616f 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -76,6 +77,46 @@ public async Task Exists_GetRoleEligibilityScheduleByName() Console.WriteLine($"Succeeded: {result}"); } + // GetRoleEligibilityScheduleByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleEligibilityScheduleByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleByName.json + // this example is just showing the usage of "RoleEligibilitySchedules_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleEligibilityScheduleResource + string scope = "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleEligibilityScheduleCollection collection = client.GetRoleEligibilitySchedules(scopeId); + + // invoke the operation + string roleEligibilityScheduleName = "b1477448-2cc6-4ceb-93b4-54a202a89413"; + NullableResponse response = await collection.GetIfExistsAsync(roleEligibilityScheduleName); + RoleEligibilityScheduleResource 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 + RoleEligibilityScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetRoleEligibilitySchedulesByScope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleInstanceCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleInstanceCollection.cs index ee2bd82b4feb..0524e9397c8b 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleInstanceCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleInstanceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -110,5 +111,45 @@ public async Task Exists_GetRoleEligibilityScheduleInstanceByName() Console.WriteLine($"Succeeded: {result}"); } + + // GetRoleEligibilityScheduleInstanceByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleEligibilityScheduleInstanceByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleInstanceByName.json + // this example is just showing the usage of "RoleEligibilityScheduleInstances_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleEligibilityScheduleInstanceResource + string scope = "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleEligibilityScheduleInstanceCollection collection = client.GetRoleEligibilityScheduleInstances(scopeId); + + // invoke the operation + string roleEligibilityScheduleInstanceName = "21e4b59a-0499-4fe0-a3c3-43a3055b773a"; + NullableResponse response = await collection.GetIfExistsAsync(roleEligibilityScheduleInstanceName); + RoleEligibilityScheduleInstanceResource 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 + RoleEligibilityScheduleInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleRequestCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleRequestCollection.cs index cfa84f999ddb..ca31bccdd404 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleRequestCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleEligibilityScheduleRequestCollection.cs @@ -124,6 +124,46 @@ public async Task Exists_GetRoleEligibilityScheduleRequestByName() Console.WriteLine($"Succeeded: {result}"); } + // GetRoleEligibilityScheduleRequestByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleEligibilityScheduleRequestByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleRequestByName.json + // this example is just showing the usage of "RoleEligibilityScheduleRequests_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleEligibilityScheduleRequestResource + string scope = "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleEligibilityScheduleRequestCollection collection = client.GetRoleEligibilityScheduleRequests(scopeId); + + // invoke the operation + string roleEligibilityScheduleRequestName = "64caffb6-55c0-4deb-a585-68e948ea1ad6"; + NullableResponse response = await collection.GetIfExistsAsync(roleEligibilityScheduleRequestName); + RoleEligibilityScheduleRequestResource 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 + RoleEligibilityScheduleRequestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetRoleEligibilityScheduleRequestByScope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleManagementPolicyAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleManagementPolicyAssignmentCollection.cs index a5877b4c41fe..7c86905c64ec 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleManagementPolicyAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleManagementPolicyAssignmentCollection.cs @@ -77,6 +77,46 @@ public async Task Exists_GetConfigurations() Console.WriteLine($"Succeeded: {result}"); } + // GetConfigurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConfigurations() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyAssignmentByName.json + // this example is just showing the usage of "RoleManagementPolicyAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleManagementPolicyAssignmentResource + string scope = "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleManagementPolicyAssignmentCollection collection = client.GetRoleManagementPolicyAssignments(scopeId); + + // invoke the operation + string roleManagementPolicyAssignmentName = "b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"; + NullableResponse response = await collection.GetIfExistsAsync(roleManagementPolicyAssignmentName); + RoleManagementPolicyAssignmentResource 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 + RoleManagementPolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutRoleManagementPolicyAssignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleManagementPolicyCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleManagementPolicyCollection.cs index 8123dd818fcb..e83120e59104 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleManagementPolicyCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_RoleManagementPolicyCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -76,6 +77,46 @@ public async Task Exists_GetRoleManagementPolicyByName() Console.WriteLine($"Succeeded: {result}"); } + // GetRoleManagementPolicyByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoleManagementPolicyByName() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyByName.json + // this example is just showing the usage of "RoleManagementPolicies_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this RoleManagementPolicyResource + string scope = "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + RoleManagementPolicyCollection collection = client.GetRoleManagementPolicies(scopeId); + + // invoke the operation + string roleManagementPolicyName = "570c3619-7688-4b34-b290-2b8bb3ccab2a"; + NullableResponse response = await collection.GetIfExistsAsync(roleManagementPolicyName); + RoleManagementPolicyResource 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 + RoleManagementPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetRoleManagementPolicyByRoleDefinitionFilter [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataCollection.cs index 4ec82405299b..8f8f0e647eaf 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataCollection.cs @@ -244,6 +244,80 @@ public virtual Response Exists(string resourceProviderNamespace, string ex } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace} + /// + /// + /// Operation Id + /// ProviderOperationsMetadata_Get + /// + /// + /// + /// The namespace of the resource provider. + /// Specifies whether to expand the values. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceProviderNamespace, nameof(resourceProviderNamespace)); + + using var scope = _authorizationProviderOperationsMetadataProviderOperationsMetadataClientDiagnostics.CreateScope("AuthorizationProviderOperationsMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _authorizationProviderOperationsMetadataProviderOperationsMetadataRestClient.GetAsync(resourceProviderNamespace, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderOperationsMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace} + /// + /// + /// Operation Id + /// ProviderOperationsMetadata_Get + /// + /// + /// + /// The namespace of the resource provider. + /// Specifies whether to expand the values. + /// The cancellation token to use. + /// is null. + public virtual NullableResponse GetIfExists(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceProviderNamespace, nameof(resourceProviderNamespace)); + + using var scope = _authorizationProviderOperationsMetadataProviderOperationsMetadataClientDiagnostics.CreateScope("AuthorizationProviderOperationsMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = _authorizationProviderOperationsMetadataProviderOperationsMetadataRestClient.Get(resourceProviderNamespace, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderOperationsMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionCollection.cs index b394879d965e..b2ed45c3e3fd 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionCollection.cs @@ -309,6 +309,78 @@ public virtual Response Exists(ResourceIdentifier roleDefinitionId, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// RoleDefinitions_Get + /// + /// + /// + /// The ID of the role definition. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetIfExistsAsync(ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(roleDefinitionId, nameof(roleDefinitionId)); + + using var scope = _authorizationRoleDefinitionRoleDefinitionsClientDiagnostics.CreateScope("AuthorizationRoleDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _authorizationRoleDefinitionRoleDefinitionsRestClient.GetAsync(Id, roleDefinitionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// RoleDefinitions_Get + /// + /// + /// + /// The ID of the role definition. + /// The cancellation token to use. + /// is null. + public virtual NullableResponse GetIfExists(ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(roleDefinitionId, nameof(roleDefinitionId)); + + using var scope = _authorizationRoleDefinitionRoleDefinitionsClientDiagnostics.CreateScope("AuthorizationRoleDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _authorizationRoleDefinitionRoleDefinitionsRestClient.Get(Id, roleDefinitionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentCollection.cs index a0c69fc9eacc..a56316e82a1a 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string denyAssignmentId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} + /// + /// + /// Operation Id + /// DenyAssignments_Get + /// + /// + /// + /// The ID of the deny assignment to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string denyAssignmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(denyAssignmentId, nameof(denyAssignmentId)); + + using var scope = _denyAssignmentClientDiagnostics.CreateScope("DenyAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _denyAssignmentRestClient.GetAsync(Id, denyAssignmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DenyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} + /// + /// + /// Operation Id + /// DenyAssignments_Get + /// + /// + /// + /// The ID of the deny assignment to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string denyAssignmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(denyAssignmentId, nameof(denyAssignmentId)); + + using var scope = _denyAssignmentClientDiagnostics.CreateScope("DenyAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _denyAssignmentRestClient.Get(Id, denyAssignmentId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DenyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentCollection.cs index dcd3bcef6842..a3b07d38801f 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentCollection.cs @@ -318,6 +318,80 @@ public virtual Response Exists(string roleAssignmentName, string tenantId } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// The name of the role assignment. It can be any valid GUID. + /// Tenant ID for cross-tenant request. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(roleAssignmentName, nameof(roleAssignmentName)); + + using var scope = _roleAssignmentClientDiagnostics.CreateScope("RoleAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleAssignmentRestClient.GetAsync(Id, roleAssignmentName, tenantId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// The name of the role assignment. It can be any valid GUID. + /// Tenant ID for cross-tenant request. + /// The cancellation token to use. + /// is null. + public virtual NullableResponse GetIfExists(string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(roleAssignmentName, nameof(roleAssignmentName)); + + using var scope = _roleAssignmentClientDiagnostics.CreateScope("RoleAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleAssignmentRestClient.Get(Id, roleAssignmentName, tenantId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleCollection.cs index ba0261684e3c..b10951602960 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleCollection.cs @@ -233,6 +233,80 @@ public virtual Response Exists(string roleAssignmentScheduleName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} + /// + /// + /// Operation Id + /// RoleAssignmentSchedules_Get + /// + /// + /// + /// The name (guid) of the role assignment schedule to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleAssignmentScheduleName, nameof(roleAssignmentScheduleName)); + + using var scope = _roleAssignmentScheduleClientDiagnostics.CreateScope("RoleAssignmentScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleAssignmentScheduleRestClient.GetAsync(Id, roleAssignmentScheduleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} + /// + /// + /// Operation Id + /// RoleAssignmentSchedules_Get + /// + /// + /// + /// The name (guid) of the role assignment schedule to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleAssignmentScheduleName, nameof(roleAssignmentScheduleName)); + + using var scope = _roleAssignmentScheduleClientDiagnostics.CreateScope("RoleAssignmentScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleAssignmentScheduleRestClient.Get(Id, roleAssignmentScheduleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceCollection.cs index bb4c2a0c9489..df25498e7c98 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceCollection.cs @@ -233,6 +233,80 @@ public virtual Response Exists(string roleAssignmentScheduleInstanceName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleInstances_Get + /// + /// + /// + /// The name (hash of schedule name + time) of the role assignment schedule to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleAssignmentScheduleInstanceName, nameof(roleAssignmentScheduleInstanceName)); + + using var scope = _roleAssignmentScheduleInstanceClientDiagnostics.CreateScope("RoleAssignmentScheduleInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleAssignmentScheduleInstanceRestClient.GetAsync(Id, roleAssignmentScheduleInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentScheduleInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleInstances_Get + /// + /// + /// + /// The name (hash of schedule name + time) of the role assignment schedule to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleAssignmentScheduleInstanceName, nameof(roleAssignmentScheduleInstanceName)); + + using var scope = _roleAssignmentScheduleInstanceClientDiagnostics.CreateScope("RoleAssignmentScheduleInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleAssignmentScheduleInstanceRestClient.Get(Id, roleAssignmentScheduleInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentScheduleInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestCollection.cs index 64ff4a4afaed..20033add2356 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestCollection.cs @@ -315,6 +315,80 @@ public virtual Response Exists(string roleAssignmentScheduleRequestName, C } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleRequests_Get + /// + /// + /// + /// The name (guid) of the role assignment schedule request to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleAssignmentScheduleRequestName, nameof(roleAssignmentScheduleRequestName)); + + using var scope = _roleAssignmentScheduleRequestClientDiagnostics.CreateScope("RoleAssignmentScheduleRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleAssignmentScheduleRequestRestClient.GetAsync(Id, roleAssignmentScheduleRequestName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentScheduleRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleRequests_Get + /// + /// + /// + /// The name (guid) of the role assignment schedule request to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleAssignmentScheduleRequestName, nameof(roleAssignmentScheduleRequestName)); + + using var scope = _roleAssignmentScheduleRequestClientDiagnostics.CreateScope("RoleAssignmentScheduleRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleAssignmentScheduleRequestRestClient.Get(Id, roleAssignmentScheduleRequestName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentScheduleRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleCollection.cs index 8a4f34393219..6bda45d1b6cc 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleCollection.cs @@ -233,6 +233,80 @@ public virtual Response Exists(string roleEligibilityScheduleName, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} + /// + /// + /// Operation Id + /// RoleEligibilitySchedules_Get + /// + /// + /// + /// The name (guid) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleEligibilityScheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleEligibilityScheduleName, nameof(roleEligibilityScheduleName)); + + using var scope = _roleEligibilityScheduleClientDiagnostics.CreateScope("RoleEligibilityScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleEligibilityScheduleRestClient.GetAsync(Id, roleEligibilityScheduleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleEligibilityScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} + /// + /// + /// Operation Id + /// RoleEligibilitySchedules_Get + /// + /// + /// + /// The name (guid) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleEligibilityScheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleEligibilityScheduleName, nameof(roleEligibilityScheduleName)); + + using var scope = _roleEligibilityScheduleClientDiagnostics.CreateScope("RoleEligibilityScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleEligibilityScheduleRestClient.Get(Id, roleEligibilityScheduleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleEligibilityScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceCollection.cs index 0418673fcf06..633fe97e6769 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceCollection.cs @@ -233,6 +233,80 @@ public virtual Response Exists(string roleEligibilityScheduleInstanceName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleInstances_Get + /// + /// + /// + /// The name (hash of schedule name + time) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleEligibilityScheduleInstanceName, nameof(roleEligibilityScheduleInstanceName)); + + using var scope = _roleEligibilityScheduleInstanceClientDiagnostics.CreateScope("RoleEligibilityScheduleInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleEligibilityScheduleInstanceRestClient.GetAsync(Id, roleEligibilityScheduleInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleEligibilityScheduleInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleInstances_Get + /// + /// + /// + /// The name (hash of schedule name + time) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleEligibilityScheduleInstanceName, nameof(roleEligibilityScheduleInstanceName)); + + using var scope = _roleEligibilityScheduleInstanceClientDiagnostics.CreateScope("RoleEligibilityScheduleInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleEligibilityScheduleInstanceRestClient.Get(Id, roleEligibilityScheduleInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleEligibilityScheduleInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestCollection.cs index defa45bf60b6..428435380d0f 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestCollection.cs @@ -315,6 +315,80 @@ public virtual Response Exists(string roleEligibilityScheduleRequestName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleRequests_Get + /// + /// + /// + /// The name (guid) of the role eligibility schedule request to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleEligibilityScheduleRequestName, nameof(roleEligibilityScheduleRequestName)); + + using var scope = _roleEligibilityScheduleRequestClientDiagnostics.CreateScope("RoleEligibilityScheduleRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleEligibilityScheduleRequestRestClient.GetAsync(Id, roleEligibilityScheduleRequestName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleEligibilityScheduleRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleRequests_Get + /// + /// + /// + /// The name (guid) of the role eligibility schedule request to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleEligibilityScheduleRequestName, nameof(roleEligibilityScheduleRequestName)); + + using var scope = _roleEligibilityScheduleRequestClientDiagnostics.CreateScope("RoleEligibilityScheduleRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleEligibilityScheduleRequestRestClient.Get(Id, roleEligibilityScheduleRequestName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleEligibilityScheduleRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentCollection.cs index 3d37dd79861f..a8e0b57ade74 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string roleManagementPolicyAssignmentName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} + /// + /// + /// Operation Id + /// RoleManagementPolicyAssignments_Get + /// + /// + /// + /// The name of format {guid_guid} the role management policy assignment to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleManagementPolicyAssignmentName, nameof(roleManagementPolicyAssignmentName)); + + using var scope = _roleManagementPolicyAssignmentClientDiagnostics.CreateScope("RoleManagementPolicyAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleManagementPolicyAssignmentRestClient.GetAsync(Id, roleManagementPolicyAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleManagementPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} + /// + /// + /// Operation Id + /// RoleManagementPolicyAssignments_Get + /// + /// + /// + /// The name of format {guid_guid} the role management policy assignment to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleManagementPolicyAssignmentName, nameof(roleManagementPolicyAssignmentName)); + + using var scope = _roleManagementPolicyAssignmentClientDiagnostics.CreateScope("RoleManagementPolicyAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleManagementPolicyAssignmentRestClient.Get(Id, roleManagementPolicyAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleManagementPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyCollection.cs index fd0427ee2c0b..31ca416fd9ff 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyCollection.cs @@ -231,6 +231,80 @@ public virtual Response Exists(string roleManagementPolicyName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} + /// + /// + /// Operation Id + /// RoleManagementPolicies_Get + /// + /// + /// + /// The name (guid) of the role management policy to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleManagementPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleManagementPolicyName, nameof(roleManagementPolicyName)); + + using var scope = _roleManagementPolicyClientDiagnostics.CreateScope("RoleManagementPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleManagementPolicyRestClient.GetAsync(Id, roleManagementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleManagementPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} + /// + /// + /// Operation Id + /// RoleManagementPolicies_Get + /// + /// + /// + /// The name (guid) of the role management policy to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleManagementPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleManagementPolicyName, nameof(roleManagementPolicyName)); + + using var scope = _roleManagementPolicyClientDiagnostics.CreateScope("RoleManagementPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleManagementPolicyRestClient.Get(Id, roleManagementPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleManagementPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageBestPracticeCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageBestPracticeCollection.cs index d65455025358..73e4c83c5a38 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageBestPracticeCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageBestPracticeCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -74,6 +75,45 @@ public async Task Exists_GetAnAutomanageBestPractice() Console.WriteLine($"Succeeded: {result}"); } + // Get an Automanage best practice + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAutomanageBestPractice() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getBestPractice.json + // this example is just showing the usage of "BestPractices_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this AutomanageBestPracticeResource + AutomanageBestPracticeCollection collection = tenantResource.GetAutomanageBestPractices(); + + // invoke the operation + string bestPracticeName = "azureBestPracticesProduction"; + NullableResponse response = await collection.GetIfExistsAsync(bestPracticeName); + AutomanageBestPracticeResource 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 + AutomanageBestPracticeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Automanage bestPractices [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageConfigurationProfileCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageConfigurationProfileCollection.cs index 616b58afe625..93cd1e1b0831 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageConfigurationProfileCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageConfigurationProfileCollection.cs @@ -137,6 +137,48 @@ public async Task Exists_GetAConfigurationProfile() Console.WriteLine($"Succeeded: {result}"); } + // Get a configuration profile + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAConfigurationProfile() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getConfigurationProfile.json + // this example is just showing the usage of "ConfigurationProfiles_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 = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AutomanageConfigurationProfileResource + AutomanageConfigurationProfileCollection collection = resourceGroupResource.GetAutomanageConfigurationProfiles(); + + // invoke the operation + string configurationProfileName = "customConfigurationProfile"; + NullableResponse response = await collection.GetIfExistsAsync(configurationProfileName); + AutomanageConfigurationProfileResource 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 + AutomanageConfigurationProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List configuration profiles by resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageConfigurationProfileVersionCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageConfigurationProfileVersionCollection.cs index 2ec869be8ccc..68cff3dd4db8 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageConfigurationProfileVersionCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageConfigurationProfileVersionCollection.cs @@ -139,6 +139,49 @@ public async Task Exists_GetAConfigurationProfileVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get a configuration profile version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAConfigurationProfileVersion() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getConfigurationProfileVersion.json + // this example is just showing the usage of "ConfigurationProfilesVersions_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 AutomanageConfigurationProfileResource created on azure + // for more information of creating AutomanageConfigurationProfileResource, please refer to the document of AutomanageConfigurationProfileResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string configurationProfileName = "customConfigurationProfile"; + ResourceIdentifier automanageConfigurationProfileResourceId = AutomanageConfigurationProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configurationProfileName); + AutomanageConfigurationProfileResource automanageConfigurationProfile = client.GetAutomanageConfigurationProfileResource(automanageConfigurationProfileResourceId); + + // get the collection of this AutomanageConfigurationProfileVersionResource + AutomanageConfigurationProfileVersionCollection collection = automanageConfigurationProfile.GetAutomanageConfigurationProfileVersions(); + + // invoke the operation + string versionName = "version1"; + NullableResponse response = await collection.GetIfExistsAsync(versionName); + AutomanageConfigurationProfileVersionResource 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 + AutomanageConfigurationProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List configuration profile versions by configuration profile [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHciClusterConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHciClusterConfigurationProfileAssignmentCollection.cs index 05533afe66e7..b4bb7452f990 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHciClusterConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHciClusterConfigurationProfileAssignmentCollection.cs @@ -159,5 +159,47 @@ public async Task Exists_GetAHCIConfigurationProfileAssignment() Console.WriteLine($"Succeeded: {result}"); } + + // Get a HCI configuration profile assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAHCIConfigurationProfileAssignment() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getConfigurationProfileHCIAssignment.json + // this example is just showing the usage of "ConfigurationProfileHCIAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this AutomanageHciClusterConfigurationProfileAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string clusterName = "myClusterName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.AzureStackHci/clusters/{2}", subscriptionId, resourceGroupName, clusterName)); + AutomanageHciClusterConfigurationProfileAssignmentCollection collection = client.GetAutomanageHciClusterConfigurationProfileAssignments(scopeId); + + // invoke the operation + string configurationProfileAssignmentName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(configurationProfileAssignmentName); + AutomanageHciClusterConfigurationProfileAssignmentResource 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 + AutomanageConfigurationProfileAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs index 1a9611199e3f..b167d80e5325 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_GetAReportForAHCIConfigurationProfileAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get a report for a HCI configuration profile assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAReportForAHCIConfigurationProfileAssignment() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getHCIReport.json + // this example is just showing the usage of "HCIReports_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 AutomanageHciClusterConfigurationProfileAssignmentResource created on azure + // for more information of creating AutomanageHciClusterConfigurationProfileAssignmentResource, please refer to the document of AutomanageHciClusterConfigurationProfileAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string clusterName = "myClusterName"; + string configurationProfileAssignmentName = "default"; + ResourceIdentifier automanageHciClusterConfigurationProfileAssignmentResourceId = AutomanageHciClusterConfigurationProfileAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, configurationProfileAssignmentName); + AutomanageHciClusterConfigurationProfileAssignmentResource automanageHciClusterConfigurationProfileAssignment = client.GetAutomanageHciClusterConfigurationProfileAssignmentResource(automanageHciClusterConfigurationProfileAssignmentResourceId); + + // get the collection of this AutomanageHciClusterConfigurationProfileAssignmentReportResource + AutomanageHciClusterConfigurationProfileAssignmentReportCollection collection = automanageHciClusterConfigurationProfileAssignment.GetAutomanageHciClusterConfigurationProfileAssignmentReports(); + + // invoke the operation + string reportName = "b4e9ee6b-1717-4ff0-a8d2-e6d72c33d5f4"; + NullableResponse response = await collection.GetIfExistsAsync(reportName); + AutomanageHciClusterConfigurationProfileAssignmentReportResource 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 + AutomanageConfigurationProfileAssignmentReportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List reports by HCI configuration profiles assignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHcrpConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHcrpConfigurationProfileAssignmentCollection.cs index 20dd7a3b6caf..b904a2d01360 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHcrpConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHcrpConfigurationProfileAssignmentCollection.cs @@ -159,5 +159,47 @@ public async Task Exists_GetAHCRPConfigurationProfileAssignment() Console.WriteLine($"Succeeded: {result}"); } + + // Get a HCRP configuration profile assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAHCRPConfigurationProfileAssignment() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getConfigurationProfileHCRPAssignment.json + // this example is just showing the usage of "ConfigurationProfileHCRPAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this AutomanageHcrpConfigurationProfileAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string machineName = "myMachineName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.HybridCompute/machines/{2}", subscriptionId, resourceGroupName, machineName)); + AutomanageHcrpConfigurationProfileAssignmentCollection collection = client.GetAutomanageHcrpConfigurationProfileAssignments(scopeId); + + // invoke the operation + string configurationProfileAssignmentName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(configurationProfileAssignmentName); + AutomanageHcrpConfigurationProfileAssignmentResource 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 + AutomanageConfigurationProfileAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs index 01374fefaff1..e18bee1dab87 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_GetAReportForAHCRPConfigurationProfileAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get a report for a HCRP configuration profile assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAReportForAHCRPConfigurationProfileAssignment() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getHCRPReport.json + // this example is just showing the usage of "HCRPReports_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 AutomanageHcrpConfigurationProfileAssignmentResource created on azure + // for more information of creating AutomanageHcrpConfigurationProfileAssignmentResource, please refer to the document of AutomanageHcrpConfigurationProfileAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string machineName = "myMachineName"; + string configurationProfileAssignmentName = "default"; + ResourceIdentifier automanageHcrpConfigurationProfileAssignmentResourceId = AutomanageHcrpConfigurationProfileAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, machineName, configurationProfileAssignmentName); + AutomanageHcrpConfigurationProfileAssignmentResource automanageHcrpConfigurationProfileAssignment = client.GetAutomanageHcrpConfigurationProfileAssignmentResource(automanageHcrpConfigurationProfileAssignmentResourceId); + + // get the collection of this AutomanageHcrpConfigurationProfileAssignmentReportResource + AutomanageHcrpConfigurationProfileAssignmentReportCollection collection = automanageHcrpConfigurationProfileAssignment.GetAutomanageHcrpConfigurationProfileAssignmentReports(); + + // invoke the operation + string reportName = "b4e9ee6b-1717-4ff0-a8d2-e6d72c33d5f4"; + NullableResponse response = await collection.GetIfExistsAsync(reportName); + AutomanageHcrpConfigurationProfileAssignmentReportResource 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 + AutomanageConfigurationProfileAssignmentReportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List reports by HCRP configuration profiles assignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageVmConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageVmConfigurationProfileAssignmentCollection.cs index 769eff5b439a..539f545e31b5 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageVmConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageVmConfigurationProfileAssignmentCollection.cs @@ -124,6 +124,48 @@ public async Task Exists_GetAConfigurationProfileAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get a configuration profile assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAConfigurationProfileAssignment() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getConfigurationProfileAssignment.json + // this example is just showing the usage of "ConfigurationProfileAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this AutomanageVmConfigurationProfileAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualMachines/{2}", subscriptionId, resourceGroupName, vmName)); + AutomanageVmConfigurationProfileAssignmentCollection collection = client.GetAutomanageVmConfigurationProfileAssignments(scopeId); + + // invoke the operation + string configurationProfileAssignmentName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(configurationProfileAssignmentName); + AutomanageVmConfigurationProfileAssignmentResource 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 + AutomanageConfigurationProfileAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List configuration profile assignments by resourceGroup and virtual machine [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageVmConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageVmConfigurationProfileAssignmentReportCollection.cs index 163dcaad363e..5a6deb71ea85 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageVmConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/samples/Generated/Samples/Sample_AutomanageVmConfigurationProfileAssignmentReportCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_GetAReportForAConfigurationProfileAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get a report for a configuration profile assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAReportForAConfigurationProfileAssignment() + { + // Generated from example definition: specification/automanage/resource-manager/Microsoft.Automanage/stable/2022-05-04/examples/getReport.json + // this example is just showing the usage of "reports_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 AutomanageVmConfigurationProfileAssignmentResource created on azure + // for more information of creating AutomanageVmConfigurationProfileAssignmentResource, please refer to the document of AutomanageVmConfigurationProfileAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + string configurationProfileAssignmentName = "default"; + ResourceIdentifier automanageVmConfigurationProfileAssignmentResourceId = AutomanageVmConfigurationProfileAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName, configurationProfileAssignmentName); + AutomanageVmConfigurationProfileAssignmentResource automanageVmConfigurationProfileAssignment = client.GetAutomanageVmConfigurationProfileAssignmentResource(automanageVmConfigurationProfileAssignmentResourceId); + + // get the collection of this AutomanageVmConfigurationProfileAssignmentReportResource + AutomanageVmConfigurationProfileAssignmentReportCollection collection = automanageVmConfigurationProfileAssignment.GetAutomanageVmConfigurationProfileAssignmentReports(); + + // invoke the operation + string reportName = "b4e9ee6b-1717-4ff0-a8d2-e6d72c33d5f4"; + NullableResponse response = await collection.GetIfExistsAsync(reportName); + AutomanageVmConfigurationProfileAssignmentReportResource 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 + AutomanageConfigurationProfileAssignmentReportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List reports by configuration profiles assignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeCollection.cs index f88d39076e84..529995aa61bd 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeCollection.cs @@ -240,6 +240,80 @@ public virtual Response Exists(string bestPracticeName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Automanage/bestPractices/{bestPracticeName} + /// + /// + /// Operation Id + /// BestPractices_Get + /// + /// + /// + /// The Automanage best practice name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string bestPracticeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bestPracticeName, nameof(bestPracticeName)); + + using var scope = _automanageBestPracticeBestPracticesClientDiagnostics.CreateScope("AutomanageBestPracticeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageBestPracticeBestPracticesRestClient.GetAsync(bestPracticeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageBestPracticeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Automanage/bestPractices/{bestPracticeName} + /// + /// + /// Operation Id + /// BestPractices_Get + /// + /// + /// + /// The Automanage best practice name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string bestPracticeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bestPracticeName, nameof(bestPracticeName)); + + using var scope = _automanageBestPracticeBestPracticesClientDiagnostics.CreateScope("AutomanageBestPracticeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageBestPracticeBestPracticesRestClient.Get(bestPracticeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageBestPracticeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileCollection.cs index 772412d6f62b..f5c1255ba7fc 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string configurationProfileName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName} + /// + /// + /// Operation Id + /// ConfigurationProfiles_Get + /// + /// + /// + /// The configuration profile name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationProfileName, nameof(configurationProfileName)); + + using var scope = _automanageConfigurationProfileConfigurationProfilesClientDiagnostics.CreateScope("AutomanageConfigurationProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageConfigurationProfileConfigurationProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationProfileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageConfigurationProfileResource(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.Automanage/configurationProfiles/{configurationProfileName} + /// + /// + /// Operation Id + /// ConfigurationProfiles_Get + /// + /// + /// + /// The configuration profile name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationProfileName, nameof(configurationProfileName)); + + using var scope = _automanageConfigurationProfileConfigurationProfilesClientDiagnostics.CreateScope("AutomanageConfigurationProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageConfigurationProfileConfigurationProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationProfileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageConfigurationProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionCollection.cs index 311ec313175b..ac401c8f74a9 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string versionName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName} + /// + /// + /// Operation Id + /// ConfigurationProfilesVersions_Get + /// + /// + /// + /// The configuration profile version name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _automanageConfigurationProfileVersionConfigurationProfilesVersionsClientDiagnostics.CreateScope("AutomanageConfigurationProfileVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageConfigurationProfileVersionConfigurationProfilesVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageConfigurationProfileVersionResource(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.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName} + /// + /// + /// Operation Id + /// ConfigurationProfilesVersions_Get + /// + /// + /// + /// The configuration profile version name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _automanageConfigurationProfileVersionConfigurationProfilesVersionsClientDiagnostics.CreateScope("AutomanageConfigurationProfileVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageConfigurationProfileVersionConfigurationProfilesVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageConfigurationProfileVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentCollection.cs index bfcdd3fcba5f..578fbf4d3b55 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string configurationProfileAssignmentName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileHCIAssignments_Get + /// + /// + /// + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationProfileAssignmentName, nameof(configurationProfileAssignmentName)); + + using var scope = _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileHCIAssignmentsClientDiagnostics.CreateScope("AutomanageHciClusterConfigurationProfileAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileHCIAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationProfileAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageHciClusterConfigurationProfileAssignmentResource(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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileHCIAssignments_Get + /// + /// + /// + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationProfileAssignmentName, nameof(configurationProfileAssignmentName)); + + using var scope = _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileHCIAssignmentsClientDiagnostics.CreateScope("AutomanageHciClusterConfigurationProfileAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileHCIAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationProfileAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageHciClusterConfigurationProfileAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs index f9263a250ee6..fd589f3e2810 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string reportName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName} + /// + /// + /// Operation Id + /// HCIReports_Get + /// + /// + /// + /// The report name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string reportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportName, nameof(reportName)); + + using var scope = _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsClientDiagnostics.CreateScope("AutomanageHciClusterConfigurationProfileAssignmentReportCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, reportName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageHciClusterConfigurationProfileAssignmentReportResource(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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName} + /// + /// + /// Operation Id + /// HCIReports_Get + /// + /// + /// + /// The report name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string reportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportName, nameof(reportName)); + + using var scope = _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsClientDiagnostics.CreateScope("AutomanageHciClusterConfigurationProfileAssignmentReportCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, reportName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageHciClusterConfigurationProfileAssignmentReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentCollection.cs index 3cc74d03dfc1..e4ebfaf5bef3 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string configurationProfileAssignmentName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileHCRPAssignments_Get + /// + /// + /// + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationProfileAssignmentName, nameof(configurationProfileAssignmentName)); + + using var scope = _automanageHcrpConfigurationProfileAssignmentConfigurationProfileHCRPAssignmentsClientDiagnostics.CreateScope("AutomanageHcrpConfigurationProfileAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageHcrpConfigurationProfileAssignmentConfigurationProfileHCRPAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationProfileAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageHcrpConfigurationProfileAssignmentResource(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.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileHCRPAssignments_Get + /// + /// + /// + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationProfileAssignmentName, nameof(configurationProfileAssignmentName)); + + using var scope = _automanageHcrpConfigurationProfileAssignmentConfigurationProfileHCRPAssignmentsClientDiagnostics.CreateScope("AutomanageHcrpConfigurationProfileAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageHcrpConfigurationProfileAssignmentConfigurationProfileHCRPAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationProfileAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageHcrpConfigurationProfileAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs index 3fe683481505..5dc4272534b1 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string reportName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName} + /// + /// + /// Operation Id + /// HCRPReports_Get + /// + /// + /// + /// The report name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string reportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportName, nameof(reportName)); + + using var scope = _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsClientDiagnostics.CreateScope("AutomanageHcrpConfigurationProfileAssignmentReportCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, reportName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageHcrpConfigurationProfileAssignmentReportResource(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.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName} + /// + /// + /// Operation Id + /// HCRPReports_Get + /// + /// + /// + /// The report name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string reportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportName, nameof(reportName)); + + using var scope = _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsClientDiagnostics.CreateScope("AutomanageHcrpConfigurationProfileAssignmentReportCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, reportName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageHcrpConfigurationProfileAssignmentReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentCollection.cs index d1d906485ed8..15c62ce607a2 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string configurationProfileAssignmentName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileAssignments_Get + /// + /// + /// + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationProfileAssignmentName, nameof(configurationProfileAssignmentName)); + + using var scope = _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics.CreateScope("AutomanageVmConfigurationProfileAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationProfileAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageVmConfigurationProfileAssignmentResource(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.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileAssignments_Get + /// + /// + /// + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationProfileAssignmentName, nameof(configurationProfileAssignmentName)); + + using var scope = _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics.CreateScope("AutomanageVmConfigurationProfileAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationProfileAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageVmConfigurationProfileAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportCollection.cs index 10219dc5604a..588f1833c5e7 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string reportName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName} + /// + /// + /// Operation Id + /// reports_Get + /// + /// + /// + /// The report name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string reportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportName, nameof(reportName)); + + using var scope = _automanageVmConfigurationProfileAssignmentReportreportsClientDiagnostics.CreateScope("AutomanageVmConfigurationProfileAssignmentReportCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automanageVmConfigurationProfileAssignmentReportreportsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, reportName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageVmConfigurationProfileAssignmentReportResource(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.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName} + /// + /// + /// Operation Id + /// reports_Get + /// + /// + /// + /// The report name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string reportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportName, nameof(reportName)); + + using var scope = _automanageVmConfigurationProfileAssignmentReportreportsClientDiagnostics.CreateScope("AutomanageVmConfigurationProfileAssignmentReportCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automanageVmConfigurationProfileAssignmentReportreportsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, reportName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomanageVmConfigurationProfileAssignmentReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountCollection.cs index bc0ad40ae25f..26099bc2c0b8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountCollection.cs @@ -124,6 +124,48 @@ public async Task Exists_GetAutomationAccount() Console.WriteLine($"Succeeded: {result}"); } + // Get automation account + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAutomationAccount() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2021-06-22/examples/getAutomationAccount.json + // this example is just showing the usage of "AutomationAccount_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AutomationAccountResource + AutomationAccountCollection collection = resourceGroupResource.GetAutomationAccounts(); + + // invoke the operation + string automationAccountName = "myAutomationAccount9"; + NullableResponse response = await collection.GetIfExistsAsync(automationAccountName); + AutomationAccountResource 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 + AutomationAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List automation accounts by resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountModuleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountModuleCollection.cs index d0f0f3076a2a..d124ea81d9c7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountModuleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountModuleCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAModule() Console.WriteLine($"Succeeded: {result}"); } + // Get a module + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAModule() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getModule.json + // this example is just showing the usage of "Module_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationAccountModuleResource + AutomationAccountModuleCollection collection = automationAccount.GetAutomationAccountModules(); + + // invoke the operation + string moduleName = "OmsCompositeResources"; + NullableResponse response = await collection.GetIfExistsAsync(moduleName); + AutomationAccountModuleResource 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 + AutomationModuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a module [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountPython2PackageCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountPython2PackageCollection.cs index a90f2c149716..49260a129df8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountPython2PackageCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationAccountPython2PackageCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAPython2Package() Console.WriteLine($"Succeeded: {result}"); } + // Get a python 2 package + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPython2Package() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getPython2Package.json + // this example is just showing the usage of "Python2Package_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationAccountPython2PackageResource + AutomationAccountPython2PackageCollection collection = automationAccount.GetAutomationAccountPython2Packages(); + + // invoke the operation + string packageName = "OmsCompositeResources"; + NullableResponse response = await collection.GetIfExistsAsync(packageName); + AutomationAccountPython2PackageResource 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 + AutomationModuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a python 2 package [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationCertificateCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationCertificateCollection.cs index 3650ffc2bca4..9a05e1ed34fb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationCertificateCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationCertificateCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetACertificate() Console.WriteLine($"Succeeded: {result}"); } + // Get a certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACertificate() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getCertificate.json + // this example is just showing the usage of "Certificate_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationCertificateResource + AutomationCertificateCollection collection = automationAccount.GetAutomationCertificates(); + + // invoke the operation + string certificateName = "testCert"; + NullableResponse response = await collection.GetIfExistsAsync(certificateName); + AutomationCertificateResource 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 + AutomationCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a certificate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationConnectionCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationConnectionCollection.cs index 83e154881174..aa34ed29de84 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationConnectionCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get a connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAConnection() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getConnection.json + // this example is just showing the usage of "Connection_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount28"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationConnectionResource + AutomationConnectionCollection collection = automationAccount.GetAutomationConnections(); + + // invoke the operation + string connectionName = "myConnection"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + AutomationConnectionResource 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 + AutomationConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationConnectionTypeCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationConnectionTypeCollection.cs index a13e800f38b7..8a3e97b0e89c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationConnectionTypeCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationConnectionTypeCollection.cs @@ -85,6 +85,49 @@ public async Task Exists_GetConnectionType() Console.WriteLine($"Succeeded: {result}"); } + // Get connection type + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConnectionType() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getConnectionType.json + // this example is just showing the usage of "ConnectionType_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount22"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationConnectionTypeResource + AutomationConnectionTypeCollection collection = automationAccount.GetAutomationConnectionTypes(); + + // invoke the operation + string connectionTypeName = "myCT"; + NullableResponse response = await collection.GetIfExistsAsync(connectionTypeName); + AutomationConnectionTypeResource 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 + AutomationConnectionTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update connection type [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationCredentialCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationCredentialCollection.cs index 5fb1e754ff88..e2f3c7ce1883 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationCredentialCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationCredentialCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetACredential() Console.WriteLine($"Succeeded: {result}"); } + // Get a credential + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACredential() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getCredential.json + // this example is just showing the usage of "Credential_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount18"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationCredentialResource + AutomationCredentialCollection collection = automationAccount.GetAutomationCredentials(); + + // invoke the operation + string credentialName = "myCredential"; + NullableResponse response = await collection.GetIfExistsAsync(credentialName); + AutomationCredentialResource 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 + AutomationCredentialData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a credential [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationJobCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationJobCollection.cs index c137a62dd349..dcf2f91ef7c0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationJobCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationJobCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetJob() Console.WriteLine($"Succeeded: {result}"); } + // Get job + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetJob() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/job/getJob.json + // this example is just showing the usage of "Job_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "51766542-3ed7-4a72-a187-0c8ab644ddab"; + string resourceGroupName = "mygroup"; + string automationAccountName = "ContoseAutomationAccount"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationJobResource + AutomationJobCollection collection = automationAccount.GetAutomationJobs(); + + // invoke the operation + string jobName = "foo"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + AutomationJobResource 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 + AutomationJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create job [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationJobScheduleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationJobScheduleCollection.cs index 3dab491eb72d..72ee1681f00e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationJobScheduleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationJobScheduleCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAJobSchedule() Console.WriteLine($"Succeeded: {result}"); } + // Get a job schedule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAJobSchedule() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getJobSchedule.json + // this example is just showing the usage of "JobSchedule_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "ContoseAutomationAccount"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationJobScheduleResource + AutomationJobScheduleCollection collection = automationAccount.GetAutomationJobSchedules(); + + // invoke the operation + Guid jobScheduleId = Guid.Parse("0fa462ba-3aa2-4138-83ca-9ebc3bc55cdc"); + NullableResponse response = await collection.GetIfExistsAsync(jobScheduleId); + AutomationJobScheduleResource 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 + AutomationJobScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a job schedule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationPrivateEndpointConnectionCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationPrivateEndpointConnectionCollection.cs index 445f3420e476..129e410d5d07 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationPrivateEndpointConnectionCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string automationAccountName = "ddb1"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationPrivateEndpointConnectionResource + AutomationPrivateEndpointConnectionCollection collection = automationAccount.GetAutomationPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + AutomationPrivateEndpointConnectionResource 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 + AutomationPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a private endpoint connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationRunbookCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationRunbookCollection.cs index 2f540e9f9456..348f60e6178f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationRunbookCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationRunbookCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetRunbook() Console.WriteLine($"Succeeded: {result}"); } + // Get runbook + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRunbook() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2018-06-30/examples/getRunbook.json + // this example is just showing the usage of "Runbook_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "ContoseAutomationAccount"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationRunbookResource + AutomationRunbookCollection collection = automationAccount.GetAutomationRunbooks(); + + // invoke the operation + string runbookName = "Get-AzureVMTutorial"; + NullableResponse response = await collection.GetIfExistsAsync(runbookName); + AutomationRunbookResource 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 + AutomationRunbookData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update runbook and publish it [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationScheduleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationScheduleCollection.cs index 125856ab629b..f82ed3b9730a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationScheduleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationScheduleCollection.cs @@ -127,6 +127,49 @@ public async Task Exists_GetASchedule() Console.WriteLine($"Succeeded: {result}"); } + // Get a schedule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASchedule() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getSchedule.json + // this example is just showing the usage of "Schedule_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationScheduleResource + AutomationScheduleCollection collection = automationAccount.GetAutomationSchedules(); + + // invoke the operation + string scheduleName = "mySchedule"; + NullableResponse response = await collection.GetIfExistsAsync(scheduleName); + AutomationScheduleResource 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 + AutomationScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List schedules by automation account, first 100 [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationSourceControlCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationSourceControlCollection.cs index c29ee988be63..94445623220c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationSourceControlCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationSourceControlCollection.cs @@ -135,6 +135,49 @@ public async Task Exists_GetASourceControl() Console.WriteLine($"Succeeded: {result}"); } + // Get a source control + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASourceControl() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/sourceControl/getSourceControl.json + // this example is just showing the usage of "SourceControl_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "sampleAccount9"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationSourceControlResource + AutomationSourceControlCollection collection = automationAccount.GetAutomationSourceControls(); + + // invoke the operation + string sourceControlName = "sampleSourceControl"; + NullableResponse response = await collection.GetIfExistsAsync(sourceControlName); + AutomationSourceControlResource 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 + AutomationSourceControlData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List sourceControls [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationVariableCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationVariableCollection.cs index 7a32f89ae59e..75bbcf05ef82 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationVariableCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationVariableCollection.cs @@ -126,6 +126,49 @@ public async Task Exists_GetAVariable() Console.WriteLine($"Succeeded: {result}"); } + // Get a variable + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVariable() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getVariable.json + // this example is just showing the usage of "Variable_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "sampleAccount9"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationVariableResource + AutomationVariableCollection collection = automationAccount.GetAutomationVariables(); + + // invoke the operation + string variableName = "sampleVariable"; + NullableResponse response = await collection.GetIfExistsAsync(variableName); + AutomationVariableResource 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 + AutomationVariableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List variables, First 100 [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationWatcherCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationWatcherCollection.cs index 5c03f66920e0..2e632da1b950 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationWatcherCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationWatcherCollection.cs @@ -133,6 +133,49 @@ public async Task Exists_GetWatcher() Console.WriteLine($"Succeeded: {result}"); } + // Get watcher + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWatcher() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getWatcher.json + // this example is just showing the usage of "Watcher_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "MyTestAutomationAccount"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationWatcherResource + AutomationWatcherCollection collection = automationAccount.GetAutomationWatchers(); + + // invoke the operation + string watcherName = "MyTestWatcher"; + NullableResponse response = await collection.GetIfExistsAsync(watcherName); + AutomationWatcherResource 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 + AutomationWatcherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List watchers by Automation Account [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationWebhookCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationWebhookCollection.cs index e076fea4a707..64799500217a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationWebhookCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_AutomationWebhookCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetWebhook() Console.WriteLine($"Succeeded: {result}"); } + // Get webhook + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWebhook() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getWebhook.json + // this example is just showing the usage of "Webhook_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this AutomationWebhookResource + AutomationWebhookCollection collection = automationAccount.GetAutomationWebhooks(); + + // invoke the operation + string webhookName = "TestWebhook"; + NullableResponse response = await collection.GetIfExistsAsync(webhookName); + AutomationWebhookResource 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 + AutomationWebhookData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update webhook [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscCompilationJobCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscCompilationJobCollection.cs index 934a8498c197..957ac6cc83e2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscCompilationJobCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscCompilationJobCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_GetADSCCompilationJob() Console.WriteLine($"Succeeded: {result}"); } + // Get a DSC Compilation job + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADSCCompilationJob() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getCompilationJob.json + // this example is just showing the usage of "DscCompilationJob_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this DscCompilationJobResource + DscCompilationJobCollection collection = automationAccount.GetDscCompilationJobs(); + + // invoke the operation + string compilationJobName = "TestCompilationJob"; + NullableResponse response = await collection.GetIfExistsAsync(compilationJobName); + DscCompilationJobResource 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 + DscCompilationJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List DSC Compilation job in Automation Account [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscConfigurationCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscConfigurationCollection.cs index 6a848eed4c96..25f3677dc3e1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscConfigurationCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscConfigurationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetADSCConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get a DSC Configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADSCConfiguration() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/getDscConfiguration.json + // this example is just showing the usage of "DscConfiguration_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this DscConfigurationResource + DscConfigurationCollection collection = automationAccount.GetDscConfigurations(); + + // invoke the operation + string configurationName = "TemplateBasic"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + DscConfigurationResource 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 + DscConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscNodeCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscNodeCollection.cs index 8c9f66871235..557daca42073 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscNodeCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscNodeCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetANode() Console.WriteLine($"Succeeded: {result}"); } + // Get a node + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANode() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getDscNode.json + // this example is just showing the usage of "DscNode_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this DscNodeResource + DscNodeCollection collection = automationAccount.GetDscNodes(); + + // invoke the operation + string nodeId = "nodeId"; + NullableResponse response = await collection.GetIfExistsAsync(nodeId); + DscNodeResource 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 + DscNodeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List DSC nodes by Automation Account [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscNodeConfigurationCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscNodeConfigurationCollection.cs index 38754615d707..c06cb99c8e84 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscNodeConfigurationCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_DscNodeConfigurationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetADSCNodeConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get a DSC node configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADSCNodeConfiguration() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/getDscNodeConfiguration.json + // this example is just showing the usage of "DscNodeConfiguration_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "myAutomationAccount33"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this DscNodeConfigurationResource + DscNodeConfigurationCollection collection = automationAccount.GetDscNodeConfigurations(); + + // invoke the operation + string nodeConfigurationName = "SetupServer.localhost"; + NullableResponse response = await collection.GetIfExistsAsync(nodeConfigurationName); + DscNodeConfigurationResource 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 + DscNodeConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create node configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_HybridRunbookWorkerCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_HybridRunbookWorkerCollection.cs index 0ff98987e6f9..cd86740ee996 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_HybridRunbookWorkerCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_HybridRunbookWorkerCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetAV2HybridRunbookWorker() Console.WriteLine($"Succeeded: {result}"); } + // Get a V2 hybrid runbook worker + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAV2HybridRunbookWorker() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2021-06-22/examples/getHybridRunbookWorker.json + // this example is just showing the usage of "HybridRunbookWorkers_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 HybridRunbookWorkerGroupResource created on azure + // for more information of creating HybridRunbookWorkerGroupResource, please refer to the document of HybridRunbookWorkerGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "testaccount"; + string hybridRunbookWorkerGroupName = "TestHybridGroup"; + ResourceIdentifier hybridRunbookWorkerGroupResourceId = HybridRunbookWorkerGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName); + HybridRunbookWorkerGroupResource hybridRunbookWorkerGroup = client.GetHybridRunbookWorkerGroupResource(hybridRunbookWorkerGroupResourceId); + + // get the collection of this HybridRunbookWorkerResource + HybridRunbookWorkerCollection collection = hybridRunbookWorkerGroup.GetHybridRunbookWorkers(); + + // invoke the operation + string hybridRunbookWorkerId = "c010ad12-ef14-4a2a-aa9e-ef22c4745ddd"; + NullableResponse response = await collection.GetIfExistsAsync(hybridRunbookWorkerId); + HybridRunbookWorkerResource 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 + HybridRunbookWorkerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a V2 hybrid runbook worker [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_HybridRunbookWorkerGroupCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_HybridRunbookWorkerGroupCollection.cs index e0fd0d6892c1..06d0fd93bf9f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_HybridRunbookWorkerGroupCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_HybridRunbookWorkerGroupCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAHybridWorkerGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get a hybrid worker group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAHybridWorkerGroup() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2022-02-22/examples/getHybridRunbookWorkerGroup.json + // this example is just showing the usage of "HybridRunbookWorkerGroup_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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string automationAccountName = "testaccount"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this HybridRunbookWorkerGroupResource + HybridRunbookWorkerGroupCollection collection = automationAccount.GetHybridRunbookWorkerGroups(); + + // invoke the operation + string hybridRunbookWorkerGroupName = "TestHybridGroup"; + NullableResponse response = await collection.GetIfExistsAsync(hybridRunbookWorkerGroupName); + HybridRunbookWorkerGroupResource 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 + HybridRunbookWorkerGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a hybrid worker group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_SoftwareUpdateConfigurationCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_SoftwareUpdateConfigurationCollection.cs index 567a464ed466..9b8786915209 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_SoftwareUpdateConfigurationCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/samples/Generated/Samples/Sample_SoftwareUpdateConfigurationCollection.cs @@ -220,6 +220,49 @@ public async Task Exists_GetSoftwareUpdateConfigurationByName() Console.WriteLine($"Succeeded: {result}"); } + // Get software update configuration by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSoftwareUpdateConfigurationByName() + { + // Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/getSoftwareUpdateConfigurationByName.json + // this example is just showing the usage of "SoftwareUpdateConfigurations_GetByName" 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 AutomationAccountResource created on azure + // for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource + string subscriptionId = "51766542-3ed7-4a72-a187-0c8ab644ddab"; + string resourceGroupName = "mygroup"; + string automationAccountName = "myaccount"; + ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName); + AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId); + + // get the collection of this SoftwareUpdateConfigurationResource + SoftwareUpdateConfigurationCollection collection = automationAccount.GetSoftwareUpdateConfigurations(); + + // invoke the operation + string softwareUpdateConfigurationName = "mypatch"; + NullableResponse response = await collection.GetIfExistsAsync(softwareUpdateConfigurationName); + SoftwareUpdateConfigurationResource 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 + SoftwareUpdateConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List software update configurations [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountCollection.cs index a6e80f02ef1f..56708ca54992 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string automationAccountName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName} + /// + /// + /// Operation Id + /// AutomationAccount_Get + /// + /// + /// + /// The name of the automation 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 automationAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(automationAccountName, nameof(automationAccountName)); + + using var scope = _automationAccountClientDiagnostics.CreateScope("AutomationAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, automationAccountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationAccountResource(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.Automation/automationAccounts/{automationAccountName} + /// + /// + /// Operation Id + /// AutomationAccount_Get + /// + /// + /// + /// The name of the automation account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string automationAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(automationAccountName, nameof(automationAccountName)); + + using var scope = _automationAccountClientDiagnostics.CreateScope("AutomationAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, automationAccountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleCollection.cs index ed29fdb5b5c9..846b089acb98 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string moduleName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName} + /// + /// + /// Operation Id + /// Module_Get + /// + /// + /// + /// The module name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string moduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(moduleName, nameof(moduleName)); + + using var scope = _automationAccountModuleModuleClientDiagnostics.CreateScope("AutomationAccountModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationAccountModuleModuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, moduleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationAccountModuleResource(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.Automation/automationAccounts/{automationAccountName}/modules/{moduleName} + /// + /// + /// Operation Id + /// Module_Get + /// + /// + /// + /// The module name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string moduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(moduleName, nameof(moduleName)); + + using var scope = _automationAccountModuleModuleClientDiagnostics.CreateScope("AutomationAccountModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationAccountModuleModuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, moduleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationAccountModuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageCollection.cs index a27d66aae3f6..abf4c618907e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string packageName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName} + /// + /// + /// Operation Id + /// Python2Package_Get + /// + /// + /// + /// The python package name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string packageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packageName, nameof(packageName)); + + using var scope = _automationAccountPython2PackagePython2PackageClientDiagnostics.CreateScope("AutomationAccountPython2PackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationAccountPython2PackagePython2PackageRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, packageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationAccountPython2PackageResource(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.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName} + /// + /// + /// Operation Id + /// Python2Package_Get + /// + /// + /// + /// The python package name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string packageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packageName, nameof(packageName)); + + using var scope = _automationAccountPython2PackagePython2PackageClientDiagnostics.CreateScope("AutomationAccountPython2PackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationAccountPython2PackagePython2PackageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, packageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationAccountPython2PackageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateCollection.cs index 19c1ea318cab..80d8fb310ca9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificate_Get + /// + /// + /// + /// The name of certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _automationCertificateCertificateClientDiagnostics.CreateScope("AutomationCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationCertificateCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationCertificateResource(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.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificate_Get + /// + /// + /// + /// The name of certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _automationCertificateCertificateClientDiagnostics.CreateScope("AutomationCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationCertificateCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionCollection.cs index 8b4e84d248e5..5cff85ea81b9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName} + /// + /// + /// Operation Id + /// Connection_Get + /// + /// + /// + /// The name of connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _automationConnectionConnectionClientDiagnostics.CreateScope("AutomationConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationConnectionConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationConnectionResource(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.Automation/automationAccounts/{automationAccountName}/connections/{connectionName} + /// + /// + /// Operation Id + /// Connection_Get + /// + /// + /// + /// The name of connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _automationConnectionConnectionClientDiagnostics.CreateScope("AutomationConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationConnectionConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeCollection.cs index c1d1d4a0f946..61dd8a130d0e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string connectionTypeName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName} + /// + /// + /// Operation Id + /// ConnectionType_Get + /// + /// + /// + /// The name of connection type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionTypeName, nameof(connectionTypeName)); + + using var scope = _automationConnectionTypeConnectionTypeClientDiagnostics.CreateScope("AutomationConnectionTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationConnectionTypeConnectionTypeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationConnectionTypeResource(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.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName} + /// + /// + /// Operation Id + /// ConnectionType_Get + /// + /// + /// + /// The name of connection type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionTypeName, nameof(connectionTypeName)); + + using var scope = _automationConnectionTypeConnectionTypeClientDiagnostics.CreateScope("AutomationConnectionTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationConnectionTypeConnectionTypeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationConnectionTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialCollection.cs index 7aa18c3e0d7a..5aa82c42e179 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string credentialName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName} + /// + /// + /// Operation Id + /// Credential_Get + /// + /// + /// + /// The name of credential. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string credentialName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(credentialName, nameof(credentialName)); + + using var scope = _automationCredentialCredentialClientDiagnostics.CreateScope("AutomationCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationCredentialCredentialRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, credentialName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationCredentialResource(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.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName} + /// + /// + /// Operation Id + /// Credential_Get + /// + /// + /// + /// The name of credential. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string credentialName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(credentialName, nameof(credentialName)); + + using var scope = _automationCredentialCredentialClientDiagnostics.CreateScope("AutomationCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationCredentialCredentialRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, credentialName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationCredentialResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobCollection.cs index 7403d602a481..980d6a48e8df 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobCollection.cs @@ -334,6 +334,82 @@ public virtual Response Exists(string jobName, string clientRequestId = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Job_Get + /// + /// + /// + /// The job name. + /// Identifies this specific client request. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, string clientRequestId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _automationJobJobClientDiagnostics.CreateScope("AutomationJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationJobJobRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, clientRequestId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationJobResource(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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Job_Get + /// + /// + /// + /// The job name. + /// Identifies this specific client request. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, string clientRequestId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _automationJobJobClientDiagnostics.CreateScope("AutomationJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationJobJobRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, clientRequestId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleCollection.cs index f914219e2adb..fcd5d695c26f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleCollection.cs @@ -306,6 +306,72 @@ public virtual Response Exists(Guid jobScheduleId, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId} + /// + /// + /// Operation Id + /// JobSchedule_Get + /// + /// + /// + /// The job schedule name. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid jobScheduleId, CancellationToken cancellationToken = default) + { + using var scope = _automationJobScheduleJobScheduleClientDiagnostics.CreateScope("AutomationJobScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationJobScheduleJobScheduleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobScheduleId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationJobScheduleResource(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.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId} + /// + /// + /// Operation Id + /// JobSchedule_Get + /// + /// + /// + /// The job schedule name. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid jobScheduleId, CancellationToken cancellationToken = default) + { + using var scope = _automationJobScheduleJobScheduleClientDiagnostics.CreateScope("AutomationJobScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationJobScheduleJobScheduleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobScheduleId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationJobScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionCollection.cs index f5a1f09b6138..6afbee786af0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _automationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AutomationPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationPrivateEndpointConnectionResource(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.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _automationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AutomationPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookCollection.cs index e176603c2db2..ad7a8ae67a4f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string runbookName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName} + /// + /// + /// Operation Id + /// Runbook_Get + /// + /// + /// + /// The runbook name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string runbookName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runbookName, nameof(runbookName)); + + using var scope = _automationRunbookRunbookClientDiagnostics.CreateScope("AutomationRunbookCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationRunbookRunbookRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runbookName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationRunbookResource(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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName} + /// + /// + /// Operation Id + /// Runbook_Get + /// + /// + /// + /// The runbook name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string runbookName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runbookName, nameof(runbookName)); + + using var scope = _automationRunbookRunbookClientDiagnostics.CreateScope("AutomationRunbookCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationRunbookRunbookRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runbookName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationRunbookResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleCollection.cs index 48f9559cbb6f..501e28f623d7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string scheduleName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName} + /// + /// + /// Operation Id + /// Schedule_Get + /// + /// + /// + /// The schedule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); + + using var scope = _automationScheduleScheduleClientDiagnostics.CreateScope("AutomationScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationScheduleScheduleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scheduleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationScheduleResource(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.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName} + /// + /// + /// Operation Id + /// Schedule_Get + /// + /// + /// + /// The schedule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); + + using var scope = _automationScheduleScheduleClientDiagnostics.CreateScope("AutomationScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationScheduleScheduleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scheduleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlCollection.cs index fc2709fd4e42..c7691730be2e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string sourceControlName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName} + /// + /// + /// Operation Id + /// SourceControl_Get + /// + /// + /// + /// The name of source control. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sourceControlName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceControlName, nameof(sourceControlName)); + + using var scope = _automationSourceControlSourceControlClientDiagnostics.CreateScope("AutomationSourceControlCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationSourceControlSourceControlRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceControlName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationSourceControlResource(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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName} + /// + /// + /// Operation Id + /// SourceControl_Get + /// + /// + /// + /// The name of source control. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sourceControlName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceControlName, nameof(sourceControlName)); + + using var scope = _automationSourceControlSourceControlClientDiagnostics.CreateScope("AutomationSourceControlCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationSourceControlSourceControlRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceControlName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationSourceControlResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableCollection.cs index 584776b211a5..5a4c8d7e8625 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string variableName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName} + /// + /// + /// Operation Id + /// Variable_Get + /// + /// + /// + /// The name of variable. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string variableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(variableName, nameof(variableName)); + + using var scope = _automationVariableVariableClientDiagnostics.CreateScope("AutomationVariableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationVariableVariableRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, variableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationVariableResource(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.Automation/automationAccounts/{automationAccountName}/variables/{variableName} + /// + /// + /// Operation Id + /// Variable_Get + /// + /// + /// + /// The name of variable. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string variableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(variableName, nameof(variableName)); + + using var scope = _automationVariableVariableClientDiagnostics.CreateScope("AutomationVariableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationVariableVariableRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, variableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationVariableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherCollection.cs index c695defe3862..b8d7faf5521a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string watcherName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// + /// The watcher name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var scope = _automationWatcherWatcherClientDiagnostics.CreateScope("AutomationWatcherCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationWatcherWatcherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, watcherName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationWatcherResource(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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// + /// The watcher name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var scope = _automationWatcherWatcherClientDiagnostics.CreateScope("AutomationWatcherCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationWatcherWatcherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, watcherName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationWatcherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookCollection.cs index a2bfbf07ccdd..cd03f92c1c3b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string webhookName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName} + /// + /// + /// Operation Id + /// Webhook_Get + /// + /// + /// + /// The webhook name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string webhookName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webhookName, nameof(webhookName)); + + using var scope = _automationWebhookWebhookClientDiagnostics.CreateScope("AutomationWebhookCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _automationWebhookWebhookRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webhookName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationWebhookResource(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.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName} + /// + /// + /// Operation Id + /// Webhook_Get + /// + /// + /// + /// The webhook name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webhookName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webhookName, nameof(webhookName)); + + using var scope = _automationWebhookWebhookClientDiagnostics.CreateScope("AutomationWebhookCollection.GetIfExists"); + scope.Start(); + try + { + var response = _automationWebhookWebhookRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webhookName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutomationWebhookResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobCollection.cs index 569eddccac1f..cd1b0da6fe87 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string compilationJobName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName} + /// + /// + /// Operation Id + /// DscCompilationJob_Get + /// + /// + /// + /// The DSC configuration Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string compilationJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(compilationJobName, nameof(compilationJobName)); + + using var scope = _dscCompilationJobClientDiagnostics.CreateScope("DscCompilationJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dscCompilationJobRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, compilationJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscCompilationJobResource(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.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName} + /// + /// + /// Operation Id + /// DscCompilationJob_Get + /// + /// + /// + /// The DSC configuration Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string compilationJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(compilationJobName, nameof(compilationJobName)); + + using var scope = _dscCompilationJobClientDiagnostics.CreateScope("DscCompilationJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dscCompilationJobRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, compilationJobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscCompilationJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationCollection.cs index 43a363ec5132..f9030854bf06 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// DscConfiguration_Get + /// + /// + /// + /// The configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _dscConfigurationClientDiagnostics.CreateScope("DscConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dscConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscConfigurationResource(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.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// DscConfiguration_Get + /// + /// + /// + /// The configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _dscConfigurationClientDiagnostics.CreateScope("DscConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dscConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeCollection.cs index 682829a8f3d7..1a6efae2e40a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeCollection.cs @@ -249,6 +249,80 @@ public virtual Response Exists(string nodeId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId} + /// + /// + /// Operation Id + /// DscNode_Get + /// + /// + /// + /// The node id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string nodeId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nodeId, nameof(nodeId)); + + using var scope = _dscNodeClientDiagnostics.CreateScope("DscNodeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dscNodeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nodeId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscNodeResource(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.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId} + /// + /// + /// Operation Id + /// DscNode_Get + /// + /// + /// + /// The node id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string nodeId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nodeId, nameof(nodeId)); + + using var scope = _dscNodeClientDiagnostics.CreateScope("DscNodeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dscNodeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nodeId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscNodeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationCollection.cs index d836318973da..fe5ba853767d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationCollection.cs @@ -332,6 +332,80 @@ public virtual Response Exists(string nodeConfigurationName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName} + /// + /// + /// Operation Id + /// DscNodeConfiguration_Get + /// + /// + /// + /// The Dsc node configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string nodeConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nodeConfigurationName, nameof(nodeConfigurationName)); + + using var scope = _dscNodeConfigurationClientDiagnostics.CreateScope("DscNodeConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dscNodeConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nodeConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscNodeConfigurationResource(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.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName} + /// + /// + /// Operation Id + /// DscNodeConfiguration_Get + /// + /// + /// + /// The Dsc node configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string nodeConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nodeConfigurationName, nameof(nodeConfigurationName)); + + using var scope = _dscNodeConfigurationClientDiagnostics.CreateScope("DscNodeConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dscNodeConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nodeConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscNodeConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerCollection.cs index b2fe6b73aece..9795d7b73d03 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string hybridRunbookWorkerId, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId} + /// + /// + /// Operation Id + /// HybridRunbookWorkers_Get + /// + /// + /// + /// The hybrid runbook worker id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hybridRunbookWorkerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hybridRunbookWorkerId, nameof(hybridRunbookWorkerId)); + + using var scope = _hybridRunbookWorkerClientDiagnostics.CreateScope("HybridRunbookWorkerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridRunbookWorkerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hybridRunbookWorkerId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridRunbookWorkerResource(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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId} + /// + /// + /// Operation Id + /// HybridRunbookWorkers_Get + /// + /// + /// + /// The hybrid runbook worker id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hybridRunbookWorkerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hybridRunbookWorkerId, nameof(hybridRunbookWorkerId)); + + using var scope = _hybridRunbookWorkerClientDiagnostics.CreateScope("HybridRunbookWorkerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridRunbookWorkerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hybridRunbookWorkerId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridRunbookWorkerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupCollection.cs index bdff0cb317e8..687df14a3424 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string hybridRunbookWorkerGroupName, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName} + /// + /// + /// Operation Id + /// HybridRunbookWorkerGroup_Get + /// + /// + /// + /// The hybrid runbook worker group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hybridRunbookWorkerGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hybridRunbookWorkerGroupName, nameof(hybridRunbookWorkerGroupName)); + + using var scope = _hybridRunbookWorkerGroupClientDiagnostics.CreateScope("HybridRunbookWorkerGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridRunbookWorkerGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hybridRunbookWorkerGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridRunbookWorkerGroupResource(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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName} + /// + /// + /// Operation Id + /// HybridRunbookWorkerGroup_Get + /// + /// + /// + /// The hybrid runbook worker group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hybridRunbookWorkerGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hybridRunbookWorkerGroupName, nameof(hybridRunbookWorkerGroupName)); + + using var scope = _hybridRunbookWorkerGroupClientDiagnostics.CreateScope("HybridRunbookWorkerGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridRunbookWorkerGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hybridRunbookWorkerGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridRunbookWorkerGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationCollection.cs index dcbf21c56aac..d023fac9edbd 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationCollection.cs @@ -332,6 +332,82 @@ public virtual Response Exists(string softwareUpdateConfigurationName, str } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName} + /// + /// + /// Operation Id + /// SoftwareUpdateConfigurations_GetByName + /// + /// + /// + /// The name of the software update configuration to be created. + /// Identifies this specific client request. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string softwareUpdateConfigurationName, string clientRequestId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(softwareUpdateConfigurationName, nameof(softwareUpdateConfigurationName)); + + using var scope = _softwareUpdateConfigurationClientDiagnostics.CreateScope("SoftwareUpdateConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _softwareUpdateConfigurationRestClient.GetByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, softwareUpdateConfigurationName, clientRequestId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SoftwareUpdateConfigurationResource(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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName} + /// + /// + /// Operation Id + /// SoftwareUpdateConfigurations_GetByName + /// + /// + /// + /// The name of the software update configuration to be created. + /// Identifies this specific client request. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string softwareUpdateConfigurationName, string clientRequestId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(softwareUpdateConfigurationName, nameof(softwareUpdateConfigurationName)); + + using var scope = _softwareUpdateConfigurationClientDiagnostics.CreateScope("SoftwareUpdateConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _softwareUpdateConfigurationRestClient.GetByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, softwareUpdateConfigurationName, clientRequestId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SoftwareUpdateConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsCloudLinkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsCloudLinkCollection.cs index b3c36bf62e24..f1f56258c06f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsCloudLinkCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsCloudLinkCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_CloudLinksGet() Console.WriteLine($"Succeeded: {result}"); } + // CloudLinks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CloudLinksGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/CloudLinks_Get.json + // this example is just showing the usage of "CloudLinks_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this AvsCloudLinkResource + AvsCloudLinkCollection collection = avsPrivateCloud.GetAvsCloudLinks(); + + // invoke the operation + string cloudLinkName = "cloudLink1"; + NullableResponse response = await collection.GetIfExistsAsync(cloudLinkName); + AvsCloudLinkResource 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 + AvsCloudLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CloudLinks_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudAddonCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudAddonCollection.cs index f18271bb65b8..e1f8d15ea0ca 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudAddonCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudAddonCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_AddonsGetArcReg() Console.WriteLine($"Succeeded: {result}"); } + // Addons_Get_ArcReg + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AddonsGetArcReg() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Get_ArcReg.json + // this example is just showing the usage of "Addons_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this AvsPrivateCloudAddonResource + AvsPrivateCloudAddonCollection collection = avsPrivateCloud.GetAvsPrivateCloudAddons(); + + // invoke the operation + string addonName = "arc"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AvsPrivateCloudAddonResource 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 + AvsPrivateCloudAddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Addons_Get_HCX [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_AddonsGetHCX() Console.WriteLine($"Succeeded: {result}"); } + // Addons_Get_HCX + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AddonsGetHCX() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Get_HCX.json + // this example is just showing the usage of "Addons_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this AvsPrivateCloudAddonResource + AvsPrivateCloudAddonCollection collection = avsPrivateCloud.GetAvsPrivateCloudAddons(); + + // invoke the operation + string addonName = "hcx"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AvsPrivateCloudAddonResource 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 + AvsPrivateCloudAddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Addons_Get_SRM [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -253,6 +339,49 @@ public async Task Exists_AddonsGetSRM() Console.WriteLine($"Succeeded: {result}"); } + // Addons_Get_SRM + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AddonsGetSRM() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Get_SRM.json + // this example is just showing the usage of "Addons_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this AvsPrivateCloudAddonResource + AvsPrivateCloudAddonCollection collection = avsPrivateCloud.GetAvsPrivateCloudAddons(); + + // invoke the operation + string addonName = "srm"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AvsPrivateCloudAddonResource 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 + AvsPrivateCloudAddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Addons_Get_VR [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -319,6 +448,49 @@ public async Task Exists_AddonsGetVR() Console.WriteLine($"Succeeded: {result}"); } + // Addons_Get_VR + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AddonsGetVR() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Addons_Get_VR.json + // this example is just showing the usage of "Addons_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this AvsPrivateCloudAddonResource + AvsPrivateCloudAddonCollection collection = avsPrivateCloud.GetAvsPrivateCloudAddons(); + + // invoke the operation + string addonName = "vr"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AvsPrivateCloudAddonResource 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 + AvsPrivateCloudAddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Addons_CreateOrUpdate_Arc [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudClusterCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudClusterCollection.cs index efb77acc3058..a65306cf0af6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudClusterCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudClusterCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ClustersGet() Console.WriteLine($"Succeeded: {result}"); } + // Clusters_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ClustersGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Clusters_Get.json + // this example is just showing the usage of "Clusters_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this AvsPrivateCloudClusterResource + AvsPrivateCloudClusterCollection collection = avsPrivateCloud.GetAvsPrivateCloudClusters(); + + // invoke the operation + string clusterName = "cluster1"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + AvsPrivateCloudClusterResource 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 + AvsPrivateCloudClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Clusters_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudClusterVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudClusterVirtualMachineCollection.cs index 03e0a3ad7a63..338def19ac6b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudClusterVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudClusterVirtualMachineCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + + // GetVirtualMachine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachine() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/VirtualMachines_Get.json + // this example is just showing the usage of "VirtualMachines_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 AvsPrivateCloudClusterResource created on azure + // for more information of creating AvsPrivateCloudClusterResource, please refer to the document of AvsPrivateCloudClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier avsPrivateCloudClusterResourceId = AvsPrivateCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + AvsPrivateCloudClusterResource avsPrivateCloudCluster = client.GetAvsPrivateCloudClusterResource(avsPrivateCloudClusterResourceId); + + // get the collection of this AvsPrivateCloudClusterVirtualMachineResource + AvsPrivateCloudClusterVirtualMachineCollection collection = avsPrivateCloudCluster.GetAvsPrivateCloudClusterVirtualMachines(); + + // invoke the operation + string virtualMachineId = "vm-209"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineId); + AvsPrivateCloudClusterVirtualMachineResource 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 + AvsPrivateCloudClusterVirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudCollection.cs index e2995923ee0d..2028f5fbc975 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudCollection.cs @@ -156,6 +156,48 @@ public async Task Exists_PrivateCloudsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateClouds_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateCloudsGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_Get.json + // this example is just showing the usage of "PrivateClouds_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 = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AvsPrivateCloudResource + AvsPrivateCloudCollection collection = resourceGroupResource.GetAvsPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + NullableResponse response = await collection.GetIfExistsAsync(privateCloudName); + AvsPrivateCloudResource 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 + AvsPrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateClouds_Get_Stretched [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -220,6 +262,48 @@ public async Task Exists_PrivateCloudsGetStretched() Console.WriteLine($"Succeeded: {result}"); } + // PrivateClouds_Get_Stretched + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateCloudsGetStretched() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PrivateClouds_Get_Stretched.json + // this example is just showing the usage of "PrivateClouds_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 = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AvsPrivateCloudResource + AvsPrivateCloudCollection collection = resourceGroupResource.GetAvsPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + NullableResponse response = await collection.GetIfExistsAsync(privateCloudName); + AvsPrivateCloudResource 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 + AvsPrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateClouds_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudDatastoreCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudDatastoreCollection.cs index 4b56f68da389..38ffb594eb23 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudDatastoreCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AvsPrivateCloudDatastoreCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_DatastoresGet() Console.WriteLine($"Succeeded: {result}"); } + // Datastores_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DatastoresGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Datastores_Get.json + // this example is just showing the usage of "Datastores_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 AvsPrivateCloudClusterResource created on azure + // for more information of creating AvsPrivateCloudClusterResource, please refer to the document of AvsPrivateCloudClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier avsPrivateCloudClusterResourceId = AvsPrivateCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + AvsPrivateCloudClusterResource avsPrivateCloudCluster = client.GetAvsPrivateCloudClusterResource(avsPrivateCloudClusterResourceId); + + // get the collection of this AvsPrivateCloudDatastoreResource + AvsPrivateCloudDatastoreCollection collection = avsPrivateCloudCluster.GetAvsPrivateCloudDatastores(); + + // invoke the operation + string datastoreName = "datastore1"; + NullableResponse response = await collection.GetIfExistsAsync(datastoreName); + AvsPrivateCloudDatastoreResource 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 + AvsPrivateCloudDatastoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Datastores_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationCollection.cs index 8fc2f46e9201..a072dbaa93cd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_AuthorizationsGet() Console.WriteLine($"Succeeded: {result}"); } + // Authorizations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AuthorizationsGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/Authorizations_Get.json + // this example is just showing the usage of "Authorizations_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this ExpressRouteAuthorizationResource + ExpressRouteAuthorizationCollection collection = avsPrivateCloud.GetExpressRouteAuthorizations(); + + // invoke the operation + string authorizationName = "authorization1"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationName); + ExpressRouteAuthorizationResource 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 + ExpressRouteAuthorizationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Authorizations_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionCollection.cs index 338161e042d2..d802cfcd3410 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GlobalReachConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // GlobalReachConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GlobalReachConnectionsGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/GlobalReachConnections_Get.json + // this example is just showing the usage of "GlobalReachConnections_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this GlobalReachConnectionResource + GlobalReachConnectionCollection collection = avsPrivateCloud.GetGlobalReachConnections(); + + // invoke the operation + string globalReachConnectionName = "connection1"; + NullableResponse response = await collection.GetIfExistsAsync(globalReachConnectionName); + GlobalReachConnectionResource 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 + GlobalReachConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GlobalReachConnections_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteCollection.cs index c0bc1eea8c16..410b86e2949c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_HcxEnterpriseSitesGet() Console.WriteLine($"Succeeded: {result}"); } + // HcxEnterpriseSites_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HcxEnterpriseSitesGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/HcxEnterpriseSites_Get.json + // this example is just showing the usage of "HcxEnterpriseSites_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this HcxEnterpriseSiteResource + HcxEnterpriseSiteCollection collection = avsPrivateCloud.GetHcxEnterpriseSites(); + + // invoke the operation + string hcxEnterpriseSiteName = "site1"; + NullableResponse response = await collection.GetIfExistsAsync(hcxEnterpriseSiteName); + HcxEnterpriseSiteResource 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 + HcxEnterpriseSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HcxEnterpriseSites_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyCollection.cs index 8a28022b8565..189abb45eb4e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_PlacementPoliciesGet() Console.WriteLine($"Succeeded: {result}"); } + // PlacementPolicies_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PlacementPoliciesGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/PlacementPolicies_Get.json + // this example is just showing the usage of "PlacementPolicies_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 AvsPrivateCloudClusterResource created on azure + // for more information of creating AvsPrivateCloudClusterResource, please refer to the document of AvsPrivateCloudClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier avsPrivateCloudClusterResourceId = AvsPrivateCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + AvsPrivateCloudClusterResource avsPrivateCloudCluster = client.GetAvsPrivateCloudClusterResource(avsPrivateCloudClusterResourceId); + + // get the collection of this PlacementPolicyResource + PlacementPolicyCollection collection = avsPrivateCloudCluster.GetPlacementPolicies(); + + // invoke the operation + string placementPolicyName = "policy1"; + NullableResponse response = await collection.GetIfExistsAsync(placementPolicyName); + PlacementPolicyResource 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 + PlacementPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PlacementPolicies_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletCollection.cs index b01376c91e63..9ef8915b5812 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_ScriptCmdletsGet() Console.WriteLine($"Succeeded: {result}"); } + + // ScriptCmdlets_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ScriptCmdletsGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptCmdlets_Get.json + // this example is just showing the usage of "ScriptCmdlets_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 ScriptPackageResource created on azure + // for more information of creating ScriptPackageResource, please refer to the document of ScriptPackageResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "{privateCloudName}"; + string scriptPackageName = "{scriptPackageName}"; + ResourceIdentifier scriptPackageResourceId = ScriptPackageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, scriptPackageName); + ScriptPackageResource scriptPackage = client.GetScriptPackageResource(scriptPackageResourceId); + + // get the collection of this ScriptCmdletResource + ScriptCmdletCollection collection = scriptPackage.GetScriptCmdlets(); + + // invoke the operation + string scriptCmdletName = "New-ExternalSsoDomain"; + NullableResponse response = await collection.GetIfExistsAsync(scriptCmdletName); + ScriptCmdletResource 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 + ScriptCmdletData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionCollection.cs index a7ba2262f642..c7e02bee30a9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ScriptExecutionsGet() Console.WriteLine($"Succeeded: {result}"); } + // ScriptExecutions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ScriptExecutionsGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptExecutions_Get.json + // this example is just showing the usage of "ScriptExecutions_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this ScriptExecutionResource + ScriptExecutionCollection collection = avsPrivateCloud.GetScriptExecutions(); + + // invoke the operation + string scriptExecutionName = "addSsoServer"; + NullableResponse response = await collection.GetIfExistsAsync(scriptExecutionName); + ScriptExecutionResource 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 + ScriptExecutionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ScriptExecutions_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageCollection.cs index 847bea97bb95..49a221f38eb3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_ScriptPackagesGet() Console.WriteLine($"Succeeded: {result}"); } + + // ScriptPackages_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ScriptPackagesGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/ScriptPackages_Get.json + // this example is just showing the usage of "ScriptPackages_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "{privateCloudName}"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this ScriptPackageResource + ScriptPackageCollection collection = avsPrivateCloud.GetScriptPackages(); + + // invoke the operation + string scriptPackageName = "{scriptPackageName}"; + NullableResponse response = await collection.GetIfExistsAsync(scriptPackageName); + ScriptPackageResource 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 + ScriptPackageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkCollection.cs index b4b0973af090..7fcfc20b2419 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -83,6 +84,49 @@ public async Task Exists_WorkloadNetworksGet() Console.WriteLine($"Succeeded: {result}"); } + // WorkloadNetworks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGet() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_Get.json + // this example is just showing the usage of "WorkloadNetworks_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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkResource + WorkloadNetworkCollection collection = avsPrivateCloud.GetWorkloadNetworks(); + + // invoke the operation + WorkloadNetworkName workloadNetworkName = WorkloadNetworkName.Default; + NullableResponse response = await collection.GetIfExistsAsync(workloadNetworkName); + WorkloadNetworkResource 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 + WorkloadNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkloadNetworks_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDhcpCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDhcpCollection.cs index e851b2a5431d..62cd2f0dd2be 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDhcpCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDhcpCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WorkloadNetworksGetDhcp() Console.WriteLine($"Succeeded: {result}"); } + // WorkloadNetworks_GetDhcp + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetDhcp() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetDhcpConfigurations.json + // this example is just showing the usage of "WorkloadNetworks_GetDhcp" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkDhcpResource + WorkloadNetworkDhcpCollection collection = avsPrivateCloud.GetWorkloadNetworkDhcps(); + + // invoke the operation + string dhcpId = "dhcp1"; + NullableResponse response = await collection.GetIfExistsAsync(dhcpId); + WorkloadNetworkDhcpResource 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 + WorkloadNetworkDhcpData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkloadNetworks_CreateDhcp [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDnsServiceCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDnsServiceCollection.cs index d8124aee2e60..7685dcb4666b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDnsServiceCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDnsServiceCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_WorkloadNetworksGetDnsService() Console.WriteLine($"Succeeded: {result}"); } + // WorkloadNetworks_GetDnsService + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetDnsService() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetDnsServices.json + // this example is just showing the usage of "WorkloadNetworks_GetDnsService" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkDnsServiceResource + WorkloadNetworkDnsServiceCollection collection = avsPrivateCloud.GetWorkloadNetworkDnsServices(); + + // invoke the operation + string dnsServiceId = "dnsService1"; + NullableResponse response = await collection.GetIfExistsAsync(dnsServiceId); + WorkloadNetworkDnsServiceResource 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 + WorkloadNetworkDnsServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkloadNetworks_CreateDnsService [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDnsZoneCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDnsZoneCollection.cs index 88611a3b4522..c61fbe839b0d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDnsZoneCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkDnsZoneCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WorkloadNetworksGetDnsZone() Console.WriteLine($"Succeeded: {result}"); } + // WorkloadNetworks_GetDnsZone + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetDnsZone() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetDnsZones.json + // this example is just showing the usage of "WorkloadNetworks_GetDnsZone" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkDnsZoneResource + WorkloadNetworkDnsZoneCollection collection = avsPrivateCloud.GetWorkloadNetworkDnsZones(); + + // invoke the operation + string dnsZoneId = "dnsZone1"; + NullableResponse response = await collection.GetIfExistsAsync(dnsZoneId); + WorkloadNetworkDnsZoneResource 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 + WorkloadNetworkDnsZoneData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkloadNetworks_CreateDnsZone [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayCollection.cs index afd5975bf27d..0a3a8ff71b5c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_WorkloadNetworksGetGateway() Console.WriteLine($"Succeeded: {result}"); } + + // WorkloadNetworks_GetGateway + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetGateway() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetGateway.json + // this example is just showing the usage of "WorkloadNetworks_GetGateway" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkGatewayResource + WorkloadNetworkGatewayCollection collection = avsPrivateCloud.GetWorkloadNetworkGateways(); + + // invoke the operation + string gatewayId = "gateway1"; + NullableResponse response = await collection.GetIfExistsAsync(gatewayId); + WorkloadNetworkGatewayResource 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 + WorkloadNetworkGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkPortMirroringProfileCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkPortMirroringProfileCollection.cs index 4c9d5ca536b6..46f54f43bafd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkPortMirroringProfileCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkPortMirroringProfileCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WorkloadNetworksGetPortMirroring() Console.WriteLine($"Succeeded: {result}"); } + // WorkloadNetworks_GetPortMirroring + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetPortMirroring() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetPortMirroringProfiles.json + // this example is just showing the usage of "WorkloadNetworks_GetPortMirroring" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkPortMirroringProfileResource + WorkloadNetworkPortMirroringProfileCollection collection = avsPrivateCloud.GetWorkloadNetworkPortMirroringProfiles(); + + // invoke the operation + string portMirroringId = "portMirroring1"; + NullableResponse response = await collection.GetIfExistsAsync(portMirroringId); + WorkloadNetworkPortMirroringProfileResource 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 + WorkloadNetworkPortMirroringProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkloadNetworks_CreatePortMirroring [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkPublicIPCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkPublicIPCollection.cs index 674b06724a88..51af69350578 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkPublicIPCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkPublicIPCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_WorkloadNetworksGetPublicIP() Console.WriteLine($"Succeeded: {result}"); } + // WorkloadNetworks_GetPublicIP + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetPublicIP() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetPublicIPs.json + // this example is just showing the usage of "WorkloadNetworks_GetPublicIP" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkPublicIPResource + WorkloadNetworkPublicIPCollection collection = avsPrivateCloud.GetWorkloadNetworkPublicIPs(); + + // invoke the operation + string publicIPId = "publicIP1"; + NullableResponse response = await collection.GetIfExistsAsync(publicIPId); + WorkloadNetworkPublicIPResource 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 + WorkloadNetworkPublicIPData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkloadNetworks_CreatePublicIP [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentCollection.cs index af7f2b615710..d7ee65a45a31 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WorkloadNetworksGetSegment() Console.WriteLine($"Succeeded: {result}"); } + // WorkloadNetworks_GetSegment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetSegment() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetSegments.json + // this example is just showing the usage of "WorkloadNetworks_GetSegment" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkSegmentResource + WorkloadNetworkSegmentCollection collection = avsPrivateCloud.GetWorkloadNetworkSegments(); + + // invoke the operation + string segmentId = "segment1"; + NullableResponse response = await collection.GetIfExistsAsync(segmentId); + WorkloadNetworkSegmentResource 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 + WorkloadNetworkSegmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkloadNetworks_CreateSegments [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineCollection.cs index 59ef16bfb335..81913f023673 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_WorkloadNetworksGetVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + + // WorkloadNetworks_GetVirtualMachine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetVirtualMachine() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetVirtualMachine.json + // this example is just showing the usage of "WorkloadNetworks_GetVirtualMachine" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkVirtualMachineResource + WorkloadNetworkVirtualMachineCollection collection = avsPrivateCloud.GetWorkloadNetworkVirtualMachines(); + + // invoke the operation + string virtualMachineId = "vm1"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineId); + WorkloadNetworkVirtualMachineResource 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 + WorkloadNetworkVirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVmGroupCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVmGroupCollection.cs index c1c16f138a37..e281880e095f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVmGroupCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVmGroupCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_WorkloadNetworksGetVMGroup() Console.WriteLine($"Succeeded: {result}"); } + // WorkloadNetworks_GetVMGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkloadNetworksGetVMGroup() + { + // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2022-05-01/examples/WorkloadNetworks_GetVMGroups.json + // this example is just showing the usage of "WorkloadNetworks_GetVMGroup" 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 AvsPrivateCloudResource created on azure + // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + + // get the collection of this WorkloadNetworkVmGroupResource + WorkloadNetworkVmGroupCollection collection = avsPrivateCloud.GetWorkloadNetworkVmGroups(); + + // invoke the operation + string vmGroupId = "vmGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(vmGroupId); + WorkloadNetworkVmGroupResource 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 + WorkloadNetworkVmGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WorkloadNetworks_CreateVMGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs index 3961e221a7ae..e4919ca2dd2f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string cloudLinkName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName} + /// + /// + /// Operation Id + /// CloudLinks_Get + /// + /// + /// + /// Name of the cloud link 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 cloudLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); + + using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _avsCloudLinkCloudLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsCloudLinkResource(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.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName} + /// + /// + /// Operation Id + /// CloudLinks_Get + /// + /// + /// + /// Name of the cloud link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string cloudLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); + + using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _avsCloudLinkCloudLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsCloudLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs index 931d793d79d9..df8b2fc3e7b6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string addonName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName} + /// + /// + /// Operation Id + /// Addons_Get + /// + /// + /// + /// Name of the addon for the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string addonName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); + + using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _avsPrivateCloudAddonAddonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudAddonResource(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.AVS/privateClouds/{privateCloudName}/addons/{addonName} + /// + /// + /// Operation Id + /// Addons_Get + /// + /// + /// + /// Name of the addon for the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string addonName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); + + using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.GetIfExists"); + scope.Start(); + try + { + var response = _avsPrivateCloudAddonAddonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudAddonResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs index a8ef397496ed..afa3ea004c5d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _avsPrivateCloudClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudClusterResource(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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _avsPrivateCloudClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs index 72958c868e88..c21db3ebd4cb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string virtualMachineId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualMachineId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); + + using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudClusterVirtualMachineResource(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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); + + using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudClusterVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs index 6861e3ee38e1..722ca64cfa52 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string privateCloudName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName} + /// + /// + /// Operation Id + /// PrivateClouds_Get + /// + /// + /// + /// Name of the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _avsPrivateCloudPrivateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudResource(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.AVS/privateClouds/{privateCloudName} + /// + /// + /// Operation Id + /// PrivateClouds_Get + /// + /// + /// + /// Name of the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.GetIfExists"); + scope.Start(); + try + { + var response = _avsPrivateCloudPrivateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs index 6f1d6d25fefb..ce627a183701 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string datastoreName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName} + /// + /// + /// Operation Id + /// Datastores_Get + /// + /// + /// + /// Name of the datastore in the private cloud cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string datastoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); + + using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _avsPrivateCloudDatastoreDatastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudDatastoreResource(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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName} + /// + /// + /// Operation Id + /// Datastores_Get + /// + /// + /// + /// Name of the datastore in the private cloud cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string datastoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); + + using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _avsPrivateCloudDatastoreDatastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvsPrivateCloudDatastoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs index d8e339e6f9bf..06a125b66684 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// Authorizations_Get + /// + /// + /// + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// 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 = _expressRouteAuthorizationAuthorizationsClientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteAuthorizationAuthorizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteAuthorizationResource(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.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// Authorizations_Get + /// + /// + /// + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// 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 = _expressRouteAuthorizationAuthorizationsClientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteAuthorizationAuthorizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs index 0b6993821650..803b822e9727 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string globalReachConnectionName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName} + /// + /// + /// Operation Id + /// GlobalReachConnections_Get + /// + /// + /// + /// Name of the global reach connection in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(globalReachConnectionName, nameof(globalReachConnectionName)); + + using var scope = _globalReachConnectionClientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _globalReachConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalReachConnectionResource(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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName} + /// + /// + /// Operation Id + /// GlobalReachConnections_Get + /// + /// + /// + /// Name of the global reach connection in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string globalReachConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(globalReachConnectionName, nameof(globalReachConnectionName)); + + using var scope = _globalReachConnectionClientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _globalReachConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalReachConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs index 94f174f1c885..c0bfe90fa1ce 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string hcxEnterpriseSiteName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName} + /// + /// + /// Operation Id + /// HcxEnterpriseSites_Get + /// + /// + /// + /// Name of the HCX Enterprise Site in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hcxEnterpriseSiteName, nameof(hcxEnterpriseSiteName)); + + using var scope = _hcxEnterpriseSiteClientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hcxEnterpriseSiteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HcxEnterpriseSiteResource(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.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName} + /// + /// + /// Operation Id + /// HcxEnterpriseSites_Get + /// + /// + /// + /// Name of the HCX Enterprise Site in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hcxEnterpriseSiteName, nameof(hcxEnterpriseSiteName)); + + using var scope = _hcxEnterpriseSiteClientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hcxEnterpriseSiteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HcxEnterpriseSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs index 17a3126d3b23..606738bda5f7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string placementPolicyName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName} + /// + /// + /// Operation Id + /// PlacementPolicies_Get + /// + /// + /// + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string placementPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(placementPolicyName, nameof(placementPolicyName)); + + using var scope = _placementPolicyClientDiagnostics.CreateScope("PlacementPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _placementPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PlacementPolicyResource(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.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName} + /// + /// + /// Operation Id + /// PlacementPolicies_Get + /// + /// + /// + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string placementPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(placementPolicyName, nameof(placementPolicyName)); + + using var scope = _placementPolicyClientDiagnostics.CreateScope("PlacementPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _placementPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PlacementPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs index 14369b38cb0b..b4491f3a4fea 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string scriptCmdletName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName} + /// + /// + /// Operation Id + /// ScriptCmdlets_Get + /// + /// + /// + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scriptCmdletName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptCmdletName, nameof(scriptCmdletName)); + + using var scope = _scriptCmdletClientDiagnostics.CreateScope("ScriptCmdletCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scriptCmdletRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptCmdletName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScriptCmdletResource(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.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName} + /// + /// + /// Operation Id + /// ScriptCmdlets_Get + /// + /// + /// + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scriptCmdletName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptCmdletName, nameof(scriptCmdletName)); + + using var scope = _scriptCmdletClientDiagnostics.CreateScope("ScriptCmdletCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scriptCmdletRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptCmdletName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScriptCmdletResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs index 641319956764..35a3783028d3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string scriptExecutionName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName} + /// + /// + /// Operation Id + /// ScriptExecutions_Get + /// + /// + /// + /// Name of the user-invoked script execution 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 scriptExecutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptExecutionName, nameof(scriptExecutionName)); + + using var scope = _scriptExecutionClientDiagnostics.CreateScope("ScriptExecutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scriptExecutionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScriptExecutionResource(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.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName} + /// + /// + /// Operation Id + /// ScriptExecutions_Get + /// + /// + /// + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scriptExecutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptExecutionName, nameof(scriptExecutionName)); + + using var scope = _scriptExecutionClientDiagnostics.CreateScope("ScriptExecutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scriptExecutionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScriptExecutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs index 3cb97ab24edc..c92974bfb35c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string scriptPackageName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName} + /// + /// + /// Operation Id + /// ScriptPackages_Get + /// + /// + /// + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scriptPackageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptPackageName, nameof(scriptPackageName)); + + using var scope = _scriptPackageClientDiagnostics.CreateScope("ScriptPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scriptPackageRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptPackageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScriptPackageResource(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.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName} + /// + /// + /// Operation Id + /// ScriptPackages_Get + /// + /// + /// + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scriptPackageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptPackageName, nameof(scriptPackageName)); + + using var scope = _scriptPackageClientDiagnostics.CreateScope("ScriptPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scriptPackageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptPackageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScriptPackageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkCollection.cs index 269028045dde..7bd15addf24b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkCollection.cs @@ -226,6 +226,72 @@ public virtual Response Exists(WorkloadNetworkName workloadNetworkName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName} + /// + /// + /// Operation Id + /// WorkloadNetworks_Get + /// + /// + /// + /// Name for the workload network in the private cloud. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(WorkloadNetworkName workloadNetworkName, CancellationToken cancellationToken = default) + { + using var scope = _workloadNetworkClientDiagnostics.CreateScope("WorkloadNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workloadNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName} + /// + /// + /// Operation Id + /// WorkloadNetworks_Get + /// + /// + /// + /// Name for the workload network in the private cloud. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(WorkloadNetworkName workloadNetworkName, CancellationToken cancellationToken = default) + { + using var scope = _workloadNetworkClientDiagnostics.CreateScope("WorkloadNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workloadNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs index 81d8495d66a1..8abf2c28e0f4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string dhcpId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetDhcp + /// + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dhcpId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + + using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDhcpResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetDhcp + /// + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dhcpId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + + using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDhcpResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs index fcd3dfd4676b..b945f8e4938e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string dnsServiceId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetDnsService + /// + /// + /// + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsServiceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + + using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsServiceResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetDnsService + /// + /// + /// + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsServiceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + + using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs index 804b377a8e9f..ff39fe225679 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string dnsZoneId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetDnsZone + /// + /// + /// + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + + using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsZoneResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetDnsZone + /// + /// + /// + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + + using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsZoneResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs index 8c608043db83..02800994da9f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string gatewayId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetGateway + /// + /// + /// + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gatewayId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + + using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkGatewayWorkloadNetworksRestClient.GetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkGatewayResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetGateway + /// + /// + /// + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gatewayId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + + using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkGatewayWorkloadNetworksRestClient.GetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs index 6cb027f73c6c..f814c93bc5db 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string portMirroringId, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetPortMirroring + /// + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string portMirroringId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + + using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPortMirroringProfileResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetPortMirroring + /// + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string portMirroringId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + + using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPortMirroringProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs index 57f41f9a5119..5681525a435e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string publicIPId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetPublicIP + /// + /// + /// + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publicIPId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + + using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPublicIPResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetPublicIP + /// + /// + /// + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publicIPId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + + using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPublicIPResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs index deb613f81a1c..eafdbcf8f092 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string segmentId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetSegment + /// + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string segmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + + using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkSegmentResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetSegment + /// + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string segmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + + using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkSegmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs index f618f1bac111..b3bd13fe8ec0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string virtualMachineId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetVirtualMachine + /// + /// + /// + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualMachineId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); + + using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVirtualMachineResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetVirtualMachine + /// + /// + /// + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); + + using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualMachineId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs index 3efc206442c4..14f972a880fa 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string vmGroupId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetVMGroup + /// + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vmGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + + using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVmGroupResource(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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} + /// + /// + /// Operation Id + /// WorkloadNetworks_GetVMGroup + /// + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vmGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + + using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVmGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_ArcExtensionCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_ArcExtensionCollection.cs index 7b15145e0421..95d2806c8958 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_ArcExtensionCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_ArcExtensionCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetArcSettingsExtension() Console.WriteLine($"Succeeded: {result}"); } + // Get ArcSettings Extension + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetArcSettingsExtension() + { + // Generated from example definition: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-02-01/examples/GetExtension.json + // this example is just showing the usage of "Extensions_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 ArcSettingResource created on azure + // for more information of creating ArcSettingResource, please refer to the document of ArcSettingResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "test-rg"; + string clusterName = "myCluster"; + string arcSettingName = "default"; + ResourceIdentifier arcSettingResourceId = ArcSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, arcSettingName); + ArcSettingResource arcSetting = client.GetArcSettingResource(arcSettingResourceId); + + // get the collection of this ArcExtensionResource + ArcExtensionCollection collection = arcSetting.GetArcExtensions(); + + // invoke the operation + string extensionName = "MicrosoftMonitoringAgent"; + NullableResponse response = await collection.GetIfExistsAsync(extensionName); + ArcExtensionResource 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 + ArcExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Arc Extension [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_ArcSettingCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_ArcSettingCollection.cs index f86c1b2102b6..1c90202ea66f 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_ArcSettingCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_ArcSettingCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetArcSetting() Console.WriteLine($"Succeeded: {result}"); } + // Get ArcSetting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetArcSetting() + { + // Generated from example definition: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-02-01/examples/GetArcSetting.json + // this example is just showing the usage of "ArcSettings_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 HciClusterResource created on azure + // for more information of creating HciClusterResource, please refer to the document of HciClusterResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "test-rg"; + string clusterName = "myCluster"; + ResourceIdentifier hciClusterResourceId = HciClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + HciClusterResource hciCluster = client.GetHciClusterResource(hciClusterResourceId); + + // get the collection of this ArcSettingResource + ArcSettingCollection collection = hciCluster.GetArcSettings(); + + // invoke the operation + string arcSettingName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(arcSettingName); + ArcSettingResource 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 + ArcSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create ArcSetting [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_HciClusterCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_HciClusterCollection.cs index 477b38932ff1..f12f447b1678 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_HciClusterCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_HciClusterCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCluster() + { + // Generated from example definition: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-02-01/examples/GetCluster.json + // this example is just showing the usage of "Clusters_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HciClusterResource + HciClusterCollection collection = resourceGroupResource.GetHciClusters(); + + // invoke the operation + string clusterName = "myCluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + HciClusterResource 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 + HciClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_HciSkuCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_HciSkuCollection.cs index d82794112ca1..0a3a1d4919b4 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_HciSkuCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_HciSkuCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetSku() Console.WriteLine($"Succeeded: {result}"); } + + // Get Sku + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSku() + { + // Generated from example definition: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-02-01/examples/GetSku.json + // this example is just showing the usage of "Skus_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 OfferResource created on azure + // for more information of creating OfferResource, please refer to the document of OfferResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "test-rg"; + string clusterName = "myCluster"; + string publisherName = "publisher1"; + string offerName = "offer1"; + ResourceIdentifier offerResourceId = OfferResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, publisherName, offerName); + OfferResource offer = client.GetOfferResource(offerResourceId); + + // get the collection of this HciSkuResource + HciSkuCollection collection = offer.GetHciSkus(); + + // invoke the operation + string skuName = "sku1"; + NullableResponse response = await collection.GetIfExistsAsync(skuName); + HciSkuResource 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 + HciSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_OfferCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_OfferCollection.cs index 100007c691df..62909fff7b05 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_OfferCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_OfferCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetOffer() Console.WriteLine($"Succeeded: {result}"); } + + // Get Offer + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetOffer() + { + // Generated from example definition: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-02-01/examples/GetOffer.json + // this example is just showing the usage of "Offers_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 PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "test-rg"; + string clusterName = "myCluster"; + string publisherName = "publisher1"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this OfferResource + OfferCollection collection = publisher.GetOffers(); + + // invoke the operation + string offerName = "offer1"; + NullableResponse response = await collection.GetIfExistsAsync(offerName); + OfferResource 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 + OfferData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_PublisherCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_PublisherCollection.cs index dec31b37c632..99a32b35f57c 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_PublisherCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_PublisherCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetPublisher() Console.WriteLine($"Succeeded: {result}"); } + + // Get Publisher + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPublisher() + { + // Generated from example definition: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-02-01/examples/GetPublisher.json + // this example is just showing the usage of "Publishers_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 HciClusterResource created on azure + // for more information of creating HciClusterResource, please refer to the document of HciClusterResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "test-rg"; + string clusterName = "myCluster"; + ResourceIdentifier hciClusterResourceId = HciClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + HciClusterResource hciCluster = client.GetHciClusterResource(hciClusterResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = hciCluster.GetPublishers(); + + // invoke the operation + string publisherName = "publisher1"; + NullableResponse response = await collection.GetIfExistsAsync(publisherName); + PublisherResource 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 + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_UpdateCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_UpdateCollection.cs index c90a94375eb4..a99f5a8373e6 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_UpdateCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_UpdateCollection.cs @@ -182,5 +182,48 @@ public async Task Exists_GetASpecificUpdate() Console.WriteLine($"Succeeded: {result}"); } + + // Get a specific update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASpecificUpdate() + { + // Generated from example definition: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-02-01/examples/GetUpdates.json + // this example is just showing the usage of "Updates_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 HciClusterResource created on azure + // for more information of creating HciClusterResource, please refer to the document of HciClusterResource + string subscriptionId = "b8d594e5-51f3-4c11-9c54-a7771b81c712"; + string resourceGroupName = "testrg"; + string clusterName = "testcluster"; + ResourceIdentifier hciClusterResourceId = HciClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + HciClusterResource hciCluster = client.GetHciClusterResource(hciClusterResourceId); + + // get the collection of this UpdateResource + UpdateCollection collection = hciCluster.GetUpdates(); + + // invoke the operation + string updateName = "Microsoft4.2203.2.32"; + NullableResponse response = await collection.GetIfExistsAsync(updateName); + UpdateResource 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 + UpdateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_UpdateRunCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_UpdateRunCollection.cs index 577590f27aae..dfe9956d06a5 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_UpdateRunCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/samples/Generated/Samples/Sample_UpdateRunCollection.cs @@ -186,5 +186,49 @@ public async Task Exists_GetUpdateRunsUnderClusterResource() Console.WriteLine($"Succeeded: {result}"); } + + // Get Update runs under cluster resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetUpdateRunsUnderClusterResource() + { + // Generated from example definition: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-02-01/examples/GetUpdateRuns.json + // this example is just showing the usage of "UpdateRuns_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 UpdateResource created on azure + // for more information of creating UpdateResource, please refer to the document of UpdateResource + string subscriptionId = "b8d594e5-51f3-4c11-9c54-a7771b81c712"; + string resourceGroupName = "testrg"; + string clusterName = "testcluster"; + string updateName = "Microsoft4.2203.2.32"; + ResourceIdentifier updateResourceId = UpdateResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, updateName); + UpdateResource update = client.GetUpdateResource(updateResourceId); + + // get the collection of this UpdateRunResource + UpdateRunCollection collection = update.GetUpdateRuns(); + + // invoke the operation + string updateRunName = "23b779ba-0d52-4a80-8571-45ca74664ec3"; + NullableResponse response = await collection.GetIfExistsAsync(updateRunName); + UpdateRunResource 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 + UpdateRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionCollection.cs index 6cf3f598a744..441a7eeaab6d 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string extensionName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName} + /// + /// + /// Operation Id + /// Extensions_Get + /// + /// + /// + /// The name of the machine extension. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string extensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + + using var scope = _arcExtensionExtensionsClientDiagnostics.CreateScope("ArcExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _arcExtensionExtensionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArcExtensionResource(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.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName} + /// + /// + /// Operation Id + /// Extensions_Get + /// + /// + /// + /// The name of the machine extension. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string extensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + + using var scope = _arcExtensionExtensionsClientDiagnostics.CreateScope("ArcExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _arcExtensionExtensionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, extensionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArcExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingCollection.cs index c19d909e46bc..1dcb28674b53 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string arcSettingName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName} + /// + /// + /// Operation Id + /// ArcSettings_Get + /// + /// + /// + /// The name of the proxy resource holding details of HCI ArcSetting information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string arcSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(arcSettingName, nameof(arcSettingName)); + + using var scope = _arcSettingClientDiagnostics.CreateScope("ArcSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _arcSettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, arcSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArcSettingResource(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.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName} + /// + /// + /// Operation Id + /// ArcSettings_Get + /// + /// + /// + /// The name of the proxy resource holding details of HCI ArcSetting information. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string arcSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(arcSettingName, nameof(arcSettingName)); + + using var scope = _arcSettingClientDiagnostics.CreateScope("ArcSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _arcSettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, arcSettingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArcSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterCollection.cs index 10a54c3466e5..fe54fdf721ec 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _hciClusterClustersClientDiagnostics.CreateScope("HciClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hciClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HciClusterResource(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.AzureStackHCI/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _hciClusterClustersClientDiagnostics.CreateScope("HciClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hciClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HciClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuCollection.cs index 39fb387f72c9..6476cc505cda 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuCollection.cs @@ -247,6 +247,82 @@ public virtual Response Exists(string skuName, string expand = null, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName} + /// + /// + /// Operation Id + /// Skus_Get + /// + /// + /// + /// The name of the SKU available within HCI cluster. + /// Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string skuName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + using var scope = _hciSkuSkusClientDiagnostics.CreateScope("HciSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hciSkuSkusRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, skuName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HciSkuResource(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.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName} + /// + /// + /// Operation Id + /// Skus_Get + /// + /// + /// + /// The name of the SKU available within HCI cluster. + /// Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string skuName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + using var scope = _hciSkuSkusClientDiagnostics.CreateScope("HciSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hciSkuSkusRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, skuName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HciSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferCollection.cs index a109fa47a654..a42fde9430da 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferCollection.cs @@ -247,6 +247,82 @@ public virtual Response Exists(string offerName, string expand = null, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName} + /// + /// + /// Operation Id + /// Offers_Get + /// + /// + /// + /// The name of the offer available within HCI cluster. + /// Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string offerName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(offerName, nameof(offerName)); + + using var scope = _offerClientDiagnostics.CreateScope("OfferCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _offerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, offerName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OfferResource(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.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName} + /// + /// + /// Operation Id + /// Offers_Get + /// + /// + /// + /// The name of the offer available within HCI cluster. + /// Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string offerName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(offerName, nameof(offerName)); + + using var scope = _offerClientDiagnostics.CreateScope("OfferCollection.GetIfExists"); + scope.Start(); + try + { + var response = _offerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, offerName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OfferResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherCollection.cs index 118820095902..a1b4ea3913cc 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string publisherName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher available within HCI cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publisherName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(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.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher available within HCI cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.GetIfExists"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publisherName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateCollection.cs index 1e46c7c1a522..41d0cd4f73db 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string updateName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName} + /// + /// + /// Operation Id + /// Updates_Get + /// + /// + /// + /// The name of the Update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string updateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateName, nameof(updateName)); + + using var scope = _updateClientDiagnostics.CreateScope("UpdateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _updateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UpdateResource(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.AzureStackHCI/clusters/{clusterName}/updates/{updateName} + /// + /// + /// Operation Id + /// Updates_Get + /// + /// + /// + /// The name of the Update. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string updateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateName, nameof(updateName)); + + using var scope = _updateClientDiagnostics.CreateScope("UpdateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _updateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UpdateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunCollection.cs index efaf937bf49e..08c0024bba3d 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string updateRunName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the Update Run. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _updateRunRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, updateRunName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UpdateRunResource(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.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the Update Run. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _updateRunRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, updateRunName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateCollection.cs index 5a54c31719d4..12d974687e17 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateCollection.cs @@ -334,6 +334,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificate_Get + /// + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _batchAccountCertificateCertificateClientDiagnostics.CreateScope("BatchAccountCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _batchAccountCertificateCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchAccountCertificateResource(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.Batch/batchAccounts/{accountName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificate_Get + /// + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _batchAccountCertificateCertificateClientDiagnostics.CreateScope("BatchAccountCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _batchAccountCertificateCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchAccountCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCollection.cs index 008642a165e0..0352540ee7eb 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName} + /// + /// + /// Operation Id + /// BatchAccount_Get + /// + /// + /// + /// The name of the Batch 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _batchAccountClientDiagnostics.CreateScope("BatchAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _batchAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchAccountResource(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.Batch/batchAccounts/{accountName} + /// + /// + /// Operation Id + /// BatchAccount_Get + /// + /// + /// + /// The name of the Batch account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _batchAccountClientDiagnostics.CreateScope("BatchAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _batchAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorCollection.cs index 238fb46f61b5..9f8cab1a4f0d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string detectorId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId} + /// + /// + /// Operation Id + /// BatchAccount_GetDetector + /// + /// + /// + /// The name of the detector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorId, nameof(detectorId)); + + using var scope = _batchAccountDetectorBatchAccountClientDiagnostics.CreateScope("BatchAccountDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _batchAccountDetectorBatchAccountRestClient.GetDetectorAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchAccountDetectorResource(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.Batch/batchAccounts/{accountName}/detectors/{detectorId} + /// + /// + /// Operation Id + /// BatchAccount_GetDetector + /// + /// + /// + /// The name of the detector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorId, nameof(detectorId)); + + using var scope = _batchAccountDetectorBatchAccountClientDiagnostics.CreateScope("BatchAccountDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _batchAccountDetectorBatchAccountRestClient.GetDetector(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchAccountDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolCollection.cs index 4c3609090985..a481733ba29b 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolCollection.cs @@ -361,6 +361,80 @@ public virtual Response Exists(string poolName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName} + /// + /// + /// Operation Id + /// Pool_Get + /// + /// + /// + /// The pool name. This must be unique within the 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 poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using var scope = _batchAccountPoolPoolClientDiagnostics.CreateScope("BatchAccountPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _batchAccountPoolPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchAccountPoolResource(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.Batch/batchAccounts/{accountName}/pools/{poolName} + /// + /// + /// Operation Id + /// Pool_Get + /// + /// + /// + /// The pool name. This must be unique within the account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using var scope = _batchAccountPoolPoolClientDiagnostics.CreateScope("BatchAccountPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _batchAccountPoolPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchAccountPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationCollection.cs index 9f5b7a850bbe..c9d2fe40b5da 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string applicationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Application_Get + /// + /// + /// + /// The name of the application. This must be unique within the 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 applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _batchApplicationApplicationClientDiagnostics.CreateScope("BatchApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _batchApplicationApplicationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchApplicationResource(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.Batch/batchAccounts/{accountName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Application_Get + /// + /// + /// + /// The name of the application. This must be unique within the account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _batchApplicationApplicationClientDiagnostics.CreateScope("BatchApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _batchApplicationApplicationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageCollection.cs index a7e38d4b0baf..6a6fd4acb523 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string versionName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName} + /// + /// + /// Operation Id + /// ApplicationPackage_Get + /// + /// + /// + /// The version of the application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _batchApplicationPackageApplicationPackageClientDiagnostics.CreateScope("BatchApplicationPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _batchApplicationPackageApplicationPackageRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchApplicationPackageResource(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.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName} + /// + /// + /// Operation Id + /// ApplicationPackage_Get + /// + /// + /// + /// The version of the application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _batchApplicationPackageApplicationPackageClientDiagnostics.CreateScope("BatchApplicationPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _batchApplicationPackageApplicationPackageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchApplicationPackageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionCollection.cs index e55b2f3a9097..a31641637015 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_Get + /// + /// + /// + /// The private endpoint connection name. This must be unique within the 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _batchPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics.CreateScope("BatchPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _batchPrivateEndpointConnectionPrivateEndpointConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchPrivateEndpointConnectionResource(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.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_Get + /// + /// + /// + /// The private endpoint connection name. This must be unique within the account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _batchPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics.CreateScope("BatchPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _batchPrivateEndpointConnectionPrivateEndpointConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceCollection.cs index ad01c32af724..71b18c20a0f6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResource_Get + /// + /// + /// + /// The private link resource name. This must be unique within the 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 privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _batchPrivateLinkResourcePrivateLinkResourceClientDiagnostics.CreateScope("BatchPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _batchPrivateLinkResourcePrivateLinkResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchPrivateLinkResource(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.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResource_Get + /// + /// + /// + /// The private link resource name. This must be unique within the account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _batchPrivateLinkResourcePrivateLinkResourceClientDiagnostics.CreateScope("BatchPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _batchPrivateLinkResourcePrivateLinkResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BatchPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingAccountPaymentMethodCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingAccountPaymentMethodCollection.cs index b2f99186c24a..8a09e1e44c12 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingAccountPaymentMethodCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingAccountPaymentMethodCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -109,5 +110,45 @@ public async Task Exists_PaymentMethodGetAtBillingProfile() Console.WriteLine($"Succeeded: {result}"); } + + // PaymentMethodGetAtBillingProfile + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PaymentMethodGetAtBillingProfile() + { + // Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/PaymentMethodAtBillingAccount_Get.json + // this example is just showing the usage of "PaymentMethods_GetByBillingAccount" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this BillingAccountPaymentMethodResource + string billingAccountName = "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31"; + BillingAccountPaymentMethodCollection collection = tenantResource.GetBillingAccountPaymentMethods(billingAccountName); + + // invoke the operation + string paymentMethodName = "21dd9edc-af71-4d62-80ce-37151d475326"; + NullableResponse response = await collection.GetIfExistsAsync(paymentMethodName); + BillingAccountPaymentMethodResource 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 + BillingPaymentMethodData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingPaymentMethodCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingPaymentMethodCollection.cs index 8cfbb56f77ff..f5c0136f7557 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingPaymentMethodCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingPaymentMethodCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -106,5 +107,44 @@ public async Task Exists_GetPaymentMethodOwnedByUser() Console.WriteLine($"Succeeded: {result}"); } + + // GetPaymentMethodOwnedByUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPaymentMethodOwnedByUser() + { + // Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/PaymentMethodOwnedByUser_Get.json + // this example is just showing the usage of "PaymentMethods_GetByUser" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this BillingPaymentMethodResource + BillingPaymentMethodCollection collection = tenantResource.GetBillingPaymentMethods(); + + // invoke the operation + string paymentMethodName = "ABCDABCDABC0"; + NullableResponse response = await collection.GetIfExistsAsync(paymentMethodName); + BillingPaymentMethodResource 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 + BillingPaymentMethodData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingPaymentMethodLinkCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingPaymentMethodLinkCollection.cs index 27ea37cc1ff6..4b3a51f94ede 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingPaymentMethodLinkCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingPaymentMethodLinkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -112,5 +113,46 @@ public async Task Exists_PaymentMethodsGetByBillingProfile() Console.WriteLine($"Succeeded: {result}"); } + + // PaymentMethodsGetByBillingProfile + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PaymentMethodsGetByBillingProfile() + { + // Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/PaymentMethodAtBillingProfile_Get.json + // this example is just showing the usage of "PaymentMethods_GetByBillingProfile" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this BillingPaymentMethodLinkResource + string billingAccountName = "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31"; + string billingProfileName = "ABC1-A1CD-AB1-BP1"; + BillingPaymentMethodLinkCollection collection = tenantResource.GetBillingPaymentMethodLinks(billingAccountName, billingProfileName); + + // invoke the operation + string paymentMethodName = "ABCDABCDABC0"; + NullableResponse response = await collection.GetIfExistsAsync(paymentMethodName); + BillingPaymentMethodLinkResource 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 + BillingPaymentMethodLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingSubscriptionAliasCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingSubscriptionAliasCollection.cs index d0a7f8cb81dc..a222e840ab8f 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingSubscriptionAliasCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingSubscriptionAliasCollection.cs @@ -112,6 +112,46 @@ public async Task Exists_BillingSubscriptionAlias() Console.WriteLine($"Succeeded: {result}"); } + // BillingSubscriptionAlias + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_BillingSubscriptionAlias() + { + // Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/BillingSubscriptionAlias.json + // this example is just showing the usage of "BillingSubscriptionsAliases_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this BillingSubscriptionAliasResource + string billingAccountName = "{billingAccountName}"; + BillingSubscriptionAliasCollection collection = tenantResource.GetBillingSubscriptionAliases(billingAccountName); + + // invoke the operation + string aliasName = "c356b7c7-7545-4686-b843-c1a49cf853fc"; + NullableResponse response = await collection.GetIfExistsAsync(aliasName); + BillingSubscriptionAliasResource 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 + BillingSubscriptionAliasData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutBillingSubscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingSubscriptionCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingSubscriptionCollection.cs index 440e50db6f3b..5a4917ad34b8 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingSubscriptionCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingSubscriptionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -109,5 +110,45 @@ public async Task Exists_BillingSubscription() Console.WriteLine($"Succeeded: {result}"); } + + // BillingSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_BillingSubscription() + { + // Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/BillingSubscription.json + // this example is just showing the usage of "BillingSubscriptions_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this BillingSubscriptionResource + string billingAccountName = "{billingAccountName}"; + BillingSubscriptionCollection collection = tenantResource.GetBillingSubscriptions(billingAccountName); + + // invoke the operation + string billingSubscriptionName = "418b0e9c-5dc3-4260-918f-30b90619fe07"; + NullableResponse response = await collection.GetIfExistsAsync(billingSubscriptionName); + BillingSubscriptionResource 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 + BillingSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodCollection.cs index 63bb1f8f96a2..9a5f6a8eb1d4 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string paymentMethodName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByBillingAccount + /// + /// + /// + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string paymentMethodName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(paymentMethodName, nameof(paymentMethodName)); + + using var scope = _billingAccountPaymentMethodPaymentMethodsClientDiagnostics.CreateScope("BillingAccountPaymentMethodCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingAccountPaymentMethodPaymentMethodsRestClient.GetByBillingAccountAsync(_billingAccountName, paymentMethodName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingAccountPaymentMethodResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByBillingAccount + /// + /// + /// + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string paymentMethodName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(paymentMethodName, nameof(paymentMethodName)); + + using var scope = _billingAccountPaymentMethodPaymentMethodsClientDiagnostics.CreateScope("BillingAccountPaymentMethodCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingAccountPaymentMethodPaymentMethodsRestClient.GetByBillingAccount(_billingAccountName, paymentMethodName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingAccountPaymentMethodResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodCollection.cs index a07d2d51ef15..ebcf2d3cbfe0 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string paymentMethodName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/paymentMethods/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByUser + /// + /// + /// + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string paymentMethodName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(paymentMethodName, nameof(paymentMethodName)); + + using var scope = _billingPaymentMethodPaymentMethodsClientDiagnostics.CreateScope("BillingPaymentMethodCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingPaymentMethodPaymentMethodsRestClient.GetByUserAsync(paymentMethodName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingPaymentMethodResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/paymentMethods/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByUser + /// + /// + /// + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string paymentMethodName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(paymentMethodName, nameof(paymentMethodName)); + + using var scope = _billingPaymentMethodPaymentMethodsClientDiagnostics.CreateScope("BillingPaymentMethodCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingPaymentMethodPaymentMethodsRestClient.GetByUser(paymentMethodName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingPaymentMethodResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkCollection.cs index c53a377b7d2d..37f5d08314db 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkCollection.cs @@ -250,6 +250,80 @@ public virtual Response Exists(string paymentMethodName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByBillingProfile + /// + /// + /// + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string paymentMethodName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(paymentMethodName, nameof(paymentMethodName)); + + using var scope = _billingPaymentMethodLinkPaymentMethodsClientDiagnostics.CreateScope("BillingPaymentMethodLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingPaymentMethodLinkPaymentMethodsRestClient.GetByBillingProfileAsync(_billingAccountName, _billingProfileName, paymentMethodName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingPaymentMethodLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByBillingProfile + /// + /// + /// + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string paymentMethodName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(paymentMethodName, nameof(paymentMethodName)); + + using var scope = _billingPaymentMethodLinkPaymentMethodsClientDiagnostics.CreateScope("BillingPaymentMethodLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingPaymentMethodLinkPaymentMethodsRestClient.GetByBillingProfile(_billingAccountName, _billingProfileName, paymentMethodName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingPaymentMethodLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasCollection.cs index f785eff8d441..ec35845c05de 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string aliasName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName} + /// + /// + /// Operation Id + /// BillingSubscriptionsAliases_Get + /// + /// + /// + /// The ID that uniquely identifies a subscription alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string aliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName)); + + using var scope = _billingSubscriptionAliasBillingSubscriptionsAliasesClientDiagnostics.CreateScope("BillingSubscriptionAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingSubscriptionAliasBillingSubscriptionsAliasesRestClient.GetAsync(_billingAccountName, aliasName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingSubscriptionAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName} + /// + /// + /// Operation Id + /// BillingSubscriptionsAliases_Get + /// + /// + /// + /// The ID that uniquely identifies a subscription alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string aliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName)); + + using var scope = _billingSubscriptionAliasBillingSubscriptionsAliasesClientDiagnostics.CreateScope("BillingSubscriptionAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingSubscriptionAliasBillingSubscriptionsAliasesRestClient.Get(_billingAccountName, aliasName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingSubscriptionAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionCollection.cs index a70b4bb68f8e..97799658fedc 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string billingSubscriptionName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName} + /// + /// + /// Operation Id + /// BillingSubscriptions_Get + /// + /// + /// + /// The ID that uniquely identifies a subscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string billingSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingSubscriptionName, nameof(billingSubscriptionName)); + + using var scope = _billingSubscriptionClientDiagnostics.CreateScope("BillingSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingSubscriptionRestClient.GetAsync(_billingAccountName, billingSubscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName} + /// + /// + /// Operation Id + /// BillingSubscriptions_Get + /// + /// + /// + /// The ID that uniquely identifies a subscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string billingSubscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingSubscriptionName, nameof(billingSubscriptionName)); + + using var scope = _billingSubscriptionClientDiagnostics.CreateScope("BillingSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingSubscriptionRestClient.Get(_billingAccountName, billingSubscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasCollection.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasCollection.cs index 5e881e60de27..5f8fa2a93b29 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasCollection.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasCollection.cs @@ -277,5 +277,79 @@ public virtual Response Exists(string reservationOrderAliasName, Cancellat throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/reservationOrderAliases/{reservationOrderAliasName} + /// + /// + /// Operation Id + /// ReservationOrderAlias_Get + /// + /// + /// + /// Name of the reservation order alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string reservationOrderAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderAliasName, nameof(reservationOrderAliasName)); + + using var scope = _billingBenefitsReservationOrderAliasReservationOrderAliasClientDiagnostics.CreateScope("BillingBenefitsReservationOrderAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingBenefitsReservationOrderAliasReservationOrderAliasRestClient.GetAsync(reservationOrderAliasName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingBenefitsReservationOrderAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/reservationOrderAliases/{reservationOrderAliasName} + /// + /// + /// Operation Id + /// ReservationOrderAlias_Get + /// + /// + /// + /// Name of the reservation order alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string reservationOrderAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderAliasName, nameof(reservationOrderAliasName)); + + using var scope = _billingBenefitsReservationOrderAliasReservationOrderAliasClientDiagnostics.CreateScope("BillingBenefitsReservationOrderAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingBenefitsReservationOrderAliasReservationOrderAliasRestClient.Get(reservationOrderAliasName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingBenefitsReservationOrderAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanCollection.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanCollection.cs index 0a6cffd7be04..a05adc161d99 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanCollection.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanCollection.cs @@ -245,6 +245,82 @@ public virtual Response Exists(string savingsPlanId, string expand = null, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId} + /// + /// + /// Operation Id + /// SavingsPlan_Get + /// + /// + /// + /// ID of the savings plan. + /// May be used to expand the detail information of some properties. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string savingsPlanId, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + + using var scope = _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics.CreateScope("BillingBenefitsSavingsPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingBenefitsSavingsPlanSavingsPlanRestClient.GetAsync(Id.Name, savingsPlanId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingBenefitsSavingsPlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId} + /// + /// + /// Operation Id + /// SavingsPlan_Get + /// + /// + /// + /// ID of the savings plan. + /// May be used to expand the detail information of some properties. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string savingsPlanId, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + + using var scope = _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics.CreateScope("BillingBenefitsSavingsPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingBenefitsSavingsPlanSavingsPlanRestClient.Get(Id.Name, savingsPlanId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingBenefitsSavingsPlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasCollection.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasCollection.cs index 2464309d6ca0..658db915ad9a 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasCollection.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasCollection.cs @@ -276,5 +276,79 @@ public virtual Response Exists(string savingsPlanOrderAliasName, Cancellat throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrderAliases/{savingsPlanOrderAliasName} + /// + /// + /// Operation Id + /// SavingsPlanOrderAlias_Get + /// + /// + /// + /// Name of the savings plan order alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string savingsPlanOrderAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderAliasName, nameof(savingsPlanOrderAliasName)); + + using var scope = _billingBenefitsSavingsPlanOrderAliasSavingsPlanOrderAliasClientDiagnostics.CreateScope("BillingBenefitsSavingsPlanOrderAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingBenefitsSavingsPlanOrderAliasSavingsPlanOrderAliasRestClient.GetAsync(savingsPlanOrderAliasName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingBenefitsSavingsPlanOrderAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrderAliases/{savingsPlanOrderAliasName} + /// + /// + /// Operation Id + /// SavingsPlanOrderAlias_Get + /// + /// + /// + /// Name of the savings plan order alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string savingsPlanOrderAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderAliasName, nameof(savingsPlanOrderAliasName)); + + using var scope = _billingBenefitsSavingsPlanOrderAliasSavingsPlanOrderAliasClientDiagnostics.CreateScope("BillingBenefitsSavingsPlanOrderAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingBenefitsSavingsPlanOrderAliasSavingsPlanOrderAliasRestClient.Get(savingsPlanOrderAliasName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingBenefitsSavingsPlanOrderAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderCollection.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderCollection.cs index c433a2a05ef8..ebec011594cc 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderCollection.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderCollection.cs @@ -246,6 +246,82 @@ public virtual Response Exists(string savingsPlanOrderId, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId} + /// + /// + /// Operation Id + /// SavingsPlanOrder_Get + /// + /// + /// + /// Order ID of the savings plan. + /// May be used to expand the detail information of some properties. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string savingsPlanOrderId, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + + using var scope = _billingBenefitsSavingsPlanOrderSavingsPlanOrderClientDiagnostics.CreateScope("BillingBenefitsSavingsPlanOrderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingBenefitsSavingsPlanOrderSavingsPlanOrderRestClient.GetAsync(savingsPlanOrderId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingBenefitsSavingsPlanOrderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId} + /// + /// + /// Operation Id + /// SavingsPlanOrder_Get + /// + /// + /// + /// Order ID of the savings plan. + /// May be used to expand the detail information of some properties. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string savingsPlanOrderId, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + + using var scope = _billingBenefitsSavingsPlanOrderSavingsPlanOrderClientDiagnostics.CreateScope("BillingBenefitsSavingsPlanOrderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingBenefitsSavingsPlanOrderSavingsPlanOrderRestClient.Get(savingsPlanOrderId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingBenefitsSavingsPlanOrderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_AssignmentCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_AssignmentCollection.cs index 866787495ad5..dbfecabd11cf 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_AssignmentCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_AssignmentCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -76,6 +77,46 @@ public async Task Exists_AssignmentAtManagementGroupScope() Console.WriteLine($"Succeeded: {result}"); } + // Assignment at management group scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AssignmentAtManagementGroupScope() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Get.json + // this example is just showing the usage of "Assignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this AssignmentResource + string resourceScope = "managementGroups/ContosoOnlineGroup"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceScope)); + AssignmentCollection collection = client.GetAssignments(scopeId); + + // invoke the operation + string assignmentName = "assignSimpleBlueprint"; + NullableResponse response = await collection.GetIfExistsAsync(assignmentName); + AssignmentResource 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 + AssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Assignment at subscription scope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -136,6 +177,46 @@ public async Task Exists_AssignmentAtSubscriptionScope() Console.WriteLine($"Succeeded: {result}"); } + // Assignment at subscription scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AssignmentAtSubscriptionScope() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Get.json + // this example is just showing the usage of "Assignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this AssignmentResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceScope)); + AssignmentCollection collection = client.GetAssignments(scopeId); + + // invoke the operation + string assignmentName = "assignSimpleBlueprint"; + NullableResponse response = await collection.GetIfExistsAsync(assignmentName); + AssignmentResource 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 + AssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Assignment at management group scope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_AssignmentOperationCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_AssignmentOperationCollection.cs index 1537595e781a..bf4e7ef8ff6a 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_AssignmentOperationCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_AssignmentOperationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -152,6 +153,48 @@ public async Task Exists_AssignmentAtManagementGroupScope() Console.WriteLine($"Succeeded: {result}"); } + // Assignment at management group scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AssignmentAtManagementGroupScope() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignmentOperation_Get.json + // this example is just showing the usage of "AssignmentOperations_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 AssignmentResource created on azure + // for more information of creating AssignmentResource, please refer to the document of AssignmentResource + string resourceScope = "managementGroups/ContosoOnlineGroup"; + string assignmentName = "assignSimpleBlueprint"; + ResourceIdentifier assignmentResourceId = AssignmentResource.CreateResourceIdentifier(resourceScope, assignmentName); + AssignmentResource assignment = client.GetAssignmentResource(assignmentResourceId); + + // get the collection of this AssignmentOperationResource + AssignmentOperationCollection collection = assignment.GetAssignmentOperations(); + + // invoke the operation + string assignmentOperationName = "fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"; + NullableResponse response = await collection.GetIfExistsAsync(assignmentOperationName); + AssignmentOperationResource 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 + AssignmentOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Assignment at subscription scope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -215,5 +258,47 @@ public async Task Exists_AssignmentAtSubscriptionScope() Console.WriteLine($"Succeeded: {result}"); } + + // Assignment at subscription scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AssignmentAtSubscriptionScope() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignmentOperation_Get.json + // this example is just showing the usage of "AssignmentOperations_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 AssignmentResource created on azure + // for more information of creating AssignmentResource, please refer to the document of AssignmentResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string assignmentName = "assignSimpleBlueprint"; + ResourceIdentifier assignmentResourceId = AssignmentResource.CreateResourceIdentifier(resourceScope, assignmentName); + AssignmentResource assignment = client.GetAssignmentResource(assignmentResourceId); + + // get the collection of this AssignmentOperationResource + AssignmentOperationCollection collection = assignment.GetAssignmentOperations(); + + // invoke the operation + string assignmentOperationName = "fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"; + NullableResponse response = await collection.GetIfExistsAsync(assignmentOperationName); + AssignmentOperationResource 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 + AssignmentOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintArtifactCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintArtifactCollection.cs index 2326d8e79d9d..589c3afb7fab 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintArtifactCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintArtifactCollection.cs @@ -431,6 +431,48 @@ public async Task Exists_MGARMTemplateArtifact() Console.WriteLine($"Succeeded: {result}"); } + // MG-ARMTemplateArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MGARMTemplateArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Get.json + // this example is just showing the usage of "Artifacts_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 BlueprintResource created on azure + // for more information of creating BlueprintResource, please refer to the document of BlueprintResource + string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup"; + string blueprintName = "simpleBlueprint"; + ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName); + BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId); + + // get the collection of this BlueprintArtifactResource + BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts(); + + // invoke the operation + string artifactName = "storageTemplate"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MG-PolicyAssignmentArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -495,6 +537,48 @@ public async Task Exists_MGPolicyAssignmentArtifact() Console.WriteLine($"Succeeded: {result}"); } + // MG-PolicyAssignmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MGPolicyAssignmentArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/PolicyAssignmentArtifact_Get.json + // this example is just showing the usage of "Artifacts_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 BlueprintResource created on azure + // for more information of creating BlueprintResource, please refer to the document of BlueprintResource + string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup"; + string blueprintName = "simpleBlueprint"; + ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName); + BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId); + + // get the collection of this BlueprintArtifactResource + BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts(); + + // invoke the operation + string artifactName = "costCenterPolicy"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MG-RoleAssignmentArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -559,6 +643,48 @@ public async Task Exists_MGRoleAssignmentArtifact() Console.WriteLine($"Succeeded: {result}"); } + // MG-RoleAssignmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MGRoleAssignmentArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/RoleAssignmentArtifact_Get.json + // this example is just showing the usage of "Artifacts_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 BlueprintResource created on azure + // for more information of creating BlueprintResource, please refer to the document of BlueprintResource + string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup"; + string blueprintName = "simpleBlueprint"; + ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName); + BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId); + + // get the collection of this BlueprintArtifactResource + BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts(); + + // invoke the operation + string artifactName = "ownerAssignment"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Sub-ARMTemplateArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -623,6 +749,48 @@ public async Task Exists_SubARMTemplateArtifact() Console.WriteLine($"Succeeded: {result}"); } + // Sub-ARMTemplateArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubARMTemplateArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/ARMTemplateArtifact_Get.json + // this example is just showing the usage of "Artifacts_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 BlueprintResource created on azure + // for more information of creating BlueprintResource, please refer to the document of BlueprintResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string blueprintName = "simpleBlueprint"; + ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName); + BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId); + + // get the collection of this BlueprintArtifactResource + BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts(); + + // invoke the operation + string artifactName = "storageTemplate"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Sub-PolicyAssignmentArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -687,6 +855,48 @@ public async Task Exists_SubPolicyAssignmentArtifact() Console.WriteLine($"Succeeded: {result}"); } + // Sub-PolicyAssignmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubPolicyAssignmentArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/PolicyAssignmentArtifact_Get.json + // this example is just showing the usage of "Artifacts_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 BlueprintResource created on azure + // for more information of creating BlueprintResource, please refer to the document of BlueprintResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string blueprintName = "simpleBlueprint"; + ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName); + BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId); + + // get the collection of this BlueprintArtifactResource + BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts(); + + // invoke the operation + string artifactName = "costCenterPolicy"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Sub-RoleAssignmentArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -751,6 +961,48 @@ public async Task Exists_SubRoleAssignmentArtifact() Console.WriteLine($"Succeeded: {result}"); } + // Sub-RoleAssignmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubRoleAssignmentArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/RoleAssignmentArtifact_Get.json + // this example is just showing the usage of "Artifacts_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 BlueprintResource created on azure + // for more information of creating BlueprintResource, please refer to the document of BlueprintResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string blueprintName = "simpleBlueprint"; + ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName); + BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId); + + // get the collection of this BlueprintArtifactResource + BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts(); + + // invoke the operation + string artifactName = "ownerAssignment"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MG-ArtifactList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintCollection.cs index b611b42569b8..a4c1166c573e 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintCollection.cs @@ -252,6 +252,46 @@ public async Task Exists_ManagementGroupBlueprint() Console.WriteLine($"Succeeded: {result}"); } + // ManagementGroupBlueprint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagementGroupBlueprint() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_Get.json + // this example is just showing the usage of "Blueprints_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this BlueprintResource + string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceScope)); + BlueprintCollection collection = client.GetBlueprints(scopeId); + + // invoke the operation + string blueprintName = "simpleBlueprint"; + NullableResponse response = await collection.GetIfExistsAsync(blueprintName); + BlueprintResource 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 + BlueprintData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SubscriptionBlueprint [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -312,6 +352,46 @@ public async Task Exists_SubscriptionBlueprint() Console.WriteLine($"Succeeded: {result}"); } + // SubscriptionBlueprint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubscriptionBlueprint() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/Blueprint_Get.json + // this example is just showing the usage of "Blueprints_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this BlueprintResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceScope)); + BlueprintCollection collection = client.GetBlueprints(scopeId); + + // invoke the operation + string blueprintName = "simpleBlueprint"; + NullableResponse response = await collection.GetIfExistsAsync(blueprintName); + BlueprintResource 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 + BlueprintData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ManagementGroupBlueprint [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintVersionArtifactCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintVersionArtifactCollection.cs index 775dcc74dd6c..4ef3f98ae244 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintVersionArtifactCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_BlueprintVersionArtifactCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_MGARMTemplateArtifact() Console.WriteLine($"Succeeded: {result}"); } + // MG-ARMTemplateArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MGARMTemplateArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedARMTemplateArtifact_Get.json + // this example is just showing the usage of "PublishedArtifacts_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 PublishedBlueprintResource created on azure + // for more information of creating PublishedBlueprintResource, please refer to the document of PublishedBlueprintResource + string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup"; + string blueprintName = "simpleBlueprint"; + string versionId = "V2"; + ResourceIdentifier publishedBlueprintResourceId = PublishedBlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName, versionId); + PublishedBlueprintResource publishedBlueprint = client.GetPublishedBlueprintResource(publishedBlueprintResourceId); + + // get the collection of this BlueprintVersionArtifactResource + BlueprintVersionArtifactCollection collection = publishedBlueprint.GetBlueprintVersionArtifacts(); + + // invoke the operation + string artifactName = "storageTemplate"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintVersionArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MG-PolicyAssignmentArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -148,6 +192,49 @@ public async Task Exists_MGPolicyAssignmentArtifact() Console.WriteLine($"Succeeded: {result}"); } + // MG-PolicyAssignmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MGPolicyAssignmentArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedPolicyAssignmentArtifact_Get.json + // this example is just showing the usage of "PublishedArtifacts_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 PublishedBlueprintResource created on azure + // for more information of creating PublishedBlueprintResource, please refer to the document of PublishedBlueprintResource + string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup"; + string blueprintName = "simpleBlueprint"; + string versionId = "V2"; + ResourceIdentifier publishedBlueprintResourceId = PublishedBlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName, versionId); + PublishedBlueprintResource publishedBlueprint = client.GetPublishedBlueprintResource(publishedBlueprintResourceId); + + // get the collection of this BlueprintVersionArtifactResource + BlueprintVersionArtifactCollection collection = publishedBlueprint.GetBlueprintVersionArtifacts(); + + // invoke the operation + string artifactName = "costCenterPolicy"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintVersionArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MG-RoleAssignmentArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -214,6 +301,49 @@ public async Task Exists_MGRoleAssignmentArtifact() Console.WriteLine($"Succeeded: {result}"); } + // MG-RoleAssignmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MGRoleAssignmentArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedRoleAssignmentArtifact_Get.json + // this example is just showing the usage of "PublishedArtifacts_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 PublishedBlueprintResource created on azure + // for more information of creating PublishedBlueprintResource, please refer to the document of PublishedBlueprintResource + string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup"; + string blueprintName = "simpleBlueprint"; + string versionId = "V2"; + ResourceIdentifier publishedBlueprintResourceId = PublishedBlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName, versionId); + PublishedBlueprintResource publishedBlueprint = client.GetPublishedBlueprintResource(publishedBlueprintResourceId); + + // get the collection of this BlueprintVersionArtifactResource + BlueprintVersionArtifactCollection collection = publishedBlueprint.GetBlueprintVersionArtifacts(); + + // invoke the operation + string artifactName = "ownerAssignment"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintVersionArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Sub-ARMTemplateArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -280,6 +410,49 @@ public async Task Exists_SubARMTemplateArtifact() Console.WriteLine($"Succeeded: {result}"); } + // Sub-ARMTemplateArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubARMTemplateArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedARMTemplateArtifact_Get.json + // this example is just showing the usage of "PublishedArtifacts_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 PublishedBlueprintResource created on azure + // for more information of creating PublishedBlueprintResource, please refer to the document of PublishedBlueprintResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string blueprintName = "simpleBlueprint"; + string versionId = "V2"; + ResourceIdentifier publishedBlueprintResourceId = PublishedBlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName, versionId); + PublishedBlueprintResource publishedBlueprint = client.GetPublishedBlueprintResource(publishedBlueprintResourceId); + + // get the collection of this BlueprintVersionArtifactResource + BlueprintVersionArtifactCollection collection = publishedBlueprint.GetBlueprintVersionArtifacts(); + + // invoke the operation + string artifactName = "storageTemplate"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintVersionArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Sub-PolicyAssignmentArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -346,6 +519,49 @@ public async Task Exists_SubPolicyAssignmentArtifact() Console.WriteLine($"Succeeded: {result}"); } + // Sub-PolicyAssignmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubPolicyAssignmentArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedPolicyAssignmentArtifact_Get.json + // this example is just showing the usage of "PublishedArtifacts_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 PublishedBlueprintResource created on azure + // for more information of creating PublishedBlueprintResource, please refer to the document of PublishedBlueprintResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string blueprintName = "simpleBlueprint"; + string versionId = "V2"; + ResourceIdentifier publishedBlueprintResourceId = PublishedBlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName, versionId); + PublishedBlueprintResource publishedBlueprint = client.GetPublishedBlueprintResource(publishedBlueprintResourceId); + + // get the collection of this BlueprintVersionArtifactResource + BlueprintVersionArtifactCollection collection = publishedBlueprint.GetBlueprintVersionArtifacts(); + + // invoke the operation + string artifactName = "costCenterPolicy"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintVersionArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Sub-RoleAssignmentArtifact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -412,6 +628,49 @@ public async Task Exists_SubRoleAssignmentArtifact() Console.WriteLine($"Succeeded: {result}"); } + // Sub-RoleAssignmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubRoleAssignmentArtifact() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedRoleAssignmentArtifact_Get.json + // this example is just showing the usage of "PublishedArtifacts_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 PublishedBlueprintResource created on azure + // for more information of creating PublishedBlueprintResource, please refer to the document of PublishedBlueprintResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string blueprintName = "simpleBlueprint"; + string versionId = "V2"; + ResourceIdentifier publishedBlueprintResourceId = PublishedBlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName, versionId); + PublishedBlueprintResource publishedBlueprint = client.GetPublishedBlueprintResource(publishedBlueprintResourceId); + + // get the collection of this BlueprintVersionArtifactResource + BlueprintVersionArtifactCollection collection = publishedBlueprint.GetBlueprintVersionArtifacts(); + + // invoke the operation + string artifactName = "ownerAssignment"; + NullableResponse response = await collection.GetIfExistsAsync(artifactName); + BlueprintVersionArtifactResource 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 + ArtifactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MG-ArtifactList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_PublishedBlueprintCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_PublishedBlueprintCollection.cs index c4c811020a2e..1e3d46d74341 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_PublishedBlueprintCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/samples/Generated/Samples/Sample_PublishedBlueprintCollection.cs @@ -153,6 +153,48 @@ public async Task Exists_PublishedManagementGroupBlueprint() Console.WriteLine($"Succeeded: {result}"); } + // PublishedManagementGroupBlueprint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PublishedManagementGroupBlueprint() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_Get.json + // this example is just showing the usage of "PublishedBlueprints_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 BlueprintResource created on azure + // for more information of creating BlueprintResource, please refer to the document of BlueprintResource + string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup"; + string blueprintName = "simpleBlueprint"; + ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName); + BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId); + + // get the collection of this PublishedBlueprintResource + PublishedBlueprintCollection collection = blueprint.GetPublishedBlueprints(); + + // invoke the operation + string versionId = "v2"; + NullableResponse response = await collection.GetIfExistsAsync(versionId); + PublishedBlueprintResource 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 + PublishedBlueprintData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PublishedSubscriptionBlueprint [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -216,5 +258,47 @@ public async Task Exists_PublishedSubscriptionBlueprint() Console.WriteLine($"Succeeded: {result}"); } + + // PublishedSubscriptionBlueprint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PublishedSubscriptionBlueprint() + { + // Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedBlueprint_Get.json + // this example is just showing the usage of "PublishedBlueprints_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 BlueprintResource created on azure + // for more information of creating BlueprintResource, please refer to the document of BlueprintResource + string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string blueprintName = "simpleBlueprint"; + ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName); + BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId); + + // get the collection of this PublishedBlueprintResource + PublishedBlueprintCollection collection = blueprint.GetPublishedBlueprints(); + + // invoke the operation + string versionId = "v2"; + NullableResponse response = await collection.GetIfExistsAsync(versionId); + PublishedBlueprintResource 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 + PublishedBlueprintData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentCollection.cs index 564c3a3d9b8f..987054b71918 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string assignmentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName} + /// + /// + /// Operation Id + /// Assignments_Get + /// + /// + /// + /// Name of the blueprint assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assignmentName, nameof(assignmentName)); + + using var scope = _assignmentClientDiagnostics.CreateScope("AssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _assignmentRestClient.GetAsync(Id, assignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName} + /// + /// + /// Operation Id + /// Assignments_Get + /// + /// + /// + /// Name of the blueprint assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assignmentName, nameof(assignmentName)); + + using var scope = _assignmentClientDiagnostics.CreateScope("AssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _assignmentRestClient.Get(Id, assignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationCollection.cs index 11dc4ffb4361..805a1602d776 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string assignmentOperationName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations/{assignmentOperationName} + /// + /// + /// Operation Id + /// AssignmentOperations_Get + /// + /// + /// + /// Name of the blueprint assignment operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assignmentOperationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assignmentOperationName, nameof(assignmentOperationName)); + + using var scope = _assignmentOperationClientDiagnostics.CreateScope("AssignmentOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _assignmentOperationRestClient.GetAsync(Id.Parent, Id.Name, assignmentOperationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AssignmentOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations/{assignmentOperationName} + /// + /// + /// Operation Id + /// AssignmentOperations_Get + /// + /// + /// + /// Name of the blueprint assignment operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assignmentOperationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assignmentOperationName, nameof(assignmentOperationName)); + + using var scope = _assignmentOperationClientDiagnostics.CreateScope("AssignmentOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _assignmentOperationRestClient.Get(Id.Parent, Id.Name, assignmentOperationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AssignmentOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactCollection.cs index bd0ec0f7b6e9..c3e94f22f1ef 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string artifactName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName} + /// + /// + /// Operation Id + /// Artifacts_Get + /// + /// + /// + /// Name of the blueprint artifact. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); + + using var scope = _blueprintArtifactArtifactsClientDiagnostics.CreateScope("BlueprintArtifactCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _blueprintArtifactArtifactsRestClient.GetAsync(Id.Parent, Id.Name, artifactName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BlueprintArtifactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName} + /// + /// + /// Operation Id + /// Artifacts_Get + /// + /// + /// + /// Name of the blueprint artifact. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); + + using var scope = _blueprintArtifactArtifactsClientDiagnostics.CreateScope("BlueprintArtifactCollection.GetIfExists"); + scope.Start(); + try + { + var response = _blueprintArtifactArtifactsRestClient.Get(Id.Parent, Id.Name, artifactName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BlueprintArtifactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintCollection.cs index 77b6132681d2..8bfff5f0f45c 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string blueprintName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName} + /// + /// + /// Operation Id + /// Blueprints_Get + /// + /// + /// + /// Name of the blueprint definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string blueprintName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(blueprintName, nameof(blueprintName)); + + using var scope = _blueprintClientDiagnostics.CreateScope("BlueprintCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _blueprintRestClient.GetAsync(Id, blueprintName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BlueprintResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName} + /// + /// + /// Operation Id + /// Blueprints_Get + /// + /// + /// + /// Name of the blueprint definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string blueprintName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(blueprintName, nameof(blueprintName)); + + using var scope = _blueprintClientDiagnostics.CreateScope("BlueprintCollection.GetIfExists"); + scope.Start(); + try + { + var response = _blueprintRestClient.Get(Id, blueprintName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BlueprintResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactCollection.cs index f70680ffb003..9d4c1bdc8390 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string artifactName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts/{artifactName} + /// + /// + /// Operation Id + /// PublishedArtifacts_Get + /// + /// + /// + /// Name of the blueprint artifact. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); + + using var scope = _blueprintVersionArtifactPublishedArtifactsClientDiagnostics.CreateScope("BlueprintVersionArtifactCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _blueprintVersionArtifactPublishedArtifactsRestClient.GetAsync(Id.Parent.Parent, Id.Parent.Name, Id.Name, artifactName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BlueprintVersionArtifactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts/{artifactName} + /// + /// + /// Operation Id + /// PublishedArtifacts_Get + /// + /// + /// + /// Name of the blueprint artifact. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); + + using var scope = _blueprintVersionArtifactPublishedArtifactsClientDiagnostics.CreateScope("BlueprintVersionArtifactCollection.GetIfExists"); + scope.Start(); + try + { + var response = _blueprintVersionArtifactPublishedArtifactsRestClient.Get(Id.Parent.Parent, Id.Parent.Name, Id.Name, artifactName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BlueprintVersionArtifactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintCollection.cs index 29d7358430c4..7cd2cfa8ae29 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string versionId, CancellationToken cancell throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId} + /// + /// + /// Operation Id + /// PublishedBlueprints_Get + /// + /// + /// + /// Version of the published blueprint definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string versionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionId, nameof(versionId)); + + using var scope = _publishedBlueprintClientDiagnostics.CreateScope("PublishedBlueprintCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _publishedBlueprintRestClient.GetAsync(Id.Parent, Id.Name, versionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublishedBlueprintResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId} + /// + /// + /// Operation Id + /// PublishedBlueprints_Get + /// + /// + /// + /// Version of the published blueprint definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionId, nameof(versionId)); + + using var scope = _publishedBlueprintClientDiagnostics.CreateScope("PublishedBlueprintCollection.GetIfExists"); + scope.Start(); + try + { + var response = _publishedBlueprintRestClient.Get(Id.Parent, Id.Name, versionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublishedBlueprintResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotChannelCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotChannelCollection.cs index 8f845bb778da..5c87af377606 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotChannelCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotChannelCollection.cs @@ -318,6 +318,49 @@ public async Task Exists_GetAlexaChannel() Console.WriteLine($"Succeeded: {result}"); } + // Get Alexa Channel + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAlexaChannel() + { + // Generated from example definition: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetAlexaChannel.json + // this example is just showing the usage of "Channels_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 BotResource created on azure + // for more information of creating BotResource, please refer to the document of BotResource + string subscriptionId = "subscription-id"; + string resourceGroupName = "OneResourceGroupName"; + string resourceName = "samplebotname"; + ResourceIdentifier botResourceId = BotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + BotResource bot = client.GetBotResource(botResourceId); + + // get the collection of this BotChannelResource + BotChannelCollection collection = bot.GetBotChannels(); + + // invoke the operation + BotChannelName channelName = BotChannelName.AlexaChannel; + NullableResponse response = await collection.GetIfExistsAsync(channelName); + BotChannelResource 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 + BotChannelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Channel [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -384,6 +427,49 @@ public async Task Exists_GetChannel() Console.WriteLine($"Succeeded: {result}"); } + // Get Channel + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetChannel() + { + // Generated from example definition: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetChannel.json + // this example is just showing the usage of "Channels_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 BotResource created on azure + // for more information of creating BotResource, please refer to the document of BotResource + string subscriptionId = "subscription-id"; + string resourceGroupName = "OneResourceGroupName"; + string resourceName = "samplebotname"; + ResourceIdentifier botResourceId = BotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + BotResource bot = client.GetBotResource(botResourceId); + + // get the collection of this BotChannelResource + BotChannelCollection collection = bot.GetBotChannels(); + + // invoke the operation + BotChannelName channelName = BotChannelName.EmailChannel; + NullableResponse response = await collection.GetIfExistsAsync(channelName); + BotChannelResource 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 + BotChannelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get DirectLine Speech Channel [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -450,6 +536,49 @@ public async Task Exists_GetDirectLineSpeechChannel() Console.WriteLine($"Succeeded: {result}"); } + // Get DirectLine Speech Channel + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDirectLineSpeechChannel() + { + // Generated from example definition: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetDirectLineSpeechChannel.json + // this example is just showing the usage of "Channels_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 BotResource created on azure + // for more information of creating BotResource, please refer to the document of BotResource + string subscriptionId = "subscription-id"; + string resourceGroupName = "OneResourceGroupName"; + string resourceName = "samplebotname"; + ResourceIdentifier botResourceId = BotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + BotResource bot = client.GetBotResource(botResourceId); + + // get the collection of this BotChannelResource + BotChannelCollection collection = bot.GetBotChannels(); + + // invoke the operation + BotChannelName channelName = BotChannelName.DirectLineSpeechChannel; + NullableResponse response = await collection.GetIfExistsAsync(channelName); + BotChannelResource 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 + BotChannelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Line Channel [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -516,6 +645,49 @@ public async Task Exists_GetLineChannel() Console.WriteLine($"Succeeded: {result}"); } + // Get Line Channel + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLineChannel() + { + // Generated from example definition: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetLineChannel.json + // this example is just showing the usage of "Channels_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 BotResource created on azure + // for more information of creating BotResource, please refer to the document of BotResource + string subscriptionId = "subscription-id"; + string resourceGroupName = "OneResourceGroupName"; + string resourceName = "samplebotname"; + ResourceIdentifier botResourceId = BotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + BotResource bot = client.GetBotResource(botResourceId); + + // get the collection of this BotChannelResource + BotChannelCollection collection = bot.GetBotChannels(); + + // invoke the operation + BotChannelName channelName = BotChannelName.LineChannel; + NullableResponse response = await collection.GetIfExistsAsync(channelName); + BotChannelResource 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 + BotChannelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Channels by Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotCollection.cs index 0f677743609a..ae13dbe22d60 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotCollection.cs @@ -150,6 +150,48 @@ public async Task Exists_GetBot() Console.WriteLine($"Succeeded: {result}"); } + // Get Bot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBot() + { + // Generated from example definition: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetBot.json + // this example is just showing the usage of "Bots_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 = "subscription-id"; + string resourceGroupName = "OneResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BotResource + BotCollection collection = resourceGroupResource.GetBots(); + + // invoke the operation + string resourceName = "samplebotname"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + BotResource 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 + BotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Bots by Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotConnectionSettingCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotConnectionSettingCollection.cs index 3e33d1096a82..807a5feecc1e 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotConnectionSettingCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotConnectionSettingCollection.cs @@ -143,6 +143,49 @@ public async Task Exists_GetConnectionSetting() Console.WriteLine($"Succeeded: {result}"); } + // Get Connection Setting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConnectionSetting() + { + // Generated from example definition: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetConnection.json + // this example is just showing the usage of "BotConnection_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 BotResource created on azure + // for more information of creating BotResource, please refer to the document of BotResource + string subscriptionId = "subscription-id"; + string resourceGroupName = "OneResourceGroupName"; + string resourceName = "samplebotname"; + ResourceIdentifier botResourceId = BotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + BotResource bot = client.GetBotResource(botResourceId); + + // get the collection of this BotConnectionSettingResource + BotConnectionSettingCollection collection = bot.GetBotConnectionSettings(); + + // invoke the operation + string connectionName = "sampleConnection"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + BotConnectionSettingResource 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 + BotConnectionSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Connection Settings [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotServicePrivateEndpointConnectionCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotServicePrivateEndpointConnectionCollection.cs index 2b13afadb426..b85576f3824b 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotServicePrivateEndpointConnectionCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/samples/Generated/Samples/Sample_BotServicePrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get Private Endpoint Connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpointConnection() + { + // Generated from example definition: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 BotResource created on azure + // for more information of creating BotResource, please refer to the document of BotResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res6977"; + string resourceName = "sto2527"; + ResourceIdentifier botResourceId = BotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + BotResource bot = client.GetBotResource(botResourceId); + + // get the collection of this BotServicePrivateEndpointConnectionResource + BotServicePrivateEndpointConnectionCollection collection = bot.GetBotServicePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "{privateEndpointConnectionName}"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + BotServicePrivateEndpointConnectionResource 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 + BotServicePrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put Private Endpoint Connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelCollection.cs index 9902bf8df84b..2a557bec76ec 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(BotChannelName channelName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName} + /// + /// + /// Operation Id + /// Channels_Get + /// + /// + /// + /// The name of the Channel resource. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(BotChannelName channelName, CancellationToken cancellationToken = default) + { + using var scope = _botChannelChannelsClientDiagnostics.CreateScope("BotChannelCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _botChannelChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, channelName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BotChannelResource(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.BotService/botServices/{resourceName}/channels/{channelName} + /// + /// + /// Operation Id + /// Channels_Get + /// + /// + /// + /// The name of the Channel resource. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(BotChannelName channelName, CancellationToken cancellationToken = default) + { + using var scope = _botChannelChannelsClientDiagnostics.CreateScope("BotChannelCollection.GetIfExists"); + scope.Start(); + try + { + var response = _botChannelChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, channelName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BotChannelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotCollection.cs index 94ff7d8ed6ea..9fc69973e6b0 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName} + /// + /// + /// Operation Id + /// Bots_Get + /// + /// + /// + /// The name of the Bot 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _botClientDiagnostics.CreateScope("BotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _botRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BotResource(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.BotService/botServices/{resourceName} + /// + /// + /// Operation Id + /// Bots_Get + /// + /// + /// + /// The name of the Bot resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _botClientDiagnostics.CreateScope("BotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _botRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingCollection.cs index 72f4cf3ae6b7..1730c98b0b2b 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName} + /// + /// + /// Operation Id + /// BotConnection_Get + /// + /// + /// + /// The name of the Bot Service Connection Setting 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 connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _botConnectionSettingBotConnectionClientDiagnostics.CreateScope("BotConnectionSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _botConnectionSettingBotConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BotConnectionSettingResource(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.BotService/botServices/{resourceName}/connections/{connectionName} + /// + /// + /// Operation Id + /// BotConnection_Get + /// + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _botConnectionSettingBotConnectionClientDiagnostics.CreateScope("BotConnectionSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _botConnectionSettingBotConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BotConnectionSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionCollection.cs index 2ef5b4236fc9..07104d73ad58 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _botServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("BotServicePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _botServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BotServicePrivateEndpointConnectionResource(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.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _botServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("BotServicePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _botServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BotServicePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnCustomDomainCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnCustomDomainCollection.cs index 1f022b68dfb4..24cf153751af 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnCustomDomainCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnCustomDomainCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_CustomDomainsGet() Console.WriteLine($"Succeeded: {result}"); } + // CustomDomains_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CustomDomainsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_Get.json + // this example is just showing the usage of "CdnCustomDomains_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 CdnEndpointResource created on azure + // for more information of creating CdnEndpointResource, please refer to the document of CdnEndpointResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + string endpointName = "endpoint1"; + ResourceIdentifier cdnEndpointResourceId = CdnEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName, endpointName); + CdnEndpointResource cdnEndpoint = client.GetCdnEndpointResource(cdnEndpointResourceId); + + // get the collection of this CdnCustomDomainResource + CdnCustomDomainCollection collection = cdnEndpoint.GetCdnCustomDomains(); + + // invoke the operation + string customDomainName = "www-someDomain-net"; + NullableResponse response = await collection.GetIfExistsAsync(customDomainName); + CdnCustomDomainResource 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 + CdnCustomDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CustomDomains_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnEndpointCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnEndpointCollection.cs index cde2344d92b7..8c608bdeb4b0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnEndpointCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnEndpointCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_EndpointsGet() Console.WriteLine($"Succeeded: {result}"); } + // Endpoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EndpointsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Get.json + // this example is just showing the usage of "CdnEndpoints_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 ProfileResource created on azure + // for more information of creating ProfileResource, please refer to the document of ProfileResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + ResourceIdentifier profileResourceId = ProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + ProfileResource profile = client.GetProfileResource(profileResourceId); + + // get the collection of this CdnEndpointResource + CdnEndpointCollection collection = profile.GetCdnEndpoints(); + + // invoke the operation + string endpointName = "endpoint1"; + NullableResponse response = await collection.GetIfExistsAsync(endpointName); + CdnEndpointResource 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 + CdnEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Endpoints_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnOriginCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnOriginCollection.cs index 3f50cd2b9bed..c9d4a8e5e401 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnOriginCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnOriginCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_OriginsGet() Console.WriteLine($"Succeeded: {result}"); } + // Origins_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_OriginsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_Get.json + // this example is just showing the usage of "CdnOrigins_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 CdnEndpointResource created on azure + // for more information of creating CdnEndpointResource, please refer to the document of CdnEndpointResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + string endpointName = "endpoint1"; + ResourceIdentifier cdnEndpointResourceId = CdnEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName, endpointName); + CdnEndpointResource cdnEndpoint = client.GetCdnEndpointResource(cdnEndpointResourceId); + + // get the collection of this CdnOriginResource + CdnOriginCollection collection = cdnEndpoint.GetCdnOrigins(); + + // invoke the operation + string originName = "www-someDomain-net"; + NullableResponse response = await collection.GetIfExistsAsync(originName); + CdnOriginResource 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 + CdnOriginData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Origins_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnOriginGroupCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnOriginGroupCollection.cs index 943410b474a0..0857b2e4fd1e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnOriginGroupCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnOriginGroupCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_OriginGroupsGet() Console.WriteLine($"Succeeded: {result}"); } + // OriginGroups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_OriginGroupsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_Get.json + // this example is just showing the usage of "CdnOriginGroups_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 CdnEndpointResource created on azure + // for more information of creating CdnEndpointResource, please refer to the document of CdnEndpointResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + string endpointName = "endpoint1"; + ResourceIdentifier cdnEndpointResourceId = CdnEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName, endpointName); + CdnEndpointResource cdnEndpoint = client.GetCdnEndpointResource(cdnEndpointResourceId); + + // get the collection of this CdnOriginGroupResource + CdnOriginGroupCollection collection = cdnEndpoint.GetCdnOriginGroups(); + + // invoke the operation + string originGroupName = "originGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(originGroupName); + CdnOriginGroupResource 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 + CdnOriginGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // OriginGroups_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnWebApplicationFirewallPolicyCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnWebApplicationFirewallPolicyCollection.cs index 3a485ab9ffac..e9d8acb5c1c3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnWebApplicationFirewallPolicyCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_CdnWebApplicationFirewallPolicyCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get Policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPolicy() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/WafPolicyGet.json + // this example is just showing the usage of "Policies_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CdnWebApplicationFirewallPolicyResource + CdnWebApplicationFirewallPolicyCollection collection = resourceGroupResource.GetCdnWebApplicationFirewallPolicies(); + + // invoke the operation + string policyName = "MicrosoftCdnWafPolicy"; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + CdnWebApplicationFirewallPolicyResource 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 + CdnWebApplicationFirewallPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates specific policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorCustomDomainCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorCustomDomainCollection.cs index 4a4d29787a0e..0f6b536037b6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorCustomDomainCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorCustomDomainCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_AFDCustomDomainsGet() Console.WriteLine($"Succeeded: {result}"); } + // AFDCustomDomains_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AFDCustomDomainsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_Get.json + // this example is just showing the usage of "FrontDoorCustomDomains_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 ProfileResource created on azure + // for more information of creating ProfileResource, please refer to the document of ProfileResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + ResourceIdentifier profileResourceId = ProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + ProfileResource profile = client.GetProfileResource(profileResourceId); + + // get the collection of this FrontDoorCustomDomainResource + FrontDoorCustomDomainCollection collection = profile.GetFrontDoorCustomDomains(); + + // invoke the operation + string customDomainName = "domain1"; + NullableResponse response = await collection.GetIfExistsAsync(customDomainName); + FrontDoorCustomDomainResource 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 + FrontDoorCustomDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AFDCustomDomains_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorEndpointCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorEndpointCollection.cs index 2f02ddbaa92f..75f7ce3bf22b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorEndpointCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorEndpointCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_AFDEndpointsGet() Console.WriteLine($"Succeeded: {result}"); } + // AFDEndpoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AFDEndpointsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_Get.json + // this example is just showing the usage of "FrontDoorEndpoints_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 ProfileResource created on azure + // for more information of creating ProfileResource, please refer to the document of ProfileResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + ResourceIdentifier profileResourceId = ProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + ProfileResource profile = client.GetProfileResource(profileResourceId); + + // get the collection of this FrontDoorEndpointResource + FrontDoorEndpointCollection collection = profile.GetFrontDoorEndpoints(); + + // invoke the operation + string endpointName = "endpoint1"; + NullableResponse response = await collection.GetIfExistsAsync(endpointName); + FrontDoorEndpointResource 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 + FrontDoorEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AFDEndpoints_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorOriginCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorOriginCollection.cs index fd0ba8f0295d..baa6e909a620 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorOriginCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorOriginCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_AFDOriginsGet() Console.WriteLine($"Succeeded: {result}"); } + // AFDOrigins_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AFDOriginsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_Get.json + // this example is just showing the usage of "FrontDoorOrigins_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 FrontDoorOriginGroupResource created on azure + // for more information of creating FrontDoorOriginGroupResource, please refer to the document of FrontDoorOriginGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + string originGroupName = "origingroup1"; + ResourceIdentifier frontDoorOriginGroupResourceId = FrontDoorOriginGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName, originGroupName); + FrontDoorOriginGroupResource frontDoorOriginGroup = client.GetFrontDoorOriginGroupResource(frontDoorOriginGroupResourceId); + + // get the collection of this FrontDoorOriginResource + FrontDoorOriginCollection collection = frontDoorOriginGroup.GetFrontDoorOrigins(); + + // invoke the operation + string originName = "origin1"; + NullableResponse response = await collection.GetIfExistsAsync(originName); + FrontDoorOriginResource 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 + FrontDoorOriginData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AFDOrigins_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorOriginGroupCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorOriginGroupCollection.cs index 2444f1578090..6852ae4d31ad 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorOriginGroupCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorOriginGroupCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_AFDOriginGroupsGet() Console.WriteLine($"Succeeded: {result}"); } + // AFDOriginGroups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AFDOriginGroupsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_Get.json + // this example is just showing the usage of "FrontDoorOriginGroups_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 ProfileResource created on azure + // for more information of creating ProfileResource, please refer to the document of ProfileResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + ResourceIdentifier profileResourceId = ProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + ProfileResource profile = client.GetProfileResource(profileResourceId); + + // get the collection of this FrontDoorOriginGroupResource + FrontDoorOriginGroupCollection collection = profile.GetFrontDoorOriginGroups(); + + // invoke the operation + string originGroupName = "origingroup1"; + NullableResponse response = await collection.GetIfExistsAsync(originGroupName); + FrontDoorOriginGroupResource 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 + FrontDoorOriginGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AFDOriginGroups_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRouteCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRouteCollection.cs index 176246fb0c69..b070091da3cf 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRouteCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRouteCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_RoutesGet() Console.WriteLine($"Succeeded: {result}"); } + // Routes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RoutesGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_Get.json + // this example is just showing the usage of "FrontDoorRoutes_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 FrontDoorEndpointResource created on azure + // for more information of creating FrontDoorEndpointResource, please refer to the document of FrontDoorEndpointResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + string endpointName = "endpoint1"; + ResourceIdentifier frontDoorEndpointResourceId = FrontDoorEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName, endpointName); + FrontDoorEndpointResource frontDoorEndpoint = client.GetFrontDoorEndpointResource(frontDoorEndpointResourceId); + + // get the collection of this FrontDoorRouteResource + FrontDoorRouteCollection collection = frontDoorEndpoint.GetFrontDoorRoutes(); + + // invoke the operation + string routeName = "route1"; + NullableResponse response = await collection.GetIfExistsAsync(routeName); + FrontDoorRouteResource 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 + FrontDoorRouteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Routes_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRuleCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRuleCollection.cs index 4deb542f1d59..f9384bedc0e7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRuleCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRuleCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_RulesGet() Console.WriteLine($"Succeeded: {result}"); } + // Rules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RulesGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_Get.json + // this example is just showing the usage of "FrontDoorRules_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 FrontDoorRuleSetResource created on azure + // for more information of creating FrontDoorRuleSetResource, please refer to the document of FrontDoorRuleSetResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + string ruleSetName = "ruleSet1"; + ResourceIdentifier frontDoorRuleSetResourceId = FrontDoorRuleSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName, ruleSetName); + FrontDoorRuleSetResource frontDoorRuleSet = client.GetFrontDoorRuleSetResource(frontDoorRuleSetResourceId); + + // get the collection of this FrontDoorRuleResource + FrontDoorRuleCollection collection = frontDoorRuleSet.GetFrontDoorRules(); + + // invoke the operation + string ruleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + FrontDoorRuleResource 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 + FrontDoorRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Rules_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRuleSetCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRuleSetCollection.cs index 86baa495546a..5ccbae2daed5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRuleSetCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorRuleSetCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_RuleSetsGet() Console.WriteLine($"Succeeded: {result}"); } + // RuleSets_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RuleSetsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_Get.json + // this example is just showing the usage of "FrontDoorRuleSets_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 ProfileResource created on azure + // for more information of creating ProfileResource, please refer to the document of ProfileResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + ResourceIdentifier profileResourceId = ProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + ProfileResource profile = client.GetProfileResource(profileResourceId); + + // get the collection of this FrontDoorRuleSetResource + FrontDoorRuleSetCollection collection = profile.GetFrontDoorRuleSets(); + + // invoke the operation + string ruleSetName = "ruleSet1"; + NullableResponse response = await collection.GetIfExistsAsync(ruleSetName); + FrontDoorRuleSetResource 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 + FrontDoorRuleSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RuleSets_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorSecretCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorSecretCollection.cs index 36452b7e457c..e71144544650 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorSecretCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorSecretCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_SecretsGet() Console.WriteLine($"Succeeded: {result}"); } + // Secrets_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SecretsGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Secrets_Get.json + // this example is just showing the usage of "FrontDoorSecrets_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 ProfileResource created on azure + // for more information of creating ProfileResource, please refer to the document of ProfileResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + ResourceIdentifier profileResourceId = ProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + ProfileResource profile = client.GetProfileResource(profileResourceId); + + // get the collection of this FrontDoorSecretResource + FrontDoorSecretCollection collection = profile.GetFrontDoorSecrets(); + + // invoke the operation + string secretName = "secret1"; + NullableResponse response = await collection.GetIfExistsAsync(secretName); + FrontDoorSecretResource 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 + FrontDoorSecretData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Secrets_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorSecurityPolicyCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorSecurityPolicyCollection.cs index 6de505f9cfe4..6461d74c7c54 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorSecurityPolicyCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_FrontDoorSecurityPolicyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_SecurityPoliciesGet() Console.WriteLine($"Succeeded: {result}"); } + // SecurityPolicies_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SecurityPoliciesGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_Get.json + // this example is just showing the usage of "FrontDoorSecurityPolicies_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 ProfileResource created on azure + // for more information of creating ProfileResource, please refer to the document of ProfileResource + string subscriptionId = "subid"; + string resourceGroupName = "RG"; + string profileName = "profile1"; + ResourceIdentifier profileResourceId = ProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + ProfileResource profile = client.GetProfileResource(profileResourceId); + + // get the collection of this FrontDoorSecurityPolicyResource + FrontDoorSecurityPolicyCollection collection = profile.GetFrontDoorSecurityPolicies(); + + // invoke the operation + string securityPolicyName = "securityPolicy1"; + NullableResponse response = await collection.GetIfExistsAsync(securityPolicyName); + FrontDoorSecurityPolicyResource 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 + FrontDoorSecurityPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SecurityPolicies_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_ProfileCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_ProfileCollection.cs index 1ce50059df23..fe409848f39f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_ProfileCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/samples/Generated/Samples/Sample_ProfileCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_ProfilesGet() Console.WriteLine($"Succeeded: {result}"); } + // Profiles_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProfilesGet() + { + // Generated from example definition: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_Get.json + // this example is just showing the usage of "Profiles_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 = "subid"; + string resourceGroupName = "RG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ProfileResource + ProfileCollection collection = resourceGroupResource.GetProfiles(); + + // invoke the operation + string profileName = "profile1"; + NullableResponse response = await collection.GetIfExistsAsync(profileName); + ProfileResource 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 + ProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Profiles_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainCollection.cs index f3f0562b2e6e..c9ce58e35221 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string customDomainName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName} + /// + /// + /// Operation Id + /// CdnCustomDomains_Get + /// + /// + /// + /// Name of the custom domain within an endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string customDomainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customDomainName, nameof(customDomainName)); + + using var scope = _cdnCustomDomainClientDiagnostics.CreateScope("CdnCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cdnCustomDomainRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnCustomDomainResource(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.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName} + /// + /// + /// Operation Id + /// CdnCustomDomains_Get + /// + /// + /// + /// Name of the custom domain within an endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string customDomainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customDomainName, nameof(customDomainName)); + + using var scope = _cdnCustomDomainClientDiagnostics.CreateScope("CdnCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cdnCustomDomainRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnCustomDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointCollection.cs index b5abe7d63ef5..dcf94abbb259 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string endpointName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName} + /// + /// + /// Operation Id + /// CdnEndpoints_Get + /// + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _cdnEndpointClientDiagnostics.CreateScope("CdnEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cdnEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnEndpointResource(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.Cdn/profiles/{profileName}/endpoints/{endpointName} + /// + /// + /// Operation Id + /// CdnEndpoints_Get + /// + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _cdnEndpointClientDiagnostics.CreateScope("CdnEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cdnEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginCollection.cs index e5467e558c36..be4fc808a9b3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string originName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName} + /// + /// + /// Operation Id + /// CdnOrigins_Get + /// + /// + /// + /// Name of the origin which is unique within the endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string originName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(originName, nameof(originName)); + + using var scope = _cdnOriginClientDiagnostics.CreateScope("CdnOriginCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cdnOriginRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnOriginResource(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.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName} + /// + /// + /// Operation Id + /// CdnOrigins_Get + /// + /// + /// + /// Name of the origin which is unique within the endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string originName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(originName, nameof(originName)); + + using var scope = _cdnOriginClientDiagnostics.CreateScope("CdnOriginCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cdnOriginRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnOriginResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupCollection.cs index 6c21ed1514bc..482e6d0952d1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string originGroupName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName} + /// + /// + /// Operation Id + /// CdnOriginGroups_Get + /// + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string originGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(originGroupName, nameof(originGroupName)); + + using var scope = _cdnOriginGroupClientDiagnostics.CreateScope("CdnOriginGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cdnOriginGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnOriginGroupResource(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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName} + /// + /// + /// Operation Id + /// CdnOriginGroups_Get + /// + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string originGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(originGroupName, nameof(originGroupName)); + + using var scope = _cdnOriginGroupClientDiagnostics.CreateScope("CdnOriginGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cdnOriginGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnOriginGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyCollection.cs index 282fdc656fdf..5711560d4f5e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string policyName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _cdnWebApplicationFirewallPolicyPoliciesClientDiagnostics.CreateScope("CdnWebApplicationFirewallPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cdnWebApplicationFirewallPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnWebApplicationFirewallPolicyResource(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.Cdn/cdnWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _cdnWebApplicationFirewallPolicyPoliciesClientDiagnostics.CreateScope("CdnWebApplicationFirewallPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cdnWebApplicationFirewallPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CdnWebApplicationFirewallPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainCollection.cs index c9f48b5702c0..40084b226b59 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string customDomainName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName} + /// + /// + /// Operation Id + /// FrontDoorCustomDomains_Get + /// + /// + /// + /// Name of the domain under the profile which is unique globally. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string customDomainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customDomainName, nameof(customDomainName)); + + using var scope = _frontDoorCustomDomainClientDiagnostics.CreateScope("FrontDoorCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorCustomDomainRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, customDomainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorCustomDomainResource(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.Cdn/profiles/{profileName}/customDomains/{customDomainName} + /// + /// + /// Operation Id + /// FrontDoorCustomDomains_Get + /// + /// + /// + /// Name of the domain under the profile which is unique globally. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string customDomainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customDomainName, nameof(customDomainName)); + + using var scope = _frontDoorCustomDomainClientDiagnostics.CreateScope("FrontDoorCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorCustomDomainRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, customDomainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorCustomDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointCollection.cs index 283ad903c1f5..49a15ecc1d05 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string endpointName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName} + /// + /// + /// Operation Id + /// FrontDoorEndpoints_Get + /// + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _frontDoorEndpointClientDiagnostics.CreateScope("FrontDoorEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorEndpointResource(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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName} + /// + /// + /// Operation Id + /// FrontDoorEndpoints_Get + /// + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _frontDoorEndpointClientDiagnostics.CreateScope("FrontDoorEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginCollection.cs index ae917e0ae579..3ec85fa3c92e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string originName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName} + /// + /// + /// Operation Id + /// FrontDoorOrigins_Get + /// + /// + /// + /// Name of the origin which is unique within the profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string originName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(originName, nameof(originName)); + + using var scope = _frontDoorOriginClientDiagnostics.CreateScope("FrontDoorOriginCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorOriginRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorOriginResource(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.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName} + /// + /// + /// Operation Id + /// FrontDoorOrigins_Get + /// + /// + /// + /// Name of the origin which is unique within the profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string originName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(originName, nameof(originName)); + + using var scope = _frontDoorOriginClientDiagnostics.CreateScope("FrontDoorOriginCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorOriginRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorOriginResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupCollection.cs index 2d412bc48e26..5de872d9c49e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string originGroupName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName} + /// + /// + /// Operation Id + /// FrontDoorOriginGroups_Get + /// + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string originGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(originGroupName, nameof(originGroupName)); + + using var scope = _frontDoorOriginGroupClientDiagnostics.CreateScope("FrontDoorOriginGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorOriginGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, originGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorOriginGroupResource(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.Cdn/profiles/{profileName}/originGroups/{originGroupName} + /// + /// + /// Operation Id + /// FrontDoorOriginGroups_Get + /// + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string originGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(originGroupName, nameof(originGroupName)); + + using var scope = _frontDoorOriginGroupClientDiagnostics.CreateScope("FrontDoorOriginGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorOriginGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, originGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorOriginGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteCollection.cs index a14876299438..40986aacfd90 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string routeName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName} + /// + /// + /// Operation Id + /// FrontDoorRoutes_Get + /// + /// + /// + /// Name of the routing rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeName, nameof(routeName)); + + using var scope = _frontDoorRouteClientDiagnostics.CreateScope("FrontDoorRouteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorRouteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, routeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorRouteResource(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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName} + /// + /// + /// Operation Id + /// FrontDoorRoutes_Get + /// + /// + /// + /// Name of the routing rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeName, nameof(routeName)); + + using var scope = _frontDoorRouteClientDiagnostics.CreateScope("FrontDoorRouteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorRouteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, routeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorRouteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleCollection.cs index f4156417bf11..c9685637cfab 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName} + /// + /// + /// Operation Id + /// FrontDoorRules_Get + /// + /// + /// + /// Name of the delivery rule which is unique within the endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _frontDoorRuleClientDiagnostics.CreateScope("FrontDoorRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorRuleResource(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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName} + /// + /// + /// Operation Id + /// FrontDoorRules_Get + /// + /// + /// + /// Name of the delivery rule which is unique within the endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _frontDoorRuleClientDiagnostics.CreateScope("FrontDoorRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetCollection.cs index 09e465225e48..0a8da41340ad 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetCollection.cs @@ -319,6 +319,80 @@ public virtual Response Exists(string ruleSetName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName} + /// + /// + /// Operation Id + /// FrontDoorRuleSets_Get + /// + /// + /// + /// Name of the rule set under the profile which is unique globally. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _frontDoorRuleSetClientDiagnostics.CreateScope("FrontDoorRuleSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorRuleSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorRuleSetResource(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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName} + /// + /// + /// Operation Id + /// FrontDoorRuleSets_Get + /// + /// + /// + /// Name of the rule set under the profile which is unique globally. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _frontDoorRuleSetClientDiagnostics.CreateScope("FrontDoorRuleSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorRuleSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorRuleSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretCollection.cs index e3119e341283..3d0a38382cfb 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string secretName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName} + /// + /// + /// Operation Id + /// FrontDoorSecrets_Get + /// + /// + /// + /// Name of the Secret under the profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string secretName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); + + using var scope = _frontDoorSecretClientDiagnostics.CreateScope("FrontDoorSecretCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorSecretRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorSecretResource(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.Cdn/profiles/{profileName}/secrets/{secretName} + /// + /// + /// Operation Id + /// FrontDoorSecrets_Get + /// + /// + /// + /// Name of the Secret under the profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string secretName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); + + using var scope = _frontDoorSecretClientDiagnostics.CreateScope("FrontDoorSecretCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorSecretRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorSecretResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyCollection.cs index 0e5430ae5e17..5303ab052aa3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string securityPolicyName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName} + /// + /// + /// Operation Id + /// FrontDoorSecurityPolicies_Get + /// + /// + /// + /// Name of the security policy under the profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string securityPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityPolicyName, nameof(securityPolicyName)); + + using var scope = _frontDoorSecurityPolicyClientDiagnostics.CreateScope("FrontDoorSecurityPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontDoorSecurityPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorSecurityPolicyResource(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.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName} + /// + /// + /// Operation Id + /// FrontDoorSecurityPolicies_Get + /// + /// + /// + /// Name of the security policy under the profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string securityPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityPolicyName, nameof(securityPolicyName)); + + using var scope = _frontDoorSecurityPolicyClientDiagnostics.CreateScope("FrontDoorSecurityPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontDoorSecurityPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontDoorSecurityPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileCollection.cs index b42e9ed370e2..0855c16afa65 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string profileName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string profileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); + + using var scope = _profileClientDiagnostics.CreateScope("ProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _profileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, profileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProfileResource(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.Cdn/profiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string profileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); + + using var scope = _profileClientDiagnostics.CreateScope("ProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _profileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, profileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_CapabilityCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_CapabilityCollection.cs index 9450ab2b1b94..35d8ed53e233 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_CapabilityCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_CapabilityCollection.cs @@ -129,6 +129,52 @@ public async Task Exists_GetACapabilityThatExtendsAVirtualMachineTargetResource( Console.WriteLine($"Succeeded: {result}"); } + // Get a Capability that extends a virtual machine Target resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACapabilityThatExtendsAVirtualMachineTargetResource() + { + // Generated from example definition: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapability.json + // this example is just showing the usage of "Capabilities_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 TargetResource created on azure + // for more information of creating TargetResource, please refer to the document of TargetResource + string subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291"; + string resourceGroupName = "exampleRG"; + string parentProviderNamespace = "Microsoft.Compute"; + string parentResourceType = "virtualMachines"; + string parentResourceName = "exampleVM"; + string targetName = "Microsoft-VirtualMachine"; + ResourceIdentifier targetResourceId = TargetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName); + TargetResource target = client.GetTargetResource(targetResourceId); + + // get the collection of this CapabilityResource + CapabilityCollection collection = target.GetCapabilities(); + + // invoke the operation + string capabilityName = "Shutdown-1.0"; + NullableResponse response = await collection.GetIfExistsAsync(capabilityName); + CapabilityResource 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 + CapabilityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create/update a Capability that extends a virtual machine Target resource. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_CapabilityTypeCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_CapabilityTypeCollection.cs index de2f59c55954..0f390accb10c 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_CapabilityTypeCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_CapabilityTypeCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetACapabilityTypeForAVirtualMachineTargetResourceOnWes Console.WriteLine($"Succeeded: {result}"); } + + // Get a Capability Type for a virtual machine Target resource on westus2 location. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location() + { + // Generated from example definition: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapabilityType.json + // this example is just showing the usage of "CapabilityTypes_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 TargetTypeResource created on azure + // for more information of creating TargetTypeResource, please refer to the document of TargetTypeResource + string subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291"; + string locationName = "westus2"; + string targetTypeName = "Microsoft-VirtualMachine"; + ResourceIdentifier targetTypeResourceId = TargetTypeResource.CreateResourceIdentifier(subscriptionId, locationName, targetTypeName); + TargetTypeResource targetType = client.GetTargetTypeResource(targetTypeResourceId); + + // get the collection of this CapabilityTypeResource + CapabilityTypeCollection collection = targetType.GetCapabilityTypes(); + + // invoke the operation + string capabilityTypeName = "Shutdown-1.0"; + NullableResponse response = await collection.GetIfExistsAsync(capabilityTypeName); + CapabilityTypeResource 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 + CapabilityTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentCollection.cs index d98c772cc648..3a1f630da64a 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentCollection.cs @@ -122,6 +122,48 @@ public async Task Exists_GetAExperimentInAResourceGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get a Experiment in a resource group. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAExperimentInAResourceGroup() + { + // Generated from example definition: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperiment.json + // this example is just showing the usage of "Experiments_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 = "6b052e15-03d3-4f17-b2e1-be7f07588291"; + string resourceGroupName = "exampleRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ExperimentResource + ExperimentCollection collection = resourceGroupResource.GetExperiments(); + + // invoke the operation + string experimentName = "exampleExperiment"; + NullableResponse response = await collection.GetIfExistsAsync(experimentName); + ExperimentResource 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 + ExperimentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create/update a Experiment in a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentExecutionDetailCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentExecutionDetailCollection.cs index 20b739ec6f69..1b19ef001b54 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentExecutionDetailCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentExecutionDetailCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetExperimentExecutionDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Get experiment execution details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExperimentExecutionDetails() + { + // Generated from example definition: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentExecutionDetails.json + // this example is just showing the usage of "Experiments_GetExecutionDetails" 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 ExperimentResource created on azure + // for more information of creating ExperimentResource, please refer to the document of ExperimentResource + string subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291"; + string resourceGroupName = "exampleRG"; + string experimentName = "exampleExperiment"; + ResourceIdentifier experimentResourceId = ExperimentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, experimentName); + ExperimentResource experiment = client.GetExperimentResource(experimentResourceId); + + // get the collection of this ExperimentExecutionDetailResource + ExperimentExecutionDetailCollection collection = experiment.GetExperimentExecutionDetails(); + + // invoke the operation + string executionDetailsId = "f24500ad-744e-4a26-864b-b76199eac333"; + NullableResponse response = await collection.GetIfExistsAsync(executionDetailsId); + ExperimentExecutionDetailResource 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 + ExperimentExecutionDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentStatusCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentStatusCollection.cs index 5ef03faf8c6c..191002e91158 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentStatusCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_ExperimentStatusCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetTheStatusOfAExperiment() Console.WriteLine($"Succeeded: {result}"); } + + // Get the status of a Experiment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheStatusOfAExperiment() + { + // Generated from example definition: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentStatus.json + // this example is just showing the usage of "Experiments_GetStatus" 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 ExperimentResource created on azure + // for more information of creating ExperimentResource, please refer to the document of ExperimentResource + string subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291"; + string resourceGroupName = "exampleRG"; + string experimentName = "exampleExperiment"; + ResourceIdentifier experimentResourceId = ExperimentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, experimentName); + ExperimentResource experiment = client.GetExperimentResource(experimentResourceId); + + // get the collection of this ExperimentStatusResource + ExperimentStatusCollection collection = experiment.GetExperimentStatuses(); + + // invoke the operation + string statusId = "50734542-2e64-4e08-814c-cc0e7475f7e4"; + NullableResponse response = await collection.GetIfExistsAsync(statusId); + ExperimentStatusResource 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 + ExperimentStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_TargetCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_TargetCollection.cs index f171bff93712..45a5fc7c0a5c 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_TargetCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_TargetCollection.cs @@ -129,6 +129,51 @@ public async Task Exists_GetATargetThatExtendsAVirtualMachineResource() Console.WriteLine($"Succeeded: {result}"); } + // Get a Target that extends a virtual machine resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetATargetThatExtendsAVirtualMachineResource() + { + // Generated from example definition: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATarget.json + // this example is just showing the usage of "Targets_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 = "6b052e15-03d3-4f17-b2e1-be7f07588291"; + string resourceGroupName = "exampleRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this TargetResource + string parentProviderNamespace = "Microsoft.Compute"; + string parentResourceType = "virtualMachines"; + string parentResourceName = "exampleVM"; + TargetCollection collection = resourceGroupResource.GetTargets(parentProviderNamespace, parentResourceType, parentResourceName); + + // invoke the operation + string targetName = "Microsoft-Agent"; + NullableResponse response = await collection.GetIfExistsAsync(targetName); + TargetResource 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 + TargetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create/update a Target that extends a virtual machine resource. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_TargetTypeCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_TargetTypeCollection.cs index e5c5c15c76df..08fdc15f8b4c 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_TargetTypeCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/samples/Generated/Samples/Sample_TargetTypeCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -117,5 +118,47 @@ public async Task Exists_GetATargetTypeForWestus2Location() Console.WriteLine($"Succeeded: {result}"); } + + // Get a Target Type for westus2 location + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetATargetTypeForWestus2Location() + { + // Generated from example definition: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATargetType.json + // this example is just showing the usage of "TargetTypes_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this TargetTypeResource + string locationName = "westus2"; + TargetTypeCollection collection = subscriptionResource.GetTargetTypes(locationName); + + // invoke the operation + string targetTypeName = "Microsoft-Agent"; + NullableResponse response = await collection.GetIfExistsAsync(targetTypeName); + TargetTypeResource 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 + TargetTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityCollection.cs index 78425fc19442..c13f033bd954 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string capabilityName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName} + /// + /// + /// Operation Id + /// Capabilities_Get + /// + /// + /// + /// String that represents a Capability resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string capabilityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilityName, nameof(capabilityName)); + + using var scope = _capabilityClientDiagnostics.CreateScope("CapabilityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _capabilityRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, capabilityName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapabilityResource(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/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName} + /// + /// + /// Operation Id + /// Capabilities_Get + /// + /// + /// + /// String that represents a Capability resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string capabilityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilityName, nameof(capabilityName)); + + using var scope = _capabilityClientDiagnostics.CreateScope("CapabilityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _capabilityRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, capabilityName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapabilityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeCollection.cs index ad415b1235cf..e0a9159b497b 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string capabilityTypeName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName} + /// + /// + /// Operation Id + /// CapabilityTypes_Get + /// + /// + /// + /// String that represents a Capability Type resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string capabilityTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilityTypeName, nameof(capabilityTypeName)); + + using var scope = _capabilityTypeClientDiagnostics.CreateScope("CapabilityTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _capabilityTypeRestClient.GetAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, capabilityTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapabilityTypeResource(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}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName} + /// + /// + /// Operation Id + /// CapabilityTypes_Get + /// + /// + /// + /// String that represents a Capability Type resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string capabilityTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilityTypeName, nameof(capabilityTypeName)); + + using var scope = _capabilityTypeClientDiagnostics.CreateScope("CapabilityTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _capabilityTypeRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, capabilityTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapabilityTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentCollection.cs index cf2d28ccdd0b..fb216ec01d24 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string experimentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName} + /// + /// + /// Operation Id + /// Experiments_Get + /// + /// + /// + /// String that represents a Experiment resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string experimentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(experimentName, nameof(experimentName)); + + using var scope = _experimentClientDiagnostics.CreateScope("ExperimentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _experimentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, experimentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExperimentResource(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.Chaos/experiments/{experimentName} + /// + /// + /// Operation Id + /// Experiments_Get + /// + /// + /// + /// String that represents a Experiment resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string experimentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(experimentName, nameof(experimentName)); + + using var scope = _experimentClientDiagnostics.CreateScope("ExperimentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _experimentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, experimentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExperimentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailCollection.cs index 195ad0a3e089..b682a4ad5f35 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string executionDetailsId, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId} + /// + /// + /// Operation Id + /// Experiments_GetExecutionDetails + /// + /// + /// + /// GUID that represents a Experiment execution detail. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string executionDetailsId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(executionDetailsId, nameof(executionDetailsId)); + + using var scope = _experimentExecutionDetailExperimentsClientDiagnostics.CreateScope("ExperimentExecutionDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _experimentExecutionDetailExperimentsRestClient.GetExecutionDetailsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, executionDetailsId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExperimentExecutionDetailResource(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.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId} + /// + /// + /// Operation Id + /// Experiments_GetExecutionDetails + /// + /// + /// + /// GUID that represents a Experiment execution detail. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string executionDetailsId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(executionDetailsId, nameof(executionDetailsId)); + + using var scope = _experimentExecutionDetailExperimentsClientDiagnostics.CreateScope("ExperimentExecutionDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = _experimentExecutionDetailExperimentsRestClient.GetExecutionDetails(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, executionDetailsId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExperimentExecutionDetailResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusCollection.cs index acf5ece7b556..40a3a6e61860 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string statusId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId} + /// + /// + /// Operation Id + /// Experiments_GetStatus + /// + /// + /// + /// GUID that represents a Experiment status. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string statusId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(statusId, nameof(statusId)); + + using var scope = _experimentStatusExperimentsClientDiagnostics.CreateScope("ExperimentStatusCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _experimentStatusExperimentsRestClient.GetStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, statusId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExperimentStatusResource(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.Chaos/experiments/{experimentName}/statuses/{statusId} + /// + /// + /// Operation Id + /// Experiments_GetStatus + /// + /// + /// + /// GUID that represents a Experiment status. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string statusId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(statusId, nameof(statusId)); + + using var scope = _experimentStatusExperimentsClientDiagnostics.CreateScope("ExperimentStatusCollection.GetIfExists"); + scope.Start(); + try + { + var response = _experimentStatusExperimentsRestClient.GetStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, statusId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExperimentStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetCollection.cs index 80e1ff780654..93a2cdc96573 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetCollection.cs @@ -337,6 +337,80 @@ public virtual Response Exists(string targetName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName} + /// + /// + /// Operation Id + /// Targets_Get + /// + /// + /// + /// String that represents a Target resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var scope = _targetClientDiagnostics.CreateScope("TargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _targetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _parentProviderNamespace, _parentResourceType, _parentResourceName, targetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TargetResource(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/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName} + /// + /// + /// Operation Id + /// Targets_Get + /// + /// + /// + /// String that represents a Target resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var scope = _targetClientDiagnostics.CreateScope("TargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _targetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _parentProviderNamespace, _parentResourceType, _parentResourceName, targetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TargetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeCollection.cs index 4997ec1c6af2..a39e69cb56df 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeCollection.cs @@ -249,6 +249,80 @@ public virtual Response Exists(string targetTypeName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName} + /// + /// + /// Operation Id + /// TargetTypes_Get + /// + /// + /// + /// String that represents a Target Type resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string targetTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetTypeName, nameof(targetTypeName)); + + using var scope = _targetTypeClientDiagnostics.CreateScope("TargetTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _targetTypeRestClient.GetAsync(Id.SubscriptionId, _locationName, targetTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TargetTypeResource(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}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName} + /// + /// + /// Operation Id + /// TargetTypes_Get + /// + /// + /// + /// String that represents a Target Type resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string targetTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetTypeName, nameof(targetTypeName)); + + using var scope = _targetTypeClientDiagnostics.CreateScope("TargetTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _targetTypeRestClient.Get(Id.SubscriptionId, _locationName, targetTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TargetTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountCollection.cs index 09e71f969da0..bea8d68217a3 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountCollection.cs @@ -187,6 +187,48 @@ public async Task Exists_GetAccount() Console.WriteLine($"Succeeded: {result}"); } + // Get Account + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAccount() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetAccount.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 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CognitiveServicesAccountResource + CognitiveServicesAccountCollection collection = resourceGroupResource.GetCognitiveServicesAccounts(); + + // invoke the operation + string accountName = "myAccount"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + CognitiveServicesAccountResource 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 + CognitiveServicesAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Accounts by Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentCollection.cs index 3dfb2a96ebb8..ee867f772376 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetDeployment() Console.WriteLine($"Succeeded: {result}"); } + // GetDeployment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDeployment() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeployment.json + // this example is just showing the usage of "Deployments_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 CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "subscriptionId"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this CognitiveServicesAccountDeploymentResource + CognitiveServicesAccountDeploymentCollection collection = cognitiveServicesAccount.GetCognitiveServicesAccountDeployments(); + + // invoke the operation + string deploymentName = "deploymentName"; + NullableResponse response = await collection.GetIfExistsAsync(deploymentName); + CognitiveServicesAccountDeploymentResource 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 + CognitiveServicesAccountDeploymentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutDeployment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanCollection.cs index 69def87e0bc4..e33766fb87d2 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanCollection.cs @@ -134,6 +134,48 @@ public async Task Exists_GetCommitmentPlan() Console.WriteLine($"Succeeded: {result}"); } + // Get Commitment Plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCommitmentPlan() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlan.json + // this example is just showing the usage of "CommitmentPlans_GetPlan" 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 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CognitiveServicesCommitmentPlanResource + CognitiveServicesCommitmentPlanCollection collection = resourceGroupResource.GetCognitiveServicesCommitmentPlans(); + + // invoke the operation + string commitmentPlanName = "commitmentPlanName"; + NullableResponse response = await collection.GetIfExistsAsync(commitmentPlanName); + CognitiveServicesCommitmentPlanResource 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 + CommitmentPlanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Commitment Plans by Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountCollection.cs index 4053c8ee753b..06144ff0cd04 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,5 +83,48 @@ public async Task Exists_GetAccount() Console.WriteLine($"Succeeded: {result}"); } + + // Get Account + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAccount() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeletedAccount.json + // this example is just showing the usage of "DeletedAccounts_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CognitiveServicesDeletedAccountResource + CognitiveServicesDeletedAccountCollection collection = subscriptionResource.GetCognitiveServicesDeletedAccounts(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + string resourceGroupName = "myResourceGroup"; + string accountName = "myAccount"; + NullableResponse response = await collection.GetIfExistsAsync(location, resourceGroupName, accountName); + CognitiveServicesDeletedAccountResource 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 + CognitiveServicesAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionCollection.cs index ea230bb5c93e..2d76ff2ab24c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + + // GetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpointConnection() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res6977"; + string accountName = "sto2527"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this CognitiveServicesPrivateEndpointConnectionResource + CognitiveServicesPrivateEndpointConnectionCollection collection = cognitiveServicesAccount.GetCognitiveServicesPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "{privateEndpointConnectionName}"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + CognitiveServicesPrivateEndpointConnectionResource 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 + CognitiveServicesPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationCollection.cs index 212425a1ce95..704a0fd33b56 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetCommitmentPlan() Console.WriteLine($"Succeeded: {result}"); } + // GetCommitmentPlan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCommitmentPlan() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlanAssociation.json + // this example is just showing the usage of "CommitmentPlans_GetAssociation" 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 CognitiveServicesCommitmentPlanResource created on azure + // for more information of creating CognitiveServicesCommitmentPlanResource, please refer to the document of CognitiveServicesCommitmentPlanResource + string subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; + string resourceGroupName = "resourceGroupName"; + string commitmentPlanName = "commitmentPlanName"; + ResourceIdentifier cognitiveServicesCommitmentPlanResourceId = CognitiveServicesCommitmentPlanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, commitmentPlanName); + CognitiveServicesCommitmentPlanResource cognitiveServicesCommitmentPlan = client.GetCognitiveServicesCommitmentPlanResource(cognitiveServicesCommitmentPlanResourceId); + + // get the collection of this CommitmentPlanAccountAssociationResource + CommitmentPlanAccountAssociationCollection collection = cognitiveServicesCommitmentPlan.GetCommitmentPlanAccountAssociations(); + + // invoke the operation + string commitmentPlanAssociationName = "commitmentPlanAssociationName"; + NullableResponse response = await collection.GetIfExistsAsync(commitmentPlanAssociationName); + CommitmentPlanAccountAssociationResource 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 + CommitmentPlanAccountAssociationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutCommitmentPlan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanCollection.cs index dadb7cf4a6e4..700444d5315e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetCommitmentPlan() Console.WriteLine($"Succeeded: {result}"); } + // GetCommitmentPlan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCommitmentPlan() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetCommitmentPlan.json + // this example is just showing the usage of "CommitmentPlans_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 CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "subscriptionId"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this CommitmentPlanResource + CommitmentPlanCollection collection = cognitiveServicesAccount.GetCommitmentPlans(); + + // invoke the operation + string commitmentPlanName = "commitmentPlanName"; + NullableResponse response = await collection.GetIfExistsAsync(commitmentPlanName); + CommitmentPlanResource 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 + CommitmentPlanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutCommitmentPlan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs index 28114a871ba5..4c9fd708cb8d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of Cognitive Services 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _cognitiveServicesAccountAccountsClientDiagnostics.CreateScope("CognitiveServicesAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cognitiveServicesAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesAccountResource(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.CognitiveServices/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _cognitiveServicesAccountAccountsClientDiagnostics.CreateScope("CognitiveServicesAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cognitiveServicesAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs index 8178aee1ee59..1912a383b060 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string deploymentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The name of the deployment associated with the Cognitive Services 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 deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cognitiveServicesAccountDeploymentDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesAccountDeploymentResource(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.CognitiveServices/accounts/{accountName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The name of the deployment associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cognitiveServicesAccountDeploymentDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, deploymentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesAccountDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs index dfe1b5fbe3eb..10e7630ca213 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string commitmentPlanName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetPlan + /// + /// + /// + /// The name of the commitmentPlan associated with the Cognitive Services 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 commitmentPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commitmentPlanName, nameof(commitmentPlanName)); + + using var scope = _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics.CreateScope("CognitiveServicesCommitmentPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.GetPlanAsync(Id.SubscriptionId, Id.ResourceGroupName, commitmentPlanName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesCommitmentPlanResource(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.CognitiveServices/commitmentPlans/{commitmentPlanName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetPlan + /// + /// + /// + /// The name of the commitmentPlan associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string commitmentPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commitmentPlanName, nameof(commitmentPlanName)); + + using var scope = _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics.CreateScope("CognitiveServicesCommitmentPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.GetPlan(Id.SubscriptionId, Id.ResourceGroupName, commitmentPlanName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesCommitmentPlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountCollection.cs index 35e83ab7f686..b23a1bba4dce 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountCollection.cs @@ -206,5 +206,85 @@ public virtual Response Exists(AzureLocation location, string resourceGrou throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName} + /// + /// + /// Operation Id + /// DeletedAccounts_Get + /// + /// + /// + /// Resource location. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _cognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics.CreateScope("CognitiveServicesDeletedAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cognitiveServicesDeletedAccountDeletedAccountsRestClient.GetAsync(Id.SubscriptionId, location, resourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesDeletedAccountResource(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}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName} + /// + /// + /// Operation Id + /// DeletedAccounts_Get + /// + /// + /// + /// Resource location. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(AzureLocation location, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _cognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics.CreateScope("CognitiveServicesDeletedAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cognitiveServicesDeletedAccountDeletedAccountsRestClient.Get(Id.SubscriptionId, location, resourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesDeletedAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs index e78bb59c7d75..be9bd88e08b1 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Cognitive Services 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("CognitiveServicesPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesPrivateEndpointConnectionResource(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.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("CognitiveServicesPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CognitiveServicesPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs index 588e9c41f13d..9ab75ce93d30 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string commitmentPlanAssociationName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetAssociation + /// + /// + /// + /// The name of the commitment plan association with the Cognitive Services 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 commitmentPlanAssociationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commitmentPlanAssociationName, nameof(commitmentPlanAssociationName)); + + using var scope = _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics.CreateScope("CommitmentPlanAccountAssociationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _commitmentPlanAccountAssociationCommitmentPlansRestClient.GetAssociationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commitmentPlanAssociationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CommitmentPlanAccountAssociationResource(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.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetAssociation + /// + /// + /// + /// The name of the commitment plan association with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string commitmentPlanAssociationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commitmentPlanAssociationName, nameof(commitmentPlanAssociationName)); + + using var scope = _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics.CreateScope("CommitmentPlanAccountAssociationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _commitmentPlanAccountAssociationCommitmentPlansRestClient.GetAssociation(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commitmentPlanAssociationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CommitmentPlanAccountAssociationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs index 85f095428071..de61c5eaacdd 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string commitmentPlanName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName} + /// + /// + /// Operation Id + /// CommitmentPlans_Get + /// + /// + /// + /// The name of the commitmentPlan associated with the Cognitive Services 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 commitmentPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commitmentPlanName, nameof(commitmentPlanName)); + + using var scope = _commitmentPlanClientDiagnostics.CreateScope("CommitmentPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _commitmentPlanRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commitmentPlanName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CommitmentPlanResource(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.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName} + /// + /// + /// Operation Id + /// CommitmentPlans_Get + /// + /// + /// + /// The name of the commitmentPlan associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string commitmentPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commitmentPlanName, nameof(commitmentPlanName)); + + using var scope = _commitmentPlanClientDiagnostics.CreateScope("CommitmentPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _commitmentPlanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commitmentPlanName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CommitmentPlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); From 6eb7598e37978c7e2bb52b0471a054507700c55a Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 21 Sep 2023 08:45:22 +0000 Subject: [PATCH 5/8] Update SDK codes --- .../Samples/Sample_BlobContainerCollection.cs | 86 ++++ .../Sample_DeletedAccountCollection.cs | 43 ++ .../Sample_EncryptionScopeCollection.cs | 43 ++ .../Samples/Sample_FileShareCollection.cs | 87 ++++ ...ample_ObjectReplicationPolicyCollection.cs | 43 ++ .../Sample_StorageAccountCollection.cs | 168 +++++++ ...ample_StorageAccountLocalUserCollection.cs | 43 ++ ...ragePrivateEndpointConnectionCollection.cs | 43 ++ .../Samples/Sample_StorageQueueCollection.cs | 43 ++ .../Samples/Sample_TableCollection.cs | 43 ++ .../src/Generated/BlobContainerCollection.cs | 74 +++ .../src/Generated/DeletedAccountCollection.cs | 76 +++ .../Generated/EncryptionScopeCollection.cs | 74 +++ .../src/Generated/FileShareCollection.cs | 78 +++ .../ObjectReplicationPolicyCollection.cs | 74 +++ .../src/Generated/StorageAccountCollection.cs | 76 +++ .../StorageAccountLocalUserCollection.cs | 74 +++ ...ragePrivateEndpointConnectionCollection.cs | 74 +++ .../src/Generated/StorageQueueCollection.cs | 74 +++ .../src/Generated/TableCollection.cs | 74 +++ .../Samples/Sample_AmlFileSystemCollection.cs | 42 ++ .../Samples/Sample_StorageCacheCollection.cs | 42 ++ .../Samples/Sample_StorageTargetCollection.cs | 43 ++ .../src/Generated/AmlFileSystemCollection.cs | 74 +++ .../src/Generated/StorageCacheCollection.cs | 74 +++ .../src/Generated/StorageTargetCollection.cs | 74 +++ .../src/Generated/JobDefinitionCollection.cs | 74 +++ .../src/Generated/JobRunCollection.cs | 74 +++ .../Generated/StorageMoverAgentCollection.cs | 74 +++ .../src/Generated/StorageMoverCollection.cs | 74 +++ .../StorageMoverEndpointCollection.cs | 74 +++ .../StorageMoverProjectCollection.cs | 74 +++ .../Samples/Sample_DiskPoolCollection.cs | 42 ++ .../Sample_DiskPoolIscsiTargetCollection.cs | 43 ++ .../src/Generated/DiskPoolCollection.cs | 74 +++ .../DiskPoolIscsiTargetCollection.cs | 74 +++ .../Samples/Sample_CloudEndpointCollection.cs | 44 ++ .../Sample_StorageSyncGroupCollection.cs | 43 ++ ...SyncPrivateEndpointConnectionCollection.cs | 43 ++ ...e_StorageSyncRegisteredServerCollection.cs | 43 ++ ...ple_StorageSyncServerEndpointCollection.cs | 44 ++ .../Sample_StorageSyncServiceCollection.cs | 42 ++ .../Sample_StorageSyncWorkflowCollection.cs | 44 ++ .../src/Generated/CloudEndpointCollection.cs | 74 +++ .../Generated/StorageSyncGroupCollection.cs | 74 +++ ...SyncPrivateEndpointConnectionCollection.cs | 74 +++ .../StorageSyncRegisteredServerCollection.cs | 66 +++ .../StorageSyncServerEndpointCollection.cs | 74 +++ .../Generated/StorageSyncServiceCollection.cs | 74 +++ .../StorageSyncWorkflowCollection.cs | 74 +++ ...Sample_StreamAnalyticsClusterCollection.cs | 42 ++ ...treamAnalyticsPrivateEndpointCollection.cs | 43 ++ .../Samples/Sample_StreamingJobCollection.cs | 85 ++++ .../Sample_StreamingJobFunctionCollection.cs | 86 ++++ .../Sample_StreamingJobInputCollection.cs | 172 +++++++ .../Sample_StreamingJobOutputCollection.cs | 473 ++++++++++++++++++ ...le_StreamingJobTransformationCollection.cs | 43 ++ .../StreamAnalyticsClusterCollection.cs | 74 +++ ...treamAnalyticsPrivateEndpointCollection.cs | 74 +++ .../src/Generated/StreamingJobCollection.cs | 76 +++ .../StreamingJobFunctionCollection.cs | 74 +++ .../Generated/StreamingJobInputCollection.cs | 74 +++ .../Generated/StreamingJobOutputCollection.cs | 74 +++ .../StreamingJobTransformationCollection.cs | 74 +++ .../Sample_BillingAccountPolicyCollection.cs | 40 ++ .../Sample_SubscriptionAliasCollection.cs | 39 ++ .../BillingAccountPolicyCollection.cs | 74 +++ .../Generated/SubscriptionAliasCollection.cs | 74 +++ .../Sample_ProblemClassificationCollection.cs | 42 ++ .../Sample_SupportAzureServiceCollection.cs | 40 ++ .../Samples/Sample_SupportTicketCollection.cs | 41 ++ ...le_SupportTicketCommunicationCollection.cs | 42 ++ .../ProblemClassificationCollection.cs | 74 +++ .../SupportAzureServiceCollection.cs | 74 +++ .../src/Generated/SupportTicketCollection.cs | 74 +++ .../SupportTicketCommunicationCollection.cs | 74 +++ ..._SynapseAadOnlyAuthenticationCollection.cs | 43 ++ ...AttachedDatabaseConfigurationCollection.cs | 44 ++ ...Sample_SynapseBigDataPoolInfoCollection.cs | 43 ++ ...pseClusterPrincipalAssignmentCollection.cs | 44 ++ .../Sample_SynapseDataConnectionCollection.cs | 45 ++ ...Sample_SynapseDataMaskingRuleCollection.cs | 44 ++ ...apseDataWarehouseUserActivityCollection.cs | 45 ++ .../Sample_SynapseDatabaseCollection.cs | 44 ++ ...seDatabasePrincipalAssignmentCollection.cs | 45 ++ ...DedicatedSqlMinimalTlsSettingCollection.cs | 44 ++ ...le_SynapseEncryptionProtectorCollection.cs | 43 ++ ...endedServerBlobAuditingPolicyCollection.cs | 43 ++ ...Sample_SynapseGeoBackupPolicyCollection.cs | 44 ++ ...ple_SynapseIPFirewallRuleInfoCollection.cs | 43 ++ ...ple_SynapseIntegrationRuntimeCollection.cs | 43 ++ .../Samples/Sample_SynapseKeyCollection.cs | 43 ++ .../Sample_SynapseKustoPoolCollection.cs | 43 ++ .../Sample_SynapseLibraryCollection.cs | 44 ++ ...apsePrivateEndpointConnectionCollection.cs | 43 ++ ...ntConnectionForPrivateLinkHubCollection.cs | 44 ++ .../Sample_SynapsePrivateLinkHubCollection.cs | 42 ++ ...le_SynapsePrivateLinkResourceCollection.cs | 44 ++ ...ple_SynapseRecoverableSqlPoolCollection.cs | 44 ++ ...Sample_SynapseReplicationLinkCollection.cs | 45 ++ ...napseRestorableDroppedSqlPoolCollection.cs | 44 ++ .../Sample_SynapseRestorePointCollection.cs | 45 ++ ...ample_SynapseSensitivityLabelCollection.cs | 48 ++ ...napseServerBlobAuditingPolicyCollection.cs | 43 ++ ...apseServerSecurityAlertPolicyCollection.cs | 43 ++ ...ServerVulnerabilityAssessmentCollection.cs | 43 ++ ...ple_SynapseSparkConfigurationCollection.cs | 44 ++ .../Sample_SynapseSqlPoolCollection.cs | 43 ++ .../Sample_SynapseSqlPoolColumnCollection.cs | 47 ++ ...ynapseSqlPoolConnectionPolicyCollection.cs | 45 ++ .../Sample_SynapseSqlPoolSchemaCollection.cs | 45 ++ ...pseSqlPoolSecurityAlertPolicyCollection.cs | 44 ++ .../Sample_SynapseSqlPoolTableCollection.cs | 46 ++ ...qlPoolVulnerabilityAssessmentCollection.cs | 44 ++ ...abilityAssessmentRuleBaselineCollection.cs | 46 ++ ...apseTransparentDataEncryptionCollection.cs | 44 ++ ...erabilityAssessmentScanRecordCollection.cs | 46 ++ ...ple_SynapseWorkloadClassifierCollection.cs | 45 ++ .../Sample_SynapseWorkloadGroupCollection.cs | 44 ++ .../Sample_SynapseWorkspaceCollection.cs | 42 ++ ...eWorkspacePrivateLinkResourceCollection.cs | 44 ++ .../SynapseAadOnlyAuthenticationCollection.cs | 66 +++ ...AttachedDatabaseConfigurationCollection.cs | 74 +++ .../SynapseBigDataPoolInfoCollection.cs | 74 +++ ...pseClusterPrincipalAssignmentCollection.cs | 74 +++ .../SynapseDataConnectionCollection.cs | 74 +++ .../SynapseDataMaskingRuleCollection.cs | 74 +++ ...apseDataWarehouseUserActivityCollection.cs | 66 +++ .../Generated/SynapseDatabaseCollection.cs | 74 +++ ...seDatabasePrincipalAssignmentCollection.cs | 74 +++ ...DedicatedSqlMinimalTlsSettingCollection.cs | 74 +++ .../SynapseEncryptionProtectorCollection.cs | 66 +++ ...endedServerBlobAuditingPolicyCollection.cs | 66 +++ .../SynapseGeoBackupPolicyCollection.cs | 66 +++ .../SynapseIPFirewallRuleInfoCollection.cs | 74 +++ .../SynapseIntegrationRuntimeCollection.cs | 76 +++ .../src/Generated/SynapseKeyCollection.cs | 74 +++ .../Generated/SynapseKustoPoolCollection.cs | 74 +++ .../src/Generated/SynapseLibraryCollection.cs | 74 +++ ...apsePrivateEndpointConnectionCollection.cs | 74 +++ ...ntConnectionForPrivateLinkHubCollection.cs | 74 +++ .../SynapsePrivateLinkHubCollection.cs | 74 +++ .../SynapsePrivateLinkResourceCollection.cs | 74 +++ .../SynapseRecoverableSqlPoolCollection.cs | 74 +++ .../SynapseReplicationLinkCollection.cs | 74 +++ ...napseRestorableDroppedSqlPoolCollection.cs | 74 +++ .../SynapseRestorePointCollection.cs | 74 +++ .../SynapseSensitivityLabelCollection.cs | 66 +++ ...napseServerBlobAuditingPolicyCollection.cs | 66 +++ ...apseServerSecurityAlertPolicyCollection.cs | 66 +++ ...ServerVulnerabilityAssessmentCollection.cs | 66 +++ .../SynapseSparkConfigurationCollection.cs | 74 +++ .../src/Generated/SynapseSqlPoolCollection.cs | 74 +++ .../SynapseSqlPoolColumnCollection.cs | 74 +++ ...ynapseSqlPoolConnectionPolicyCollection.cs | 66 +++ .../SynapseSqlPoolSchemaCollection.cs | 74 +++ ...pseSqlPoolSecurityAlertPolicyCollection.cs | 66 +++ .../SynapseSqlPoolTableCollection.cs | 74 +++ ...qlPoolVulnerabilityAssessmentCollection.cs | 66 +++ ...abilityAssessmentRuleBaselineCollection.cs | 76 +++ ...apseTransparentDataEncryptionCollection.cs | 66 +++ ...erabilityAssessmentScanRecordCollection.cs | 74 +++ .../SynapseWorkloadClassifierCollection.cs | 74 +++ .../SynapseWorkloadGroupCollection.cs | 74 +++ .../Generated/SynapseWorkspaceCollection.cs | 74 +++ ...eWorkspacePrivateLinkResourceCollection.cs | 74 +++ ...Sample_TrafficManagerEndpointCollection.cs | 132 +++++ .../Sample_TrafficManagerHeatMapCollection.cs | 138 +++++ .../Sample_TrafficManagerProfileCollection.cs | 126 +++++ .../TrafficManagerEndpointCollection.cs | 78 +++ .../TrafficManagerHeatMapCollection.cs | 70 +++ .../TrafficManagerProfileCollection.cs | 74 +++ ...ServicesCommunicationsGatewayCollection.cs | 42 ++ .../Sample_VoiceServicesTestLineCollection.cs | 43 ++ ...ServicesCommunicationsGatewayCollection.cs | 74 +++ .../VoiceServicesTestLineCollection.cs | 74 +++ .../Samples/Sample_WebPubSubCollection.cs | 42 ++ .../Samples/Sample_WebPubSubHubCollection.cs | 43 ++ ...bSubPrivateEndpointConnectionCollection.cs | 43 ++ ...le_WebPubSubSharedPrivateLinkCollection.cs | 43 ++ .../src/Generated/WebPubSubCollection.cs | 74 +++ .../src/Generated/WebPubSubHubCollection.cs | 74 +++ ...bSubPrivateEndpointConnectionCollection.cs | 74 +++ .../WebPubSubSharedPrivateLinkCollection.cs | 74 +++ .../Sample_AppCertificateCollection.cs | 42 ++ .../Sample_AppServicePlanCollection.cs | 42 ++ ...mple_CertificateOrderDetectorCollection.cs | 44 ++ .../Samples/Sample_DeletedSiteCollection.cs | 42 ++ ...le_HostingEnvironmentDetectorCollection.cs | 44 ++ .../Sample_KubeEnvironmentCollection.cs | 42 ++ .../Sample_SiteConfigAppsettingCollection.cs | 44 ++ .../Samples/Sample_SiteDetectorCollection.cs | 87 ++++ ...Sample_SiteDiagnosticAnalysisCollection.cs | 89 ++++ .../Sample_SiteDiagnosticCollection.cs | 87 ++++ ...Sample_SiteDiagnosticDetectorCollection.cs | 89 ++++ .../Samples/Sample_SiteInstanceCollection.cs | 44 ++ ...SitePrivateEndpointConnectionCollection.cs | 43 ++ .../Sample_SiteSlotDetectorCollection.cs | 89 ++++ ...le_SiteSlotDiagnosticAnalysisCollection.cs | 91 ++++ .../Sample_SiteSlotDiagnosticCollection.cs | 89 ++++ ...le_SiteSlotDiagnosticDetectorCollection.cs | 91 ++++ .../Sample_SiteSlotInstanceCollection.cs | 45 ++ ...SlotPrivateEndpointConnectionCollection.cs | 44 ++ .../Sample_StaticSiteBuildCollection.cs | 44 ++ ...eBuildUserProvidedFunctionAppCollection.cs | 44 ++ .../Samples/Sample_StaticSiteCollection.cs | 42 ++ ...taticSiteCustomDomainOverviewCollection.cs | 43 ++ ...SitePrivateEndpointConnectionCollection.cs | 43 ++ ...icSiteUserProvidedFunctionAppCollection.cs | 43 ++ .../Sample_TopLevelDomainCollection.cs | 42 ++ ...e_WebSiteSlotConfigAppSettingCollection.cs | 45 ++ .../src/Generated/AppCertificateCollection.cs | 74 +++ .../AppServiceCertificateCollection.cs | 74 +++ .../AppServiceCertificateOrderCollection.cs | 74 +++ .../Generated/AppServiceDomainCollection.cs | 74 +++ .../AppServiceEnvironmentCollection.cs | 74 +++ .../src/Generated/AppServicePlanCollection.cs | 74 +++ ...ybridConnectionNamespaceRelayCollection.cs | 78 +++ ...ePlanVirtualNetworkConnectionCollection.cs | 74 +++ ...rtualNetworkConnectionGatewayCollection.cs | 74 +++ .../AppServiceSourceControlCollection.cs | 74 +++ .../CertificateOrderDetectorCollection.cs | 80 +++ .../src/Generated/DeletedSiteCollection.cs | 74 +++ .../DomainOwnershipIdentifierCollection.cs | 74 +++ .../HostingEnvironmentDetectorCollection.cs | 80 +++ ...mentPrivateEndpointConnectionCollection.cs | 74 +++ ...tingEnvironmentRecommendationCollection.cs | 78 +++ .../HostingEnvironmentWorkerPoolCollection.cs | 74 +++ .../Generated/KubeEnvironmentCollection.cs | 74 +++ .../src/Generated/NetworkFeatureCollection.cs | 74 +++ .../src/Generated/SiteBackupCollection.cs | 74 +++ .../SiteConfigAppsettingCollection.cs | 74 +++ .../Generated/SiteConfigSnapshotCollection.cs | 74 +++ .../src/Generated/SiteDeploymentCollection.cs | 74 +++ .../src/Generated/SiteDetectorCollection.cs | 80 +++ .../SiteDiagnosticAnalysisCollection.cs | 74 +++ .../src/Generated/SiteDiagnosticCollection.cs | 74 +++ .../SiteDiagnosticDetectorCollection.cs | 74 +++ ...SiteDomainOwnershipIdentifierCollection.cs | 74 +++ .../src/Generated/SiteFunctionCollection.cs | 74 +++ .../SiteHostNameBindingCollection.cs | 74 +++ ...ybridConnectionNamespaceRelayCollection.cs | 78 +++ .../src/Generated/SiteInstanceCollection.cs | 74 +++ .../SiteInstanceProcessCollection.cs | 74 +++ .../SiteInstanceProcessModuleCollection.cs | 74 +++ ...SitePrivateEndpointConnectionCollection.cs | 74 +++ .../src/Generated/SiteProcessCollection.cs | 74 +++ .../Generated/SiteProcessModuleCollection.cs | 74 +++ .../SitePublicCertificateCollection.cs | 74 +++ .../Generated/SiteRecommendationCollection.cs | 78 +++ .../src/Generated/SiteSlotBackupCollection.cs | 74 +++ .../SiteSlotConfigSnapshotCollection.cs | 74 +++ .../Generated/SiteSlotDeploymentCollection.cs | 74 +++ .../Generated/SiteSlotDetectorCollection.cs | 80 +++ .../SiteSlotDiagnosticAnalysisCollection.cs | 74 +++ .../Generated/SiteSlotDiagnosticCollection.cs | 74 +++ .../SiteSlotDiagnosticDetectorCollection.cs | 74 +++ ...SlotDomainOwnershipIdentifierCollection.cs | 74 +++ .../Generated/SiteSlotFunctionCollection.cs | 74 +++ .../SiteSlotHostNameBindingCollection.cs | 74 +++ ...ybridConnectionNamespaceRelayCollection.cs | 78 +++ .../Generated/SiteSlotInstanceCollection.cs | 74 +++ .../SiteSlotInstanceProcessCollection.cs | 74 +++ ...SiteSlotInstanceProcessModuleCollection.cs | 74 +++ ...SlotPrivateEndpointConnectionCollection.cs | 74 +++ .../Generated/SiteSlotProcessCollection.cs | 74 +++ .../SiteSlotProcessModuleCollection.cs | 74 +++ ...eSlotVirtualNetworkConnectionCollection.cs | 74 +++ ...rtualNetworkConnectionGatewayCollection.cs | 74 +++ .../SiteVirtualNetworkConnectionCollection.cs | 74 +++ ...rtualNetworkConnectionGatewayCollection.cs | 74 +++ .../Generated/StaticSiteBuildCollection.cs | 74 +++ ...eBuildUserProvidedFunctionAppCollection.cs | 74 +++ .../src/Generated/StaticSiteCollection.cs | 74 +++ ...taticSiteCustomDomainOverviewCollection.cs | 74 +++ ...SitePrivateEndpointConnectionCollection.cs | 74 +++ ...icSiteUserProvidedFunctionAppCollection.cs | 74 +++ .../src/Generated/TopLevelDomainCollection.cs | 74 +++ .../src/Generated/WebSiteCollection.cs | 74 +++ ...WebSiteConfigConnectionStringCollection.cs | 74 +++ .../WebSiteContinuousWebJobCollection.cs | 74 +++ .../Generated/WebSiteExtensionCollection.cs | 74 +++ .../WebSiteHybridConnectionCollection.cs | 74 +++ .../WebSitePremierAddonCollection.cs | 74 +++ .../src/Generated/WebSiteSlotCollection.cs | 74 +++ .../WebSiteSlotConfigAppSettingCollection.cs | 74 +++ ...iteSlotConfigConnectionStringCollection.cs | 74 +++ .../WebSiteSlotContinuousWebJobCollection.cs | 74 +++ .../WebSiteSlotExtensionCollection.cs | 74 +++ .../WebSiteSlotHybridConnectionCollection.cs | 74 +++ .../WebSiteSlotPremierAddOnCollection.cs | 74 +++ .../WebSiteSlotPublicCertificateCollection.cs | 74 +++ .../WebSiteSlotTriggeredWebJobCollection.cs | 74 +++ ...iteSlotTriggeredWebJobHistoryCollection.cs | 74 +++ .../Generated/WebSiteSlotWebJobCollection.cs | 74 +++ ...WebSiteTriggeredWebJobHistoryCollection.cs | 74 +++ .../WebSiteTriggeredwebJobCollection.cs | 74 +++ .../src/Generated/WebSiteWebJobCollection.cs | 74 +++ .../Samples/Sample_HealthMonitorCollection.cs | 92 ++++ ...mple_HealthMonitorStateChangeCollection.cs | 94 ++++ .../src/Generated/HealthMonitorCollection.cs | 76 +++ .../HealthMonitorStateChangeCollection.cs | 76 +++ ..._SapApplicationServerInstanceCollection.cs | 43 ++ ...mple_SapCentralServerInstanceCollection.cs | 43 ++ .../Sample_SapDatabaseInstanceCollection.cs | 43 ++ .../Samples/Sample_SapMonitorCollection.cs | 42 ++ .../Sample_SapProviderInstanceCollection.cs | 258 ++++++++++ .../Sample_SapVirtualInstanceCollection.cs | 42 ++ .../SapApplicationServerInstanceCollection.cs | 74 +++ .../SapCentralServerInstanceCollection.cs | 74 +++ .../SapDatabaseInstanceCollection.cs | 74 +++ .../src/Generated/SapMonitorCollection.cs | 74 +++ .../SapProviderInstanceCollection.cs | 74 +++ .../Generated/SapVirtualInstanceCollection.cs | 74 +++ 314 files changed, 21182 insertions(+) diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_BlobContainerCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_BlobContainerCollection.cs index 11fc85ea5494..b18ae86db424 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_BlobContainerCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_BlobContainerCollection.cs @@ -280,6 +280,49 @@ public async Task Exists_GetBlobContainersGetWithAllowProtectedAppendWritesAll() Console.WriteLine($"Succeeded: {result}"); } + // GetBlobContainersGetWithAllowProtectedAppendWritesAll + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBlobContainersGetWithAllowProtectedAppendWritesAll() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json + // this example is just showing the usage of "BlobContainers_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 BlobServiceResource created on azure + // for more information of creating BlobServiceResource, please refer to the document of BlobServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res9871"; + string accountName = "sto6217"; + ResourceIdentifier blobServiceResourceId = BlobServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + BlobServiceResource blobService = client.GetBlobServiceResource(blobServiceResourceId); + + // get the collection of this BlobContainerResource + BlobContainerCollection collection = blobService.GetBlobContainers(); + + // invoke the operation + string containerName = "container1634"; + NullableResponse response = await collection.GetIfExistsAsync(containerName); + BlobContainerResource 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 + BlobContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetContainers [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -345,5 +388,48 @@ public async Task Exists_GetContainers() Console.WriteLine($"Succeeded: {result}"); } + + // GetContainers + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainers() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersGet.json + // this example is just showing the usage of "BlobContainers_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 BlobServiceResource created on azure + // for more information of creating BlobServiceResource, please refer to the document of BlobServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res9871"; + string accountName = "sto6217"; + ResourceIdentifier blobServiceResourceId = BlobServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + BlobServiceResource blobService = client.GetBlobServiceResource(blobServiceResourceId); + + // get the collection of this BlobContainerResource + BlobContainerCollection collection = blobService.GetBlobContainers(); + + // invoke the operation + string containerName = "container1634"; + NullableResponse response = await collection.GetIfExistsAsync(containerName); + BlobContainerResource 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 + BlobContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_DeletedAccountCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_DeletedAccountCollection.cs index df84664c0510..84677fb6eca3 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_DeletedAccountCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_DeletedAccountCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -80,5 +81,47 @@ public async Task Exists_DeletedAccountGet() Console.WriteLine($"Succeeded: {result}"); } + + // DeletedAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DeletedAccountGet() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/DeletedAccountGet.json + // this example is just showing the usage of "DeletedAccounts_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "{subscription-id}"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this DeletedAccountResource + DeletedAccountCollection collection = subscriptionResource.GetDeletedAccounts(); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + string deletedAccountName = "sto1125"; + NullableResponse response = await collection.GetIfExistsAsync(location, deletedAccountName); + DeletedAccountResource 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 + DeletedAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs index eba741ed8504..ab16cba4d7fb 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs @@ -160,6 +160,49 @@ public async Task Exists_StorageAccountGetEncryptionScope() Console.WriteLine($"Succeeded: {result}"); } + // StorageAccountGetEncryptionScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageAccountGetEncryptionScope() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetEncryptionScope.json + // this example is just showing the usage of "EncryptionScopes_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 StorageAccountResource created on azure + // for more information of creating StorageAccountResource, please refer to the document of StorageAccountResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "resource-group-name"; + string accountName = "{storage-account-name}"; + ResourceIdentifier storageAccountResourceId = StorageAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + StorageAccountResource storageAccount = client.GetStorageAccountResource(storageAccountResourceId); + + // get the collection of this EncryptionScopeResource + EncryptionScopeCollection collection = storageAccount.GetEncryptionScopes(); + + // invoke the operation + string encryptionScopeName = "{encryption-scope-name}"; + NullableResponse response = await collection.GetIfExistsAsync(encryptionScopeName); + EncryptionScopeResource 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 + EncryptionScopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageAccountEncryptionScopeList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_FileShareCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_FileShareCollection.cs index c799cfa7716c..b9f4f407d734 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_FileShareCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_FileShareCollection.cs @@ -316,6 +316,50 @@ public async Task Exists_GetShareStats() Console.WriteLine($"Succeeded: {result}"); } + // GetShareStats + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetShareStats() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesGet_Stats.json + // this example is just showing the usage of "FileShares_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 FileServiceResource created on azure + // for more information of creating FileServiceResource, please refer to the document of FileServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res9871"; + string accountName = "sto6217"; + ResourceIdentifier fileServiceResourceId = FileServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + FileServiceResource fileService = client.GetFileServiceResource(fileServiceResourceId); + + // get the collection of this FileShareResource + FileShareCollection collection = fileService.GetFileShares(); + + // invoke the operation + string shareName = "share1634"; + string expand = "stats"; + NullableResponse response = await collection.GetIfExistsAsync(shareName, expand: expand); + FileShareResource 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 + FileShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetShares [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -381,5 +425,48 @@ public async Task Exists_GetShares() Console.WriteLine($"Succeeded: {result}"); } + + // GetShares + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetShares() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesGet.json + // this example is just showing the usage of "FileShares_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 FileServiceResource created on azure + // for more information of creating FileServiceResource, please refer to the document of FileServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res9871"; + string accountName = "sto6217"; + ResourceIdentifier fileServiceResourceId = FileServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + FileServiceResource fileService = client.GetFileServiceResource(fileServiceResourceId); + + // get the collection of this FileShareResource + FileShareCollection collection = fileService.GetFileShares(); + + // invoke the operation + string shareName = "share1634"; + NullableResponse response = await collection.GetIfExistsAsync(shareName); + FileShareResource 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 + FileShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_ObjectReplicationPolicyCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_ObjectReplicationPolicyCollection.cs index 2d05dc3a1f79..4c332fac5911 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_ObjectReplicationPolicyCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_ObjectReplicationPolicyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_StorageAccountGetObjectReplicationPolicies() Console.WriteLine($"Succeeded: {result}"); } + // StorageAccountGetObjectReplicationPolicies + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageAccountGetObjectReplicationPolicies() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetObjectReplicationPolicy.json + // this example is just showing the usage of "ObjectReplicationPolicies_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 StorageAccountResource created on azure + // for more information of creating StorageAccountResource, please refer to the document of StorageAccountResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res6977"; + string accountName = "sto2527"; + ResourceIdentifier storageAccountResourceId = StorageAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + StorageAccountResource storageAccount = client.GetStorageAccountResource(storageAccountResourceId); + + // get the collection of this ObjectReplicationPolicyResource + ObjectReplicationPolicyCollection collection = storageAccount.GetObjectReplicationPolicies(); + + // invoke the operation + string objectReplicationPolicyId = "{objectReplicationPolicy-Id}"; + NullableResponse response = await collection.GetIfExistsAsync(objectReplicationPolicyId); + ObjectReplicationPolicyResource 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 + ObjectReplicationPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageAccountCreateObjectReplicationPolicyOnDestination [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageAccountCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageAccountCollection.cs index a7b51f83b0d9..50b860227d92 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageAccountCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageAccountCollection.cs @@ -940,6 +940,48 @@ public async Task Exists_StorageAccountGetAsyncSkuConversionStatus() Console.WriteLine($"Succeeded: {result}"); } + // StorageAccountGetAsyncSkuConversionStatus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageAccountGetAsyncSkuConversionStatus() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetAsyncSkuConversionStatus.json + // this example is just showing the usage of "StorageAccounts_GetProperties" 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 = "{subscription-id}"; + string resourceGroupName = "res9407"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageAccountResource + StorageAccountCollection collection = resourceGroupResource.GetStorageAccounts(); + + // invoke the operation + string accountName = "sto8596"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + StorageAccountResource 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 + StorageAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageAccountGetProperties [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1004,6 +1046,48 @@ public async Task Exists_StorageAccountGetProperties() Console.WriteLine($"Succeeded: {result}"); } + // StorageAccountGetProperties + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageAccountGetProperties() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetProperties.json + // this example is just showing the usage of "StorageAccounts_GetProperties" 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 = "{subscription-id}"; + string resourceGroupName = "res9407"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageAccountResource + StorageAccountCollection collection = resourceGroupResource.GetStorageAccounts(); + + // invoke the operation + string accountName = "sto8596"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + StorageAccountResource 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 + StorageAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageAccountGetPropertiesCMKEnabled [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1068,6 +1152,48 @@ public async Task Exists_StorageAccountGetPropertiesCMKEnabled() Console.WriteLine($"Succeeded: {result}"); } + // StorageAccountGetPropertiesCMKEnabled + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageAccountGetPropertiesCMKEnabled() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetPropertiesCMKEnabled.json + // this example is just showing the usage of "StorageAccounts_GetProperties" 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 = "{subscription-id}"; + string resourceGroupName = "res9407"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageAccountResource + StorageAccountCollection collection = resourceGroupResource.GetStorageAccounts(); + + // invoke the operation + string accountName = "sto8596"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + StorageAccountResource 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 + StorageAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageAccountGetPropertiesCMKVersionExpirationTime [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1132,6 +1258,48 @@ public async Task Exists_StorageAccountGetPropertiesCMKVersionExpirationTime() Console.WriteLine($"Succeeded: {result}"); } + // StorageAccountGetPropertiesCMKVersionExpirationTime + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageAccountGetPropertiesCMKVersionExpirationTime() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetPropertiesCMKVersionExpirationTime.json + // this example is just showing the usage of "StorageAccounts_GetProperties" 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 = "{subscription-id}"; + string resourceGroupName = "res9407"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageAccountResource + StorageAccountCollection collection = resourceGroupResource.GetStorageAccounts(); + + // invoke the operation + string accountName = "sto8596"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + StorageAccountResource 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 + StorageAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageAccountListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageAccountLocalUserCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageAccountLocalUserCollection.cs index bc2fdc821581..35fee6fdbf08 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageAccountLocalUserCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageAccountLocalUserCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetLocalUser() Console.WriteLine($"Succeeded: {result}"); } + // GetLocalUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLocalUser() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/LocalUserGet.json + // this example is just showing the usage of "LocalUsers_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 StorageAccountResource created on azure + // for more information of creating StorageAccountResource, please refer to the document of StorageAccountResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res6977"; + string accountName = "sto2527"; + ResourceIdentifier storageAccountResourceId = StorageAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + StorageAccountResource storageAccount = client.GetStorageAccountResource(storageAccountResourceId); + + // get the collection of this StorageAccountLocalUserResource + StorageAccountLocalUserCollection collection = storageAccount.GetStorageAccountLocalUsers(); + + // invoke the operation + string username = "user1"; + NullableResponse response = await collection.GetIfExistsAsync(username); + StorageAccountLocalUserResource 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 + StorageAccountLocalUserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateLocalUser [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StoragePrivateEndpointConnectionCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StoragePrivateEndpointConnectionCollection.cs index 614599f7a7f3..bf8c90df2395 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StoragePrivateEndpointConnectionCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StoragePrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_StorageAccountGetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // StorageAccountGetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageAccountGetPrivateEndpointConnection() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 StorageAccountResource created on azure + // for more information of creating StorageAccountResource, please refer to the document of StorageAccountResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res6977"; + string accountName = "sto2527"; + ResourceIdentifier storageAccountResourceId = StorageAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + StorageAccountResource storageAccount = client.GetStorageAccountResource(storageAccountResourceId); + + // get the collection of this StoragePrivateEndpointConnectionResource + StoragePrivateEndpointConnectionCollection collection = storageAccount.GetStoragePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "{privateEndpointConnectionName}"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + StoragePrivateEndpointConnectionResource 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 + StoragePrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageAccountPutPrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageQueueCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageQueueCollection.cs index 20ca64d50b5a..58ac6e6155d2 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageQueueCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_StorageQueueCollection.cs @@ -164,6 +164,49 @@ public async Task Exists_QueueOperationGet() Console.WriteLine($"Succeeded: {result}"); } + // QueueOperationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QueueOperationGet() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueOperationGet.json + // this example is just showing the usage of "Queue_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 QueueServiceResource created on azure + // for more information of creating QueueServiceResource, please refer to the document of QueueServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res3376"; + string accountName = "sto328"; + ResourceIdentifier queueServiceResourceId = QueueServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + QueueServiceResource queueService = client.GetQueueServiceResource(queueServiceResourceId); + + // get the collection of this StorageQueueResource + StorageQueueCollection collection = queueService.GetStorageQueues(); + + // invoke the operation + string queueName = "queue6185"; + NullableResponse response = await collection.GetIfExistsAsync(queueName); + StorageQueueResource 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 + StorageQueueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QueueOperationList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_TableCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_TableCollection.cs index 37e1e0bc6f23..be6dcbc3e402 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_TableCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/samples/Generated/Samples/Sample_TableCollection.cs @@ -178,6 +178,49 @@ public async Task Exists_TableOperationGet() Console.WriteLine($"Succeeded: {result}"); } + // TableOperationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TableOperationGet() + { + // Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableOperationGet.json + // this example is just showing the usage of "Table_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 TableServiceResource created on azure + // for more information of creating TableServiceResource, please refer to the document of TableServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res3376"; + string accountName = "sto328"; + ResourceIdentifier tableServiceResourceId = TableServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + TableServiceResource tableService = client.GetTableServiceResource(tableServiceResourceId); + + // get the collection of this TableResource + TableCollection collection = tableService.GetTables(); + + // invoke the operation + string tableName = "table6185"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + TableResource 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 + TableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TableOperationList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobContainerCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobContainerCollection.cs index 19ddd0fb8f06..d8b2d53ca5f2 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobContainerCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobContainerCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string containerName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName} + /// + /// + /// Operation Id + /// BlobContainers_Get + /// + /// + /// + /// The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _blobContainerClientDiagnostics.CreateScope("BlobContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _blobContainerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, containerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BlobContainerResource(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.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName} + /// + /// + /// Operation Id + /// BlobContainers_Get + /// + /// + /// + /// The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _blobContainerClientDiagnostics.CreateScope("BlobContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _blobContainerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, containerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BlobContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/DeletedAccountCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/DeletedAccountCollection.cs index 40056a728aee..de1989b334ee 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/DeletedAccountCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/DeletedAccountCollection.cs @@ -198,5 +198,81 @@ public virtual Response Exists(AzureLocation location, string deletedAccou throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName} + /// + /// + /// Operation Id + /// DeletedAccounts_Get + /// + /// + /// + /// The location of the deleted storage account. + /// Name of the deleted storage account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string deletedAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deletedAccountName, nameof(deletedAccountName)); + + using var scope = _deletedAccountClientDiagnostics.CreateScope("DeletedAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deletedAccountRestClient.GetAsync(Id.SubscriptionId, location, deletedAccountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedAccountResource(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}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName} + /// + /// + /// Operation Id + /// DeletedAccounts_Get + /// + /// + /// + /// The location of the deleted storage account. + /// Name of the deleted storage account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(AzureLocation location, string deletedAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deletedAccountName, nameof(deletedAccountName)); + + using var scope = _deletedAccountClientDiagnostics.CreateScope("DeletedAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deletedAccountRestClient.Get(Id.SubscriptionId, location, deletedAccountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/EncryptionScopeCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/EncryptionScopeCollection.cs index bdf8ca3ff08f..1202058b3bb5 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/EncryptionScopeCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/EncryptionScopeCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string encryptionScopeName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _encryptionScopeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EncryptionScopeResource(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.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _encryptionScopeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EncryptionScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileShareCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileShareCollection.cs index 671f2a9a3176..ca91f73b25ce 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileShareCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileShareCollection.cs @@ -339,6 +339,84 @@ public virtual Response Exists(string shareName, string expand = null, str } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName} + /// + /// + /// Operation Id + /// FileShares_Get + /// + /// + /// + /// The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + /// Optional, used to expand the properties within share's properties. Valid values are: stats. Should be passed as a string with delimiter ','. + /// Optional, used to retrieve properties of a snapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string shareName, string expand = null, string xMsSnapshot = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(shareName, nameof(shareName)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, shareName, expand, xMsSnapshot, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FileShareResource(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.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName} + /// + /// + /// Operation Id + /// FileShares_Get + /// + /// + /// + /// The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + /// Optional, used to expand the properties within share's properties. Valid values are: stats. Should be passed as a string with delimiter ','. + /// Optional, used to retrieve properties of a snapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string shareName, string expand = null, string xMsSnapshot = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(shareName, nameof(shareName)); + + using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fileShareRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, shareName, expand, xMsSnapshot, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FileShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ObjectReplicationPolicyCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ObjectReplicationPolicyCollection.cs index 7706f524cc2f..8e160f251e1f 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ObjectReplicationPolicyCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ObjectReplicationPolicyCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string objectReplicationPolicyId, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId} + /// + /// + /// Operation Id + /// ObjectReplicationPolicies_Get + /// + /// + /// + /// For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string objectReplicationPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(objectReplicationPolicyId, nameof(objectReplicationPolicyId)); + + using var scope = _objectReplicationPolicyClientDiagnostics.CreateScope("ObjectReplicationPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _objectReplicationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, objectReplicationPolicyId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ObjectReplicationPolicyResource(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.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId} + /// + /// + /// Operation Id + /// ObjectReplicationPolicies_Get + /// + /// + /// + /// For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string objectReplicationPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(objectReplicationPolicyId, nameof(objectReplicationPolicyId)); + + using var scope = _objectReplicationPolicyClientDiagnostics.CreateScope("ObjectReplicationPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _objectReplicationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, objectReplicationPolicyId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ObjectReplicationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountCollection.cs index e3ca748460da..7084734a0a6c 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string accountName, StorageAccountExpand? e } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName} + /// + /// + /// Operation Id + /// StorageAccounts_GetProperties + /// + /// + /// + /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + /// May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string accountName, StorageAccountExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _storageAccountClientDiagnostics.CreateScope("StorageAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageAccountRestClient.GetPropertiesAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageAccountResource(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.Storage/storageAccounts/{accountName} + /// + /// + /// Operation Id + /// StorageAccounts_GetProperties + /// + /// + /// + /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + /// May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, StorageAccountExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _storageAccountClientDiagnostics.CreateScope("StorageAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageAccountRestClient.GetProperties(Id.SubscriptionId, Id.ResourceGroupName, accountName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountLocalUserCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountLocalUserCollection.cs index 127191c395bc..6566e6f019e4 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountLocalUserCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountLocalUserCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string username, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username} + /// + /// + /// Operation Id + /// LocalUsers_Get + /// + /// + /// + /// The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage 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 username, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(username, nameof(username)); + + using var scope = _storageAccountLocalUserLocalUsersClientDiagnostics.CreateScope("StorageAccountLocalUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageAccountLocalUserLocalUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, username, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageAccountLocalUserResource(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.Storage/storageAccounts/{accountName}/localUsers/{username} + /// + /// + /// Operation Id + /// LocalUsers_Get + /// + /// + /// + /// The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string username, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(username, nameof(username)); + + using var scope = _storageAccountLocalUserLocalUsersClientDiagnostics.CreateScope("StorageAccountLocalUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageAccountLocalUserLocalUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, username, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageAccountLocalUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StoragePrivateEndpointConnectionCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StoragePrivateEndpointConnectionCollection.cs index 00902b566b2c..78386d3021d7 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StoragePrivateEndpointConnectionCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StoragePrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _storagePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("StoragePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storagePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StoragePrivateEndpointConnectionResource(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.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _storagePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("StoragePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storagePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StoragePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageQueueCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageQueueCollection.cs index 558992d0426d..958e0eea861e 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageQueueCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageQueueCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string queueName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName} + /// + /// + /// Operation Id + /// Queue_Get + /// + /// + /// + /// A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string queueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queueName, nameof(queueName)); + + using var scope = _storageQueueQueueClientDiagnostics.CreateScope("StorageQueueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageQueueQueueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, queueName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageQueueResource(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.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName} + /// + /// + /// Operation Id + /// Queue_Get + /// + /// + /// + /// A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string queueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queueName, nameof(queueName)); + + using var scope = _storageQueueQueueClientDiagnostics.CreateScope("StorageQueueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageQueueQueueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, queueName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageQueueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableCollection.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableCollection.cs index 34c2a5b78f7c..953ee7a4b25e 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableCollection.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string tableName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName} + /// + /// + /// Operation Id + /// Table_Get + /// + /// + /// + /// A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _tableClientDiagnostics.CreateScope("TableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tableRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, tableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TableResource(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.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName} + /// + /// + /// Operation Id + /// Table_Get + /// + /// + /// + /// A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _tableClientDiagnostics.CreateScope("TableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tableRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, tableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_AmlFileSystemCollection.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_AmlFileSystemCollection.cs index b5d0beb029a9..6af87e3b3a23 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_AmlFileSystemCollection.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_AmlFileSystemCollection.cs @@ -121,6 +121,48 @@ public async Task Exists_AmlFilesystemsGet() Console.WriteLine($"Succeeded: {result}"); } + // amlFilesystems_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AmlFilesystemsGet() + { + // Generated from example definition: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-05-01/examples/amlFilesystems_Get.json + // this example is just showing the usage of "amlFilesystems_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 = "scgroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AmlFileSystemResource + AmlFileSystemCollection collection = resourceGroupResource.GetAmlFileSystems(); + + // invoke the operation + string amlFileSystemName = "fs1"; + NullableResponse response = await collection.GetIfExistsAsync(amlFileSystemName); + AmlFileSystemResource 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 + AmlFileSystemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // amlFilesystems_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_StorageCacheCollection.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_StorageCacheCollection.cs index 88bd5563d30a..87e9bb1a24be 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_StorageCacheCollection.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_StorageCacheCollection.cs @@ -122,6 +122,48 @@ public async Task Exists_CachesGet() Console.WriteLine($"Succeeded: {result}"); } + // Caches_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CachesGet() + { + // Generated from example definition: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-05-01/examples/Caches_Get.json + // this example is just showing the usage of "Caches_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 = "scgroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageCacheResource + StorageCacheCollection collection = resourceGroupResource.GetStorageCaches(); + + // invoke the operation + string cacheName = "sc1"; + NullableResponse response = await collection.GetIfExistsAsync(cacheName); + StorageCacheResource 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 + StorageCacheData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Caches_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_StorageTargetCollection.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_StorageTargetCollection.cs index 1792c5b67180..3f8c79e74200 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_StorageTargetCollection.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/samples/Generated/Samples/Sample_StorageTargetCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_StorageTargetsGet() Console.WriteLine($"Succeeded: {result}"); } + // StorageTargets_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageTargetsGet() + { + // Generated from example definition: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2023-05-01/examples/StorageTargets_Get.json + // this example is just showing the usage of "StorageTargets_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 StorageCacheResource created on azure + // for more information of creating StorageCacheResource, please refer to the document of StorageCacheResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "scgroup"; + string cacheName = "sc1"; + ResourceIdentifier storageCacheResourceId = StorageCacheResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + StorageCacheResource storageCache = client.GetStorageCacheResource(storageCacheResourceId); + + // get the collection of this StorageTargetResource + StorageTargetCollection collection = storageCache.GetStorageTargets(); + + // invoke the operation + string storageTargetName = "st1"; + NullableResponse response = await collection.GetIfExistsAsync(storageTargetName); + StorageTargetResource 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 + StorageTargetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageTargets_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/AmlFileSystemCollection.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/AmlFileSystemCollection.cs index eef97911ad0f..be39fa9006ef 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/AmlFileSystemCollection.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/AmlFileSystemCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string amlFileSystemName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName} + /// + /// + /// Operation Id + /// amlFilesystems_Get + /// + /// + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string amlFileSystemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(amlFileSystemName, nameof(amlFileSystemName)); + + using var scope = _amlFileSystemamlFilesystemsClientDiagnostics.CreateScope("AmlFileSystemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _amlFileSystemamlFilesystemsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, amlFileSystemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AmlFileSystemResource(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.StorageCache/amlFilesystems/{amlFilesystemName} + /// + /// + /// Operation Id + /// amlFilesystems_Get + /// + /// + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string amlFileSystemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(amlFileSystemName, nameof(amlFileSystemName)); + + using var scope = _amlFileSystemamlFilesystemsClientDiagnostics.CreateScope("AmlFileSystemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _amlFileSystemamlFilesystemsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, amlFileSystemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AmlFileSystemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheCollection.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheCollection.cs index 1cba3bd2c041..c6be9f3dc4fe 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheCollection.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string cacheName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName} + /// + /// + /// Operation Id + /// Caches_Get + /// + /// + /// + /// Name of cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var scope = _storageCacheCachesClientDiagnostics.CreateScope("StorageCacheCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageCacheCachesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, cacheName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageCacheResource(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.StorageCache/caches/{cacheName} + /// + /// + /// Operation Id + /// Caches_Get + /// + /// + /// + /// Name of cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var scope = _storageCacheCachesClientDiagnostics.CreateScope("StorageCacheCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageCacheCachesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, cacheName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageCacheResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageTargetCollection.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageTargetCollection.cs index c31ffb4be41f..771bfcf97841 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageTargetCollection.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageTargetCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string storageTargetName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName} + /// + /// + /// Operation Id + /// StorageTargets_Get + /// + /// + /// + /// Name of Storage Target. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageTargetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTargetName, nameof(storageTargetName)); + + using var scope = _storageTargetClientDiagnostics.CreateScope("StorageTargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageTargetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageTargetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageTargetResource(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.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName} + /// + /// + /// Operation Id + /// StorageTargets_Get + /// + /// + /// + /// Name of Storage Target. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageTargetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageTargetName, nameof(storageTargetName)); + + using var scope = _storageTargetClientDiagnostics.CreateScope("StorageTargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageTargetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageTargetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageTargetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionCollection.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionCollection.cs index 85fe2b472161..73e91a453ddd 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionCollection.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string jobDefinitionName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName} + /// + /// + /// Operation Id + /// JobDefinitions_Get + /// + /// + /// + /// The name of the Job Definition 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 jobDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobDefinitionName, nameof(jobDefinitionName)); + + using var scope = _jobDefinitionClientDiagnostics.CreateScope("JobDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _jobDefinitionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, jobDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JobDefinitionResource(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.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName} + /// + /// + /// Operation Id + /// JobDefinitions_Get + /// + /// + /// + /// The name of the Job Definition resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobDefinitionName, nameof(jobDefinitionName)); + + using var scope = _jobDefinitionClientDiagnostics.CreateScope("JobDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _jobDefinitionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, jobDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JobDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobRunCollection.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobRunCollection.cs index 1d1af9eb3b28..f78b33d44694 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobRunCollection.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobRunCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string jobRunName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/jobRuns/{jobRunName} + /// + /// + /// Operation Id + /// JobRuns_Get + /// + /// + /// + /// The name of the Job Run 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 jobRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobRunName, nameof(jobRunName)); + + using var scope = _jobRunClientDiagnostics.CreateScope("JobRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _jobRunRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, jobRunName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JobRunResource(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.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/jobRuns/{jobRunName} + /// + /// + /// Operation Id + /// JobRuns_Get + /// + /// + /// + /// The name of the Job Run resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobRunName, nameof(jobRunName)); + + using var scope = _jobRunClientDiagnostics.CreateScope("JobRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _jobRunRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, jobRunName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JobRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverAgentCollection.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverAgentCollection.cs index 60a2228d192a..e1bb47591a2f 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverAgentCollection.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverAgentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string agentName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents/{agentName} + /// + /// + /// Operation Id + /// Agents_Get + /// + /// + /// + /// The name of the Agent 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 agentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentName, nameof(agentName)); + + using var scope = _storageMoverAgentAgentsClientDiagnostics.CreateScope("StorageMoverAgentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageMoverAgentAgentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageMoverAgentResource(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.StorageMover/storageMovers/{storageMoverName}/agents/{agentName} + /// + /// + /// Operation Id + /// Agents_Get + /// + /// + /// + /// The name of the Agent resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentName, nameof(agentName)); + + using var scope = _storageMoverAgentAgentsClientDiagnostics.CreateScope("StorageMoverAgentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageMoverAgentAgentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageMoverAgentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverCollection.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverCollection.cs index 35d6624f13df..4b4a80a81694 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverCollection.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string storageMoverName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName} + /// + /// + /// Operation Id + /// StorageMovers_Get + /// + /// + /// + /// The name of the Storage Mover 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 storageMoverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageMoverName, nameof(storageMoverName)); + + using var scope = _storageMoverClientDiagnostics.CreateScope("StorageMoverCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageMoverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, storageMoverName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageMoverResource(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.StorageMover/storageMovers/{storageMoverName} + /// + /// + /// Operation Id + /// StorageMovers_Get + /// + /// + /// + /// The name of the Storage Mover resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageMoverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageMoverName, nameof(storageMoverName)); + + using var scope = _storageMoverClientDiagnostics.CreateScope("StorageMoverCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageMoverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, storageMoverName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageMoverResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointCollection.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointCollection.cs index 42584c925a4b..d946d277fda0 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointCollection.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string endpointName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints/{endpointName} + /// + /// + /// Operation Id + /// Endpoints_Get + /// + /// + /// + /// The name of the Endpoint 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 endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _storageMoverEndpointEndpointsClientDiagnostics.CreateScope("StorageMoverEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageMoverEndpointEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageMoverEndpointResource(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.StorageMover/storageMovers/{storageMoverName}/endpoints/{endpointName} + /// + /// + /// Operation Id + /// Endpoints_Get + /// + /// + /// + /// The name of the Endpoint resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _storageMoverEndpointEndpointsClientDiagnostics.CreateScope("StorageMoverEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageMoverEndpointEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageMoverEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectCollection.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectCollection.cs index 826c66463c83..4e69d2f42e60 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectCollection.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string projectName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName} + /// + /// + /// Operation Id + /// Projects_Get + /// + /// + /// + /// The name of the Project 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 projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using var scope = _storageMoverProjectProjectsClientDiagnostics.CreateScope("StorageMoverProjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageMoverProjectProjectsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, projectName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageMoverProjectResource(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.StorageMover/storageMovers/{storageMoverName}/projects/{projectName} + /// + /// + /// Operation Id + /// Projects_Get + /// + /// + /// + /// The name of the Project resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using var scope = _storageMoverProjectProjectsClientDiagnostics.CreateScope("StorageMoverProjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageMoverProjectProjectsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, projectName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageMoverProjectResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/samples/Generated/Samples/Sample_DiskPoolCollection.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/samples/Generated/Samples/Sample_DiskPoolCollection.cs index e4c49553f646..be067ddc67a6 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/samples/Generated/Samples/Sample_DiskPoolCollection.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/samples/Generated/Samples/Sample_DiskPoolCollection.cs @@ -178,5 +178,47 @@ public async Task Exists_GetDiskPool() Console.WriteLine($"Succeeded: {result}"); } + + // Get Disk pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDiskPool() + { + // Generated from example definition: specification/storagepool/resource-manager/Microsoft.StoragePool/stable/2021-08-01/examples/DiskPools_Get.json + // this example is just showing the usage of "DiskPools_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DiskPoolResource + DiskPoolCollection collection = resourceGroupResource.GetDiskPools(); + + // invoke the operation + string diskPoolName = "myDiskPool"; + NullableResponse response = await collection.GetIfExistsAsync(diskPoolName); + DiskPoolResource 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 + DiskPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/samples/Generated/Samples/Sample_DiskPoolIscsiTargetCollection.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/samples/Generated/Samples/Sample_DiskPoolIscsiTargetCollection.cs index 51c124408cbc..eba320781285 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/samples/Generated/Samples/Sample_DiskPoolIscsiTargetCollection.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/samples/Generated/Samples/Sample_DiskPoolIscsiTargetCollection.cs @@ -164,5 +164,48 @@ public async Task Exists_GetISCSITarget() Console.WriteLine($"Succeeded: {result}"); } + + // Get iSCSI Target + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetISCSITarget() + { + // Generated from example definition: specification/storagepool/resource-manager/Microsoft.StoragePool/stable/2021-08-01/examples/IscsiTargets_Get.json + // this example is just showing the usage of "IscsiTargets_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 DiskPoolResource created on azure + // for more information of creating DiskPoolResource, please refer to the document of DiskPoolResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string diskPoolName = "myDiskPool"; + ResourceIdentifier diskPoolResourceId = DiskPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskPoolName); + DiskPoolResource diskPool = client.GetDiskPoolResource(diskPoolResourceId); + + // get the collection of this DiskPoolIscsiTargetResource + DiskPoolIscsiTargetCollection collection = diskPool.GetDiskPoolIscsiTargets(); + + // invoke the operation + string iscsiTargetName = "myIscsiTarget"; + NullableResponse response = await collection.GetIfExistsAsync(iscsiTargetName); + DiskPoolIscsiTargetResource 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 + DiskPoolIscsiTargetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolCollection.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolCollection.cs index 06cc180ba38a..f739b80198aa 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolCollection.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string diskPoolName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName} + /// + /// + /// Operation Id + /// DiskPools_Get + /// + /// + /// + /// The name of the Disk Pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diskPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskPoolName, nameof(diskPoolName)); + + using var scope = _diskPoolClientDiagnostics.CreateScope("DiskPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _diskPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, diskPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskPoolResource(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.StoragePool/diskPools/{diskPoolName} + /// + /// + /// Operation Id + /// DiskPools_Get + /// + /// + /// + /// The name of the Disk Pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diskPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskPoolName, nameof(diskPoolName)); + + using var scope = _diskPoolClientDiagnostics.CreateScope("DiskPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _diskPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, diskPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolIscsiTargetCollection.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolIscsiTargetCollection.cs index cdf2bed44592..b5be1afc13c0 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolIscsiTargetCollection.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolIscsiTargetCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string iscsiTargetName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName} + /// + /// + /// Operation Id + /// IscsiTargets_Get + /// + /// + /// + /// The name of the iSCSI Target. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string iscsiTargetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(iscsiTargetName, nameof(iscsiTargetName)); + + using var scope = _diskPoolIscsiTargetIscsiTargetsClientDiagnostics.CreateScope("DiskPoolIscsiTargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _diskPoolIscsiTargetIscsiTargetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, iscsiTargetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskPoolIscsiTargetResource(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.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName} + /// + /// + /// Operation Id + /// IscsiTargets_Get + /// + /// + /// + /// The name of the iSCSI Target. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string iscsiTargetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(iscsiTargetName, nameof(iscsiTargetName)); + + using var scope = _diskPoolIscsiTargetIscsiTargetsClientDiagnostics.CreateScope("DiskPoolIscsiTargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _diskPoolIscsiTargetIscsiTargetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, iscsiTargetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskPoolIscsiTargetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_CloudEndpointCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_CloudEndpointCollection.cs index 7df0866edbc9..e439f14806ff 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_CloudEndpointCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_CloudEndpointCollection.cs @@ -130,6 +130,50 @@ public async Task Exists_CloudEndpointsGet() Console.WriteLine($"Succeeded: {result}"); } + // CloudEndpoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CloudEndpointsGet() + { + // Generated from example definition: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-06-01/examples/CloudEndpoints_Get.json + // this example is just showing the usage of "CloudEndpoints_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 StorageSyncGroupResource created on azure + // for more information of creating StorageSyncGroupResource, please refer to the document of StorageSyncGroupResource + string subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + string resourceGroupName = "SampleResourceGroup_1"; + string storageSyncServiceName = "SampleStorageSyncService_1"; + string syncGroupName = "SampleSyncGroup_1"; + ResourceIdentifier storageSyncGroupResourceId = StorageSyncGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageSyncServiceName, syncGroupName); + StorageSyncGroupResource storageSyncGroup = client.GetStorageSyncGroupResource(storageSyncGroupResourceId); + + // get the collection of this CloudEndpointResource + CloudEndpointCollection collection = storageSyncGroup.GetCloudEndpoints(); + + // invoke the operation + string cloudEndpointName = "SampleCloudEndpoint_1"; + NullableResponse response = await collection.GetIfExistsAsync(cloudEndpointName); + CloudEndpointResource 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 + CloudEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CloudEndpoints_ListBySyncGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncGroupCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncGroupCollection.cs index b52c323ac793..c05f38686a34 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncGroupCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncGroupCollection.cs @@ -163,5 +163,48 @@ public async Task Exists_SyncGroupsGet() Console.WriteLine($"Succeeded: {result}"); } + + // SyncGroups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SyncGroupsGet() + { + // Generated from example definition: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-06-01/examples/SyncGroups_Get.json + // this example is just showing the usage of "SyncGroups_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 StorageSyncServiceResource created on azure + // for more information of creating StorageSyncServiceResource, please refer to the document of StorageSyncServiceResource + string subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + string resourceGroupName = "SampleResourceGroup_1"; + string storageSyncServiceName = "SampleStorageSyncService_1"; + ResourceIdentifier storageSyncServiceResourceId = StorageSyncServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageSyncServiceName); + StorageSyncServiceResource storageSyncService = client.GetStorageSyncServiceResource(storageSyncServiceResourceId); + + // get the collection of this StorageSyncGroupResource + StorageSyncGroupCollection collection = storageSyncService.GetStorageSyncGroups(); + + // invoke the operation + string syncGroupName = "SampleSyncGroup_1"; + NullableResponse response = await collection.GetIfExistsAsync(syncGroupName); + StorageSyncGroupResource 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 + StorageSyncGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncPrivateEndpointConnectionCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncPrivateEndpointConnectionCollection.cs index 734b9306c8e1..c3092d69fd0b 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncPrivateEndpointConnectionCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_PrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-06-01/examples/PrivateEndpointConnections_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 StorageSyncServiceResource created on azure + // for more information of creating StorageSyncServiceResource, please refer to the document of StorageSyncServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "res6977"; + string storageSyncServiceName = "sss2527"; + ResourceIdentifier storageSyncServiceResourceId = StorageSyncServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageSyncServiceName); + StorageSyncServiceResource storageSyncService = client.GetStorageSyncServiceResource(storageSyncServiceResourceId); + + // get the collection of this StorageSyncPrivateEndpointConnectionResource + StorageSyncPrivateEndpointConnectionCollection collection = storageSyncService.GetStorageSyncPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "{privateEndpointConnectionName}"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + StorageSyncPrivateEndpointConnectionResource 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 + StorageSyncPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncRegisteredServerCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncRegisteredServerCollection.cs index 7c8399f969aa..5cb2e4e41e8a 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncRegisteredServerCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncRegisteredServerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_RegisteredServersGet() Console.WriteLine($"Succeeded: {result}"); } + // RegisteredServers_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RegisteredServersGet() + { + // Generated from example definition: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-06-01/examples/RegisteredServers_Get.json + // this example is just showing the usage of "RegisteredServers_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 StorageSyncServiceResource created on azure + // for more information of creating StorageSyncServiceResource, please refer to the document of StorageSyncServiceResource + string subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + string resourceGroupName = "SampleResourceGroup_1"; + string storageSyncServiceName = "SampleStorageSyncService_1"; + ResourceIdentifier storageSyncServiceResourceId = StorageSyncServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageSyncServiceName); + StorageSyncServiceResource storageSyncService = client.GetStorageSyncServiceResource(storageSyncServiceResourceId); + + // get the collection of this StorageSyncRegisteredServerResource + StorageSyncRegisteredServerCollection collection = storageSyncService.GetStorageSyncRegisteredServers(); + + // invoke the operation + Guid serverId = Guid.Parse("080d4133-bdb5-40a0-96a0-71a6057bfe9a"); + NullableResponse response = await collection.GetIfExistsAsync(serverId); + StorageSyncRegisteredServerResource 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 + StorageSyncRegisteredServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RegisteredServers_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncServerEndpointCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncServerEndpointCollection.cs index 59f4d785f563..a4386ef4c1e8 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncServerEndpointCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncServerEndpointCollection.cs @@ -136,6 +136,50 @@ public async Task Exists_ServerEndpointsGet() Console.WriteLine($"Succeeded: {result}"); } + // ServerEndpoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServerEndpointsGet() + { + // Generated from example definition: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-06-01/examples/ServerEndpoints_Get.json + // this example is just showing the usage of "ServerEndpoints_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 StorageSyncGroupResource created on azure + // for more information of creating StorageSyncGroupResource, please refer to the document of StorageSyncGroupResource + string subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + string resourceGroupName = "SampleResourceGroup_1"; + string storageSyncServiceName = "SampleStorageSyncService_1"; + string syncGroupName = "SampleSyncGroup_1"; + ResourceIdentifier storageSyncGroupResourceId = StorageSyncGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageSyncServiceName, syncGroupName); + StorageSyncGroupResource storageSyncGroup = client.GetStorageSyncGroupResource(storageSyncGroupResourceId); + + // get the collection of this StorageSyncServerEndpointResource + StorageSyncServerEndpointCollection collection = storageSyncGroup.GetStorageSyncServerEndpoints(); + + // invoke the operation + string serverEndpointName = "SampleServerEndpoint_1"; + NullableResponse response = await collection.GetIfExistsAsync(serverEndpointName); + StorageSyncServerEndpointResource 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 + StorageSyncServerEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ServerEndpoints_ListBySyncGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncServiceCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncServiceCollection.cs index 4d56d20ef3c7..234b5849d777 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncServiceCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncServiceCollection.cs @@ -125,6 +125,48 @@ public async Task Exists_StorageSyncServicesGet() Console.WriteLine($"Succeeded: {result}"); } + // StorageSyncServices_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageSyncServicesGet() + { + // Generated from example definition: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-06-01/examples/StorageSyncServices_Get.json + // this example is just showing the usage of "StorageSyncServices_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 = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + string resourceGroupName = "SampleResourceGroup_1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StorageSyncServiceResource + StorageSyncServiceCollection collection = resourceGroupResource.GetStorageSyncServices(); + + // invoke the operation + string storageSyncServiceName = "SampleStorageSyncService_1"; + NullableResponse response = await collection.GetIfExistsAsync(storageSyncServiceName); + StorageSyncServiceResource 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 + StorageSyncServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageSyncServices_ListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncWorkflowCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncWorkflowCollection.cs index c95675b86334..5424169ecd59 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncWorkflowCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/samples/Generated/Samples/Sample_StorageSyncWorkflowCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_WorkflowsGet() Console.WriteLine($"Succeeded: {result}"); } + + // Workflows_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkflowsGet() + { + // Generated from example definition: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-06-01/examples/Workflows_Get.json + // this example is just showing the usage of "Workflows_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 StorageSyncServiceResource created on azure + // for more information of creating StorageSyncServiceResource, please refer to the document of StorageSyncServiceResource + string subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + string resourceGroupName = "SampleResourceGroup_1"; + string storageSyncServiceName = "SampleStorageSyncService_1"; + ResourceIdentifier storageSyncServiceResourceId = StorageSyncServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, storageSyncServiceName); + StorageSyncServiceResource storageSyncService = client.GetStorageSyncServiceResource(storageSyncServiceResourceId); + + // get the collection of this StorageSyncWorkflowResource + StorageSyncWorkflowCollection collection = storageSyncService.GetStorageSyncWorkflows(); + + // invoke the operation + string workflowId = "828219ea-083e-48b5-89ea-8fd9991b2e75"; + NullableResponse response = await collection.GetIfExistsAsync(workflowId); + StorageSyncWorkflowResource 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 + StorageSyncWorkflowData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/CloudEndpointCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/CloudEndpointCollection.cs index 2ba618ea1b6e..9d3cb39e3896 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/CloudEndpointCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/CloudEndpointCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string cloudEndpointName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName} + /// + /// + /// Operation Id + /// CloudEndpoints_Get + /// + /// + /// + /// Name of Cloud Endpoint object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string cloudEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudEndpointName, nameof(cloudEndpointName)); + + using var scope = _cloudEndpointClientDiagnostics.CreateScope("CloudEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cloudEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cloudEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudEndpointResource(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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName} + /// + /// + /// Operation Id + /// CloudEndpoints_Get + /// + /// + /// + /// Name of Cloud Endpoint object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string cloudEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudEndpointName, nameof(cloudEndpointName)); + + using var scope = _cloudEndpointClientDiagnostics.CreateScope("CloudEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cloudEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cloudEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupCollection.cs index 685400a31760..8f7354a0c225 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string syncGroupName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName} + /// + /// + /// Operation Id + /// SyncGroups_Get + /// + /// + /// + /// Name of Sync Group 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 syncGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(syncGroupName, nameof(syncGroupName)); + + using var scope = _storageSyncGroupSyncGroupsClientDiagnostics.CreateScope("StorageSyncGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageSyncGroupSyncGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, syncGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncGroupResource(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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName} + /// + /// + /// Operation Id + /// SyncGroups_Get + /// + /// + /// + /// Name of Sync Group resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string syncGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(syncGroupName, nameof(syncGroupName)); + + using var scope = _storageSyncGroupSyncGroupsClientDiagnostics.CreateScope("StorageSyncGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageSyncGroupSyncGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, syncGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncPrivateEndpointConnectionCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncPrivateEndpointConnectionCollection.cs index 87068a3d7858..ea11c5de3fa0 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncPrivateEndpointConnectionCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _storageSyncPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("StorageSyncPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageSyncPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncPrivateEndpointConnectionResource(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.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _storageSyncPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("StorageSyncPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageSyncPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncRegisteredServerCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncRegisteredServerCollection.cs index 29873ef731f1..a8b71e97ccfe 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncRegisteredServerCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncRegisteredServerCollection.cs @@ -302,6 +302,72 @@ public virtual Response Exists(Guid serverId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId} + /// + /// + /// Operation Id + /// RegisteredServers_Get + /// + /// + /// + /// GUID identifying the on-premises server. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid serverId, CancellationToken cancellationToken = default) + { + using var scope = _storageSyncRegisteredServerRegisteredServersClientDiagnostics.CreateScope("StorageSyncRegisteredServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageSyncRegisteredServerRegisteredServersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncRegisteredServerResource(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.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId} + /// + /// + /// Operation Id + /// RegisteredServers_Get + /// + /// + /// + /// GUID identifying the on-premises server. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid serverId, CancellationToken cancellationToken = default) + { + using var scope = _storageSyncRegisteredServerRegisteredServersClientDiagnostics.CreateScope("StorageSyncRegisteredServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageSyncRegisteredServerRegisteredServersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncRegisteredServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServerEndpointCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServerEndpointCollection.cs index 5453b59b0d21..cf689fecdc60 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServerEndpointCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServerEndpointCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string serverEndpointName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName} + /// + /// + /// Operation Id + /// ServerEndpoints_Get + /// + /// + /// + /// Name of Server Endpoint object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverEndpointName, nameof(serverEndpointName)); + + using var scope = _storageSyncServerEndpointServerEndpointsClientDiagnostics.CreateScope("StorageSyncServerEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageSyncServerEndpointServerEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, serverEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncServerEndpointResource(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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName} + /// + /// + /// Operation Id + /// ServerEndpoints_Get + /// + /// + /// + /// Name of Server Endpoint object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverEndpointName, nameof(serverEndpointName)); + + using var scope = _storageSyncServerEndpointServerEndpointsClientDiagnostics.CreateScope("StorageSyncServerEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageSyncServerEndpointServerEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, serverEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncServerEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceCollection.cs index 38a90bb111eb..c27651296b95 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string storageSyncServiceName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName} + /// + /// + /// Operation Id + /// StorageSyncServices_Get + /// + /// + /// + /// Name of Storage Sync Service 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 storageSyncServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageSyncServiceName, nameof(storageSyncServiceName)); + + using var scope = _storageSyncServiceClientDiagnostics.CreateScope("StorageSyncServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageSyncServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, storageSyncServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncServiceResource(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.StorageSync/storageSyncServices/{storageSyncServiceName} + /// + /// + /// Operation Id + /// StorageSyncServices_Get + /// + /// + /// + /// Name of Storage Sync Service resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageSyncServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageSyncServiceName, nameof(storageSyncServiceName)); + + using var scope = _storageSyncServiceClientDiagnostics.CreateScope("StorageSyncServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageSyncServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, storageSyncServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncWorkflowCollection.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncWorkflowCollection.cs index 3b00aeeccef3..5eaed9ec7fba 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncWorkflowCollection.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncWorkflowCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string workflowId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId} + /// + /// + /// Operation Id + /// Workflows_Get + /// + /// + /// + /// workflow Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workflowId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workflowId, nameof(workflowId)); + + using var scope = _storageSyncWorkflowWorkflowsClientDiagnostics.CreateScope("StorageSyncWorkflowCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageSyncWorkflowWorkflowsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workflowId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncWorkflowResource(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.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId} + /// + /// + /// Operation Id + /// Workflows_Get + /// + /// + /// + /// workflow Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workflowId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workflowId, nameof(workflowId)); + + using var scope = _storageSyncWorkflowWorkflowsClientDiagnostics.CreateScope("StorageSyncWorkflowCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageSyncWorkflowWorkflowsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workflowId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageSyncWorkflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamAnalyticsClusterCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamAnalyticsClusterCollection.cs index 76a4c55dcde5..a2600c2b5197 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamAnalyticsClusterCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamAnalyticsClusterCollection.cs @@ -130,6 +130,48 @@ public async Task Exists_GetACluster() Console.WriteLine($"Succeeded: {result}"); } + // Get a cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACluster() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2020-03-01-preview/examples/Cluster_Get.json + // this example is just showing the usage of "Clusters_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "sjrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StreamAnalyticsClusterResource + StreamAnalyticsClusterCollection collection = resourceGroupResource.GetStreamAnalyticsClusters(); + + // invoke the operation + string clusterName = "testcluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + StreamAnalyticsClusterResource 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 + StreamAnalyticsClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List clusters in resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamAnalyticsPrivateEndpointCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamAnalyticsPrivateEndpointCollection.cs index ea2c9b8ece0f..f838957b129f 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamAnalyticsPrivateEndpointCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamAnalyticsPrivateEndpointCollection.cs @@ -137,6 +137,49 @@ public async Task Exists_GetAPrivateEndpoint() Console.WriteLine($"Succeeded: {result}"); } + // Get a private endpoint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateEndpoint() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2020-03-01-preview/examples/PrivateEndpoint_Get.json + // this example is just showing the usage of "PrivateEndpoints_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 StreamAnalyticsClusterResource created on azure + // for more information of creating StreamAnalyticsClusterResource, please refer to the document of StreamAnalyticsClusterResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "sjrg"; + string clusterName = "testcluster"; + ResourceIdentifier streamAnalyticsClusterResourceId = StreamAnalyticsClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + StreamAnalyticsClusterResource streamAnalyticsCluster = client.GetStreamAnalyticsClusterResource(streamAnalyticsClusterResourceId); + + // get the collection of this StreamAnalyticsPrivateEndpointResource + StreamAnalyticsPrivateEndpointCollection collection = streamAnalyticsCluster.GetStreamAnalyticsPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "testpe"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointName); + StreamAnalyticsPrivateEndpointResource 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 + StreamAnalyticsPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get the private endpoints in a cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobCollection.cs index 8bc02749baef..b7b37ef3d025 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobCollection.cs @@ -263,6 +263,48 @@ public async Task Exists_GetAStreamingJobAndDoNotUseTheExpandODataQueryParameter Console.WriteLine($"Succeeded: {result}"); } + // Get a streaming job and do not use the $expand OData query parameter + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStreamingJobAndDoNotUseTheExpandODataQueryParameter() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/StreamingJob_Get_NoExpand.json + // this example is just showing the usage of "StreamingJobs_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 = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg6936"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StreamingJobResource + StreamingJobCollection collection = resourceGroupResource.GetStreamingJobs(); + + // invoke the operation + string jobName = "sj59"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + StreamingJobResource 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 + StreamingJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a streaming job and use the $expand OData query parameter to expand inputs, outputs, transformation, and functions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -329,6 +371,49 @@ public async Task Exists_GetAStreamingJobAndUseTheExpandODataQueryParameterToExp Console.WriteLine($"Succeeded: {result}"); } + // Get a streaming job and use the $expand OData query parameter to expand inputs, outputs, transformation, and functions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStreamingJobAndUseTheExpandODataQueryParameterToExpandInputsOutputsTransformationAndFunctions() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/StreamingJob_Get_Expand.json + // this example is just showing the usage of "StreamingJobs_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 = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg3276"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StreamingJobResource + StreamingJobCollection collection = resourceGroupResource.GetStreamingJobs(); + + // invoke the operation + string jobName = "sj7804"; + string expand = "inputs,outputs,transformation,functions"; + NullableResponse response = await collection.GetIfExistsAsync(jobName, expand: expand); + StreamingJobResource 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 + StreamingJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all streaming jobs in a resource group and do not use the $expand OData query parameter [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobFunctionCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobFunctionCollection.cs index 76b4a609a6f0..f0323e61cdce 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobFunctionCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobFunctionCollection.cs @@ -348,6 +348,49 @@ public async Task Exists_GetAJavaScriptFunction() Console.WriteLine($"Succeeded: {result}"); } + // Get a JavaScript function + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAJavaScriptFunction() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Function_Get_JavaScript.json + // this example is just showing the usage of "Functions_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg1637"; + string jobName = "sj8653"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobFunctionResource + StreamingJobFunctionCollection collection = streamingJob.GetStreamingJobFunctions(); + + // invoke the operation + string functionName = "function8197"; + NullableResponse response = await collection.GetIfExistsAsync(functionName); + StreamingJobFunctionResource 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 + StreamingJobFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an Azure ML function [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -414,6 +457,49 @@ public async Task Exists_GetAnAzureMLFunction() Console.WriteLine($"Succeeded: {result}"); } + // Get an Azure ML function + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAzureMLFunction() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Function_Get_AzureML.json + // this example is just showing the usage of "Functions_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg7"; + string jobName = "sj9093"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobFunctionResource + StreamingJobFunctionCollection collection = streamingJob.GetStreamingJobFunctions(); + + // invoke the operation + string functionName = "function588"; + NullableResponse response = await collection.GetIfExistsAsync(functionName); + StreamingJobFunctionResource 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 + StreamingJobFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all functions in a streaming job [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobInputCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobInputCollection.cs index 519cf162ad87..d8993244fe56 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobInputCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobInputCollection.cs @@ -435,6 +435,49 @@ public async Task Exists_GetAReferenceBlobInputWithCSVSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get a reference blob input with CSV serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAReferenceBlobInputWithCSVSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Input_Get_Reference_Blob_CSV.json + // this example is just showing the usage of "Inputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg8440"; + string jobName = "sj9597"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobInputResource + StreamingJobInputCollection collection = streamingJob.GetStreamingJobInputs(); + + // invoke the operation + string inputName = "input7225"; + NullableResponse response = await collection.GetIfExistsAsync(inputName); + StreamingJobInputResource 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 + StreamingJobInputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a stream Event Hub input with JSON serialization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -501,6 +544,49 @@ public async Task Exists_GetAStreamEventHubInputWithJSONSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get a stream Event Hub input with JSON serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStreamEventHubInputWithJSONSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Input_Get_Stream_EventHub_JSON.json + // this example is just showing the usage of "Inputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg3139"; + string jobName = "sj197"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobInputResource + StreamingJobInputCollection collection = streamingJob.GetStreamingJobInputs(); + + // invoke the operation + string inputName = "input7425"; + NullableResponse response = await collection.GetIfExistsAsync(inputName); + StreamingJobInputResource 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 + StreamingJobInputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a stream IoT Hub input with Avro serialization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -567,6 +653,49 @@ public async Task Exists_GetAStreamIoTHubInputWithAvroSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get a stream IoT Hub input with Avro serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStreamIoTHubInputWithAvroSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Input_Get_Stream_IoTHub_Avro.json + // this example is just showing the usage of "Inputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg3467"; + string jobName = "sj9742"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobInputResource + StreamingJobInputCollection collection = streamingJob.GetStreamingJobInputs(); + + // invoke the operation + string inputName = "input7970"; + NullableResponse response = await collection.GetIfExistsAsync(inputName); + StreamingJobInputResource 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 + StreamingJobInputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a stream blob input with CSV serialization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -633,6 +762,49 @@ public async Task Exists_GetAStreamBlobInputWithCSVSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get a stream blob input with CSV serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStreamBlobInputWithCSVSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Input_Get_Stream_Blob_CSV.json + // this example is just showing the usage of "Inputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg8161"; + string jobName = "sj6695"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobInputResource + StreamingJobInputCollection collection = streamingJob.GetStreamingJobInputs(); + + // invoke the operation + string inputName = "input8899"; + NullableResponse response = await collection.GetIfExistsAsync(inputName); + StreamingJobInputResource 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 + StreamingJobInputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all inputs in a streaming job [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobOutputCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobOutputCollection.cs index c8a801827d64..e1bb23664d42 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobOutputCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobOutputCollection.cs @@ -752,6 +752,49 @@ public async Task Exists_GetADocumentDBOutput() Console.WriteLine($"Succeeded: {result}"); } + // Get a DocumentDB output + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADocumentDBOutput() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_DocumentDB.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg7983"; + string jobName = "sj2331"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output3022"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a Power BI output [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -818,6 +861,49 @@ public async Task Exists_GetAPowerBIOutput() Console.WriteLine($"Succeeded: {result}"); } + // Get a Power BI output + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPowerBIOutput() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_PowerBI.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg7983"; + string jobName = "sj2331"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output3022"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a Service Bus Queue output with Avro serialization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -884,6 +970,49 @@ public async Task Exists_GetAServiceBusQueueOutputWithAvroSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get a Service Bus Queue output with Avro serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServiceBusQueueOutputWithAvroSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_ServiceBusQueue_Avro.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg3410"; + string jobName = "sj5095"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output3456"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a Service Bus Topic output with CSV serialization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -950,6 +1079,49 @@ public async Task Exists_GetAServiceBusTopicOutputWithCSVSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get a Service Bus Topic output with CSV serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServiceBusTopicOutputWithCSVSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_ServiceBusTopic_CSV.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg6450"; + string jobName = "sj7094"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output7886"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a blob output with CSV serialization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1016,6 +1188,49 @@ public async Task Exists_GetABlobOutputWithCSVSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get a blob output with CSV serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetABlobOutputWithCSVSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_Blob_CSV.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg5023"; + string jobName = "sj900"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output1623"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an Azure Data Lake Store output with JSON serialization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1082,6 +1297,49 @@ public async Task Exists_GetAnAzureDataLakeStoreOutputWithJSONSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get an Azure Data Lake Store output with JSON serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAzureDataLakeStoreOutputWithJSONSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_AzureDataLakeStore_JSON.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg6912"; + string jobName = "sj3310"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output5195"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an Azure Data Warehouse output [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1148,6 +1406,49 @@ public async Task Exists_GetAnAzureDataWarehouseOutput() Console.WriteLine($"Succeeded: {result}"); } + // Get an Azure Data Warehouse output + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAzureDataWarehouseOutput() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_DataWarehouse.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg"; + string jobName = "sjName"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "dwOutput"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an Azure Function output [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1214,6 +1515,49 @@ public async Task Exists_GetAnAzureFunctionOutput() Console.WriteLine($"Succeeded: {result}"); } + // Get an Azure Function output + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAzureFunctionOutput() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_AzureFunction.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg"; + string jobName = "sjName"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "azureFunction1"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an Azure SQL database output [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1280,6 +1624,49 @@ public async Task Exists_GetAnAzureSQLDatabaseOutput() Console.WriteLine($"Succeeded: {result}"); } + // Get an Azure SQL database output + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAzureSQLDatabaseOutput() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_AzureSQL.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg2157"; + string jobName = "sj6458"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output1755"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an Azure Table output [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1346,6 +1733,49 @@ public async Task Exists_GetAnAzureTableOutput() Console.WriteLine($"Succeeded: {result}"); } + // Get an Azure Table output + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAzureTableOutput() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_AzureTable.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg5176"; + string jobName = "sj2790"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output958"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an Event Hub output with JSON serialization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1412,6 +1842,49 @@ public async Task Exists_GetAnEventHubOutputWithJSONSerialization() Console.WriteLine($"Succeeded: {result}"); } + // Get an Event Hub output with JSON serialization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnEventHubOutputWithJSONSerialization() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Output_Get_EventHub_JSON.json + // this example is just showing the usage of "Outputs_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg6912"; + string jobName = "sj3310"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobOutputResource + StreamingJobOutputCollection collection = streamingJob.GetStreamingJobOutputs(); + + // invoke the operation + string outputName = "output5195"; + NullableResponse response = await collection.GetIfExistsAsync(outputName); + StreamingJobOutputResource 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 + StreamingJobOutputData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all outputs in a streaming job [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobTransformationCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobTransformationCollection.cs index cb52c3402508..2fbf44eafcb2 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobTransformationCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/samples/Generated/Samples/Sample_StreamingJobTransformationCollection.cs @@ -123,5 +123,48 @@ public async Task Exists_GetATransformation() Console.WriteLine($"Succeeded: {result}"); } + + // Get a transformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetATransformation() + { + // Generated from example definition: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/preview/2021-10-01-preview/examples/Transformation_Get.json + // this example is just showing the usage of "Transformations_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 StreamingJobResource created on azure + // for more information of creating StreamingJobResource, please refer to the document of StreamingJobResource + string subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; + string resourceGroupName = "sjrg4423"; + string jobName = "sj8374"; + ResourceIdentifier streamingJobResourceId = StreamingJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + StreamingJobResource streamingJob = client.GetStreamingJobResource(streamingJobResourceId); + + // get the collection of this StreamingJobTransformationResource + StreamingJobTransformationCollection collection = streamingJob.GetStreamingJobTransformations(); + + // invoke the operation + string transformationName = "transformation952"; + NullableResponse response = await collection.GetIfExistsAsync(transformationName); + StreamingJobTransformationResource 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 + StreamingJobTransformationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterCollection.cs index 5116b0381d0c..c4b072910e17 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _streamAnalyticsClusterClustersClientDiagnostics.CreateScope("StreamAnalyticsClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamAnalyticsClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamAnalyticsClusterResource(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.StreamAnalytics/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _streamAnalyticsClusterClustersClientDiagnostics.CreateScope("StreamAnalyticsClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamAnalyticsClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamAnalyticsClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsPrivateEndpointCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsPrivateEndpointCollection.cs index 4235aee3a3ea..34c39a326834 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsPrivateEndpointCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsPrivateEndpointCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string privateEndpointName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// PrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _streamAnalyticsPrivateEndpointPrivateEndpointsClientDiagnostics.CreateScope("StreamAnalyticsPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamAnalyticsPrivateEndpointPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamAnalyticsPrivateEndpointResource(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.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// PrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _streamAnalyticsPrivateEndpointPrivateEndpointsClientDiagnostics.CreateScope("StreamAnalyticsPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamAnalyticsPrivateEndpointPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamAnalyticsPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobCollection.cs index 9e818ec00f49..4032bf65253d 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobCollection.cs @@ -334,6 +334,82 @@ public virtual Response Exists(string jobName, string expand = null, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName} + /// + /// + /// Operation Id + /// StreamingJobs_Get + /// + /// + /// + /// The name of the streaming job. + /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _streamingJobClientDiagnostics.CreateScope("StreamingJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamingJobRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, jobName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobResource(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.StreamAnalytics/streamingjobs/{jobName} + /// + /// + /// Operation Id + /// StreamingJobs_Get + /// + /// + /// + /// The name of the streaming job. + /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _streamingJobClientDiagnostics.CreateScope("StreamingJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamingJobRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, jobName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobFunctionCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobFunctionCollection.cs index 3f49e0add7c9..d8e924691d86 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobFunctionCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobFunctionCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string functionName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName} + /// + /// + /// Operation Id + /// Functions_Get + /// + /// + /// + /// The name of the function. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string functionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionName, nameof(functionName)); + + using var scope = _streamingJobFunctionFunctionsClientDiagnostics.CreateScope("StreamingJobFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamingJobFunctionFunctionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, functionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobFunctionResource(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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName} + /// + /// + /// Operation Id + /// Functions_Get + /// + /// + /// + /// The name of the function. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string functionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionName, nameof(functionName)); + + using var scope = _streamingJobFunctionFunctionsClientDiagnostics.CreateScope("StreamingJobFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamingJobFunctionFunctionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, functionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobInputCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobInputCollection.cs index cf5433645088..cbf3a0734134 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobInputCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobInputCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string inputName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName} + /// + /// + /// Operation Id + /// Inputs_Get + /// + /// + /// + /// The name of the input. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string inputName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inputName, nameof(inputName)); + + using var scope = _streamingJobInputInputsClientDiagnostics.CreateScope("StreamingJobInputCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamingJobInputInputsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inputName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobInputResource(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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName} + /// + /// + /// Operation Id + /// Inputs_Get + /// + /// + /// + /// The name of the input. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string inputName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inputName, nameof(inputName)); + + using var scope = _streamingJobInputInputsClientDiagnostics.CreateScope("StreamingJobInputCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamingJobInputInputsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inputName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobInputResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobOutputCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobOutputCollection.cs index 21dbc3e17ef0..d37fdf9cbe69 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobOutputCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobOutputCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string outputName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName} + /// + /// + /// Operation Id + /// Outputs_Get + /// + /// + /// + /// The name of the output. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string outputName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(outputName, nameof(outputName)); + + using var scope = _streamingJobOutputOutputsClientDiagnostics.CreateScope("StreamingJobOutputCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamingJobOutputOutputsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outputName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobOutputResource(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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName} + /// + /// + /// Operation Id + /// Outputs_Get + /// + /// + /// + /// The name of the output. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string outputName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(outputName, nameof(outputName)); + + using var scope = _streamingJobOutputOutputsClientDiagnostics.CreateScope("StreamingJobOutputCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamingJobOutputOutputsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outputName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobOutputResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobTransformationCollection.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobTransformationCollection.cs index ab57ee03b961..ebbe1f6088b3 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobTransformationCollection.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobTransformationCollection.cs @@ -279,5 +279,79 @@ public virtual Response Exists(string transformationName, CancellationToke throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName} + /// + /// + /// Operation Id + /// Transformations_Get + /// + /// + /// + /// The name of the transformation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string transformationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(transformationName, nameof(transformationName)); + + using var scope = _streamingJobTransformationTransformationsClientDiagnostics.CreateScope("StreamingJobTransformationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _streamingJobTransformationTransformationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, transformationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobTransformationResource(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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName} + /// + /// + /// Operation Id + /// Transformations_Get + /// + /// + /// + /// The name of the transformation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string transformationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(transformationName, nameof(transformationName)); + + using var scope = _streamingJobTransformationTransformationsClientDiagnostics.CreateScope("StreamingJobTransformationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _streamingJobTransformationTransformationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, transformationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StreamingJobTransformationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/samples/Generated/Samples/Sample_BillingAccountPolicyCollection.cs b/sdk/subscription/Azure.ResourceManager.Subscription/samples/Generated/Samples/Sample_BillingAccountPolicyCollection.cs index 47f8bf11d999..5bad828a24ab 100644 --- a/sdk/subscription/Azure.ResourceManager.Subscription/samples/Generated/Samples/Sample_BillingAccountPolicyCollection.cs +++ b/sdk/subscription/Azure.ResourceManager.Subscription/samples/Generated/Samples/Sample_BillingAccountPolicyCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -73,5 +74,44 @@ public async Task Exists_GetBillingAccountPolicy() Console.WriteLine($"Succeeded: {result}"); } + + // GetBillingAccountPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBillingAccountPolicy() + { + // Generated from example definition: specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getBillingAccountPolicy.json + // this example is just showing the usage of "BillingAccount_GetPolicy" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this BillingAccountPolicyResource + BillingAccountPolicyCollection collection = tenantResource.GetBillingAccountPolicies(); + + // invoke the operation + string billingAccountId = "testBillingAccountId"; + NullableResponse response = await collection.GetIfExistsAsync(billingAccountId); + BillingAccountPolicyResource 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 + BillingAccountPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/samples/Generated/Samples/Sample_SubscriptionAliasCollection.cs b/sdk/subscription/Azure.ResourceManager.Subscription/samples/Generated/Samples/Sample_SubscriptionAliasCollection.cs index f1d5c118dbfc..41552712ec04 100644 --- a/sdk/subscription/Azure.ResourceManager.Subscription/samples/Generated/Samples/Sample_SubscriptionAliasCollection.cs +++ b/sdk/subscription/Azure.ResourceManager.Subscription/samples/Generated/Samples/Sample_SubscriptionAliasCollection.cs @@ -127,6 +127,45 @@ public async Task Exists_GetAlias() Console.WriteLine($"Succeeded: {result}"); } + // GetAlias + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAlias() + { + // Generated from example definition: specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getAlias.json + // this example is just showing the usage of "Alias_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this SubscriptionAliasResource + SubscriptionAliasCollection collection = tenantResource.GetSubscriptionAliases(); + + // invoke the operation + string aliasName = "aliasForNewSub"; + NullableResponse response = await collection.GetIfExistsAsync(aliasName); + SubscriptionAliasResource 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 + SubscriptionAliasData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListAlias [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/BillingAccountPolicyCollection.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/BillingAccountPolicyCollection.cs index 50a3bde56878..c6747065eefb 100644 --- a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/BillingAccountPolicyCollection.cs +++ b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/BillingAccountPolicyCollection.cs @@ -194,5 +194,79 @@ public virtual Response Exists(string billingAccountId, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default + /// + /// + /// Operation Id + /// BillingAccount_GetPolicy + /// + /// + /// + /// Billing Account Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string billingAccountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + using var scope = _billingAccountPolicyBillingAccountClientDiagnostics.CreateScope("BillingAccountPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _billingAccountPolicyBillingAccountRestClient.GetPolicyAsync(billingAccountId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingAccountPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default + /// + /// + /// Operation Id + /// BillingAccount_GetPolicy + /// + /// + /// + /// Billing Account Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string billingAccountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + using var scope = _billingAccountPolicyBillingAccountClientDiagnostics.CreateScope("BillingAccountPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _billingAccountPolicyBillingAccountRestClient.GetPolicy(billingAccountId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BillingAccountPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/SubscriptionAliasCollection.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/SubscriptionAliasCollection.cs index cfef380b3feb..82aad3751e27 100644 --- a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/SubscriptionAliasCollection.cs +++ b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/SubscriptionAliasCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string aliasName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Subscription/aliases/{aliasName} + /// + /// + /// Operation Id + /// Alias_Get + /// + /// + /// + /// AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string aliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName)); + + using var scope = _subscriptionAliasAliasClientDiagnostics.CreateScope("SubscriptionAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionAliasAliasRestClient.GetAsync(aliasName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Subscription/aliases/{aliasName} + /// + /// + /// Operation Id + /// Alias_Get + /// + /// + /// + /// AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string aliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName)); + + using var scope = _subscriptionAliasAliasClientDiagnostics.CreateScope("SubscriptionAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionAliasAliasRestClient.Get(aliasName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_ProblemClassificationCollection.cs b/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_ProblemClassificationCollection.cs index 8a20893bf49a..79975a04dc1d 100644 --- a/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_ProblemClassificationCollection.cs +++ b/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_ProblemClassificationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -112,5 +113,46 @@ public async Task Exists_GetsDetailsOfProblemClassificationForAzureService() Console.WriteLine($"Succeeded: {result}"); } + + // Gets details of problemClassification for Azure service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsDetailsOfProblemClassificationForAzureService() + { + // Generated from example definition: specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetProblemClassification.json + // this example is just showing the usage of "ProblemClassifications_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 SupportAzureServiceResource created on azure + // for more information of creating SupportAzureServiceResource, please refer to the document of SupportAzureServiceResource + string serviceName = "service_guid"; + ResourceIdentifier supportAzureServiceResourceId = SupportAzureServiceResource.CreateResourceIdentifier(serviceName); + SupportAzureServiceResource supportAzureService = client.GetSupportAzureServiceResource(supportAzureServiceResourceId); + + // get the collection of this ProblemClassificationResource + ProblemClassificationCollection collection = supportAzureService.GetProblemClassifications(); + + // invoke the operation + string problemClassificationName = "problemClassification_guid"; + NullableResponse response = await collection.GetIfExistsAsync(problemClassificationName); + ProblemClassificationResource 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 + ProblemClassificationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportAzureServiceCollection.cs b/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportAzureServiceCollection.cs index 83ae76b1d5be..07d948e72016 100644 --- a/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportAzureServiceCollection.cs +++ b/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportAzureServiceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -106,5 +107,44 @@ public async Task Exists_GetsDetailsOfTheAzureService() Console.WriteLine($"Succeeded: {result}"); } + + // Gets details of the Azure service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsDetailsOfTheAzureService() + { + // Generated from example definition: specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetService.json + // this example is just showing the usage of "Services_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this SupportAzureServiceResource + SupportAzureServiceCollection collection = tenantResource.GetSupportAzureServices(); + + // invoke the operation + string serviceName = "service_guid"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + SupportAzureServiceResource 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 + SupportAzureServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportTicketCollection.cs b/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportTicketCollection.cs index 8aa38ff978eb..bba219d35478 100644 --- a/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportTicketCollection.cs +++ b/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportTicketCollection.cs @@ -260,6 +260,47 @@ public async Task Exists_GetDetailsOfASubscriptionTicket() Console.WriteLine($"Succeeded: {result}"); } + // Get details of a subscription ticket + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsOfASubscriptionTicket() + { + // Generated from example definition: specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetSubscriptionSupportTicketDetails.json + // this example is just showing the usage of "SupportTickets_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SupportTicketResource + SupportTicketCollection collection = subscriptionResource.GetSupportTickets(); + + // invoke the operation + string supportTicketName = "testticket"; + NullableResponse response = await collection.GetIfExistsAsync(supportTicketName); + SupportTicketResource 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 + SupportTicketData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a ticket for Billing related issues [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportTicketCommunicationCollection.cs b/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportTicketCommunicationCollection.cs index 43ba521e9944..c2a1bec12a36 100644 --- a/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportTicketCommunicationCollection.cs +++ b/sdk/support/Azure.ResourceManager.Support/samples/Generated/Samples/Sample_SupportTicketCommunicationCollection.cs @@ -191,6 +191,48 @@ public async Task Exists_GetCommunicationDetailsForASubscriptionSupportTicket() Console.WriteLine($"Succeeded: {result}"); } + // Get communication details for a subscription support ticket + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCommunicationDetailsForASubscriptionSupportTicket() + { + // Generated from example definition: specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetCommunicationDetailsForSubscriptionSupportTicket.json + // this example is just showing the usage of "Communications_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 SupportTicketResource created on azure + // for more information of creating SupportTicketResource, please refer to the document of SupportTicketResource + string subscriptionId = "subid"; + string supportTicketName = "testticket"; + ResourceIdentifier supportTicketResourceId = SupportTicketResource.CreateResourceIdentifier(subscriptionId, supportTicketName); + SupportTicketResource supportTicket = client.GetSupportTicketResource(supportTicketResourceId); + + // get the collection of this SupportTicketCommunicationResource + SupportTicketCommunicationCollection collection = supportTicket.GetSupportTicketCommunications(); + + // invoke the operation + string communicationName = "testmessage"; + NullableResponse response = await collection.GetIfExistsAsync(communicationName); + SupportTicketCommunicationResource 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 + SupportTicketCommunicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AddCommunicationToSubscriptionTicket [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/ProblemClassificationCollection.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/ProblemClassificationCollection.cs index 193138f618f4..5bf7585c8fde 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/ProblemClassificationCollection.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/ProblemClassificationCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string problemClassificationName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName} + /// + /// + /// Operation Id + /// ProblemClassifications_Get + /// + /// + /// + /// Name of problem classification. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string problemClassificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(problemClassificationName, nameof(problemClassificationName)); + + using var scope = _problemClassificationClientDiagnostics.CreateScope("ProblemClassificationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _problemClassificationRestClient.GetAsync(Id.Name, problemClassificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProblemClassificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName} + /// + /// + /// Operation Id + /// ProblemClassifications_Get + /// + /// + /// + /// Name of problem classification. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string problemClassificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(problemClassificationName, nameof(problemClassificationName)); + + using var scope = _problemClassificationClientDiagnostics.CreateScope("ProblemClassificationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _problemClassificationRestClient.Get(Id.Name, problemClassificationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProblemClassificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceCollection.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceCollection.cs index 2c1b37d3c35f..4efae178f247 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceCollection.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceCollection.cs @@ -240,6 +240,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Name of the Azure service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _supportAzureServiceServicesClientDiagnostics.CreateScope("SupportAzureServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _supportAzureServiceServicesRestClient.GetAsync(serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SupportAzureServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Name of the Azure service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _supportAzureServiceServicesClientDiagnostics.CreateScope("SupportAzureServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _supportAzureServiceServicesRestClient.Get(serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SupportAzureServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCollection.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCollection.cs index 6f4b46b22fd1..79e275a1f51e 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCollection.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string supportTicketName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName} + /// + /// + /// Operation Id + /// SupportTickets_Get + /// + /// + /// + /// Support ticket name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string supportTicketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(supportTicketName, nameof(supportTicketName)); + + using var scope = _supportTicketClientDiagnostics.CreateScope("SupportTicketCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _supportTicketRestClient.GetAsync(Id.SubscriptionId, supportTicketName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SupportTicketResource(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}/providers/Microsoft.Support/supportTickets/{supportTicketName} + /// + /// + /// Operation Id + /// SupportTickets_Get + /// + /// + /// + /// Support ticket name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string supportTicketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(supportTicketName, nameof(supportTicketName)); + + using var scope = _supportTicketClientDiagnostics.CreateScope("SupportTicketCollection.GetIfExists"); + scope.Start(); + try + { + var response = _supportTicketRestClient.Get(Id.SubscriptionId, supportTicketName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SupportTicketResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCommunicationCollection.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCommunicationCollection.cs index 8c231d46b5de..55b87c13ca2e 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCommunicationCollection.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCommunicationCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string communicationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName} + /// + /// + /// Operation Id + /// Communications_Get + /// + /// + /// + /// Communication name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string communicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(communicationName, nameof(communicationName)); + + using var scope = _supportTicketCommunicationCommunicationsClientDiagnostics.CreateScope("SupportTicketCommunicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _supportTicketCommunicationCommunicationsRestClient.GetAsync(Id.SubscriptionId, Id.Name, communicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SupportTicketCommunicationResource(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}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName} + /// + /// + /// Operation Id + /// Communications_Get + /// + /// + /// + /// Communication name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string communicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(communicationName, nameof(communicationName)); + + using var scope = _supportTicketCommunicationCommunicationsClientDiagnostics.CreateScope("SupportTicketCommunicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _supportTicketCommunicationCommunicationsRestClient.Get(Id.SubscriptionId, Id.Name, communicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SupportTicketCommunicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseAadOnlyAuthenticationCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseAadOnlyAuthenticationCollection.cs index 1bb31f4f7856..a03648625f9c 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseAadOnlyAuthenticationCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseAadOnlyAuthenticationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAzureActiveDirectoryOnlyAuthenticationProperty() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure Active Directory Only Authentication property + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureActiveDirectoryOnlyAuthenticationProperty() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetAzureADOnlyAuthentication.json + // this example is just showing the usage of "AzureADOnlyAuthentications_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "workspace-6852"; + string workspaceName = "workspace-2080"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseAadOnlyAuthenticationResource + SynapseAadOnlyAuthenticationCollection collection = synapseWorkspace.GetSynapseAadOnlyAuthentications(); + + // invoke the operation + SynapseAadOnlyAuthenticationName azureADOnlyAuthenticationName = SynapseAadOnlyAuthenticationName.Default; + NullableResponse response = await collection.GetIfExistsAsync(azureADOnlyAuthenticationName); + SynapseAadOnlyAuthenticationResource 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 + SynapseAadOnlyAuthenticationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Azure Active Directory Only Authentication property [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseAttachedDatabaseConfigurationCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseAttachedDatabaseConfigurationCollection.cs index cf4bf649393a..1153db7a7746 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseAttachedDatabaseConfigurationCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseAttachedDatabaseConfigurationCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_KustoPoolAttachedDatabaseConfigurationsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoPoolAttachedDatabaseConfigurationsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoPoolAttachedDatabaseConfigurationsGet() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/KustoPoolAttachedDatabaseConfigurationsGet.json + // this example is just showing the usage of "KustoPoolAttachedDatabaseConfigurations_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 SynapseKustoPoolResource created on azure + // for more information of creating SynapseKustoPoolResource, please refer to the document of SynapseKustoPoolResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string workspaceName = "kustorptest"; + string kustoPoolName = "kustoclusterrptest4"; + ResourceIdentifier synapseKustoPoolResourceId = SynapseKustoPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, kustoPoolName); + SynapseKustoPoolResource synapseKustoPool = client.GetSynapseKustoPoolResource(synapseKustoPoolResourceId); + + // get the collection of this SynapseAttachedDatabaseConfigurationResource + SynapseAttachedDatabaseConfigurationCollection collection = synapseKustoPool.GetSynapseAttachedDatabaseConfigurations(); + + // invoke the operation + string attachedDatabaseConfigurationName = "attachedDatabaseConfigurations1"; + NullableResponse response = await collection.GetIfExistsAsync(attachedDatabaseConfigurationName); + SynapseAttachedDatabaseConfigurationResource 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 + SynapseAttachedDatabaseConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoPoolAttachedDatabaseConfigurationsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseBigDataPoolInfoCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseBigDataPoolInfoCollection.cs index 3e52f455647b..943d44c3a37c 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseBigDataPoolInfoCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseBigDataPoolInfoCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetABigDataPool() Console.WriteLine($"Succeeded: {result}"); } + // Get a Big Data pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetABigDataPool() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/GetBigDataPool.json + // this example is just showing the usage of "BigDataPools_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "01234567-89ab-4def-0123-456789abcdef"; + string resourceGroupName = "ExampleResourceGroup"; + string workspaceName = "ExampleWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseBigDataPoolInfoResource + SynapseBigDataPoolInfoCollection collection = synapseWorkspace.GetSynapseBigDataPoolInfos(); + + // invoke the operation + string bigDataPoolName = "ExamplePool"; + NullableResponse response = await collection.GetIfExistsAsync(bigDataPoolName); + SynapseBigDataPoolInfoResource 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 + SynapseBigDataPoolInfoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a Big Data pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseClusterPrincipalAssignmentCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseClusterPrincipalAssignmentCollection.cs index 824ddb228629..c0d47cf0d178 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseClusterPrincipalAssignmentCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseClusterPrincipalAssignmentCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_KustoPoolPrincipalAssignmentsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoPoolPrincipalAssignmentsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoPoolPrincipalAssignmentsGet() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/KustoPoolPrincipalAssignmentsGet.json + // this example is just showing the usage of "KustoPoolPrincipalAssignments_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 SynapseKustoPoolResource created on azure + // for more information of creating SynapseKustoPoolResource, please refer to the document of SynapseKustoPoolResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string workspaceName = "synapseWorkspaceName"; + string kustoPoolName = "kustoclusterrptest4"; + ResourceIdentifier synapseKustoPoolResourceId = SynapseKustoPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, kustoPoolName); + SynapseKustoPoolResource synapseKustoPool = client.GetSynapseKustoPoolResource(synapseKustoPoolResourceId); + + // get the collection of this SynapseClusterPrincipalAssignmentResource + SynapseClusterPrincipalAssignmentCollection collection = synapseKustoPool.GetSynapseClusterPrincipalAssignments(); + + // invoke the operation + string principalAssignmentName = "kustoprincipal1"; + NullableResponse response = await collection.GetIfExistsAsync(principalAssignmentName); + SynapseClusterPrincipalAssignmentResource 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 + SynapseClusterPrincipalAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoPoolPrincipalAssignmentsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataConnectionCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataConnectionCollection.cs index d81198776149..9eee15bb5b7b 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataConnectionCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataConnectionCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_KustoPoolDataConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoPoolDataConnectionsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoPoolDataConnectionsGet() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/KustoPoolDataConnectionsGet.json + // this example is just showing the usage of "KustoPoolDataConnections_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 SynapseDatabaseResource created on azure + // for more information of creating SynapseDatabaseResource, please refer to the document of SynapseDatabaseResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string workspaceName = "synapseWorkspaceName"; + string kustoPoolName = "kustoclusterrptest4"; + string databaseName = "KustoDatabase8"; + ResourceIdentifier synapseDatabaseResourceId = SynapseDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, kustoPoolName, databaseName); + SynapseDatabaseResource synapseDatabase = client.GetSynapseDatabaseResource(synapseDatabaseResourceId); + + // get the collection of this SynapseDataConnectionResource + SynapseDataConnectionCollection collection = synapseDatabase.GetSynapseDataConnections(); + + // invoke the operation + string dataConnectionName = "DataConnections8"; + NullableResponse response = await collection.GetIfExistsAsync(dataConnectionName); + SynapseDataConnectionResource 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 + SynapseDataConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoPoolDataConnectionsCreateOrUpdate.json [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataMaskingRuleCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataMaskingRuleCollection.cs index 7d3d74cdc38d..713d263f2b83 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataMaskingRuleCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataMaskingRuleCollection.cs @@ -269,6 +269,50 @@ public async Task Exists_GetDataMaskingRule() Console.WriteLine($"Succeeded: {result}"); } + // Get data masking rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDataMaskingRule() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/DataMaskingRuleGet.json + // this example is just showing the usage of "DataMaskingRules_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 SynapseDataMaskingPolicyResource created on azure + // for more information of creating SynapseDataMaskingPolicyResource, please refer to the document of SynapseDataMaskingPolicyResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-6852"; + string workspaceName = "sqlcrudtest-2080"; + string sqlPoolName = "sqlcrudtest-331"; + ResourceIdentifier synapseDataMaskingPolicyResourceId = SynapseDataMaskingPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseDataMaskingPolicyResource synapseDataMaskingPolicy = client.GetSynapseDataMaskingPolicyResource(synapseDataMaskingPolicyResourceId); + + // get the collection of this SynapseDataMaskingRuleResource + SynapseDataMaskingRuleCollection collection = synapseDataMaskingPolicy.GetSynapseDataMaskingRules(); + + // invoke the operation + string dataMaskingRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(dataMaskingRuleName); + SynapseDataMaskingRuleResource 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 + SynapseDataMaskingRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List data masking rules [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataWarehouseUserActivityCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataWarehouseUserActivityCollection.cs index d9ea0e70a70d..168bfe0d7c85 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataWarehouseUserActivityCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDataWarehouseUserActivityCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,5 +85,49 @@ public async Task Exists_GetASQLAnalyticsPoolUserActivity() Console.WriteLine($"Succeeded: {result}"); } + + // Get a SQL Analytics pool user activity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASQLAnalyticsPoolUserActivity() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolUserActivity.json + // this example is just showing the usage of "SqlPoolDataWarehouseUserActivities_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string workspaceName = "testsvr"; + string sqlPoolName = "testdb"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseDataWarehouseUserActivityResource + SynapseDataWarehouseUserActivityCollection collection = synapseSqlPool.GetSynapseDataWarehouseUserActivities(); + + // invoke the operation + SynapseDataWarehouseUserActivityName dataWarehouseUserActivityName = SynapseDataWarehouseUserActivityName.Current; + NullableResponse response = await collection.GetIfExistsAsync(dataWarehouseUserActivityName); + SynapseDataWarehouseUserActivityResource 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 + SynapseDataWarehouseUserActivityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDatabaseCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDatabaseCollection.cs index 37a757934047..0cf27daf61c4 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDatabaseCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDatabaseCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_KustoPoolDatabasesGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoPoolDatabasesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoPoolDatabasesGet() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/KustoPoolDatabasesGet.json + // this example is just showing the usage of "KustoPoolDatabases_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 SynapseKustoPoolResource created on azure + // for more information of creating SynapseKustoPoolResource, please refer to the document of SynapseKustoPoolResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string workspaceName = "synapseWorkspaceName"; + string kustoPoolName = "kustoclusterrptest4"; + ResourceIdentifier synapseKustoPoolResourceId = SynapseKustoPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, kustoPoolName); + SynapseKustoPoolResource synapseKustoPool = client.GetSynapseKustoPoolResource(synapseKustoPoolResourceId); + + // get the collection of this SynapseDatabaseResource + SynapseDatabaseCollection collection = synapseKustoPool.GetSynapseDatabases(); + + // invoke the operation + string databaseName = "KustoDatabase8"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + SynapseDatabaseResource 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 + SynapseDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoPoolDatabasesCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDatabasePrincipalAssignmentCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDatabasePrincipalAssignmentCollection.cs index 95fe99c089f4..772ad58d8dfe 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDatabasePrincipalAssignmentCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDatabasePrincipalAssignmentCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_KustoPoolDatabasePrincipalAssignmentsGet() Console.WriteLine($"Succeeded: {result}"); } + // KustoPoolDatabasePrincipalAssignmentsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoPoolDatabasePrincipalAssignmentsGet() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/KustoPoolDatabasePrincipalAssignmentsGet.json + // this example is just showing the usage of "KustoPoolDatabasePrincipalAssignments_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 SynapseDatabaseResource created on azure + // for more information of creating SynapseDatabaseResource, please refer to the document of SynapseDatabaseResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string workspaceName = "synapseWorkspaceName"; + string kustoPoolName = "kustoclusterrptest4"; + string databaseName = "Kustodatabase8"; + ResourceIdentifier synapseDatabaseResourceId = SynapseDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, kustoPoolName, databaseName); + SynapseDatabaseResource synapseDatabase = client.GetSynapseDatabaseResource(synapseDatabaseResourceId); + + // get the collection of this SynapseDatabasePrincipalAssignmentResource + SynapseDatabasePrincipalAssignmentCollection collection = synapseDatabase.GetSynapseDatabasePrincipalAssignments(); + + // invoke the operation + string principalAssignmentName = "kustoprincipal1"; + NullableResponse response = await collection.GetIfExistsAsync(principalAssignmentName); + SynapseDatabasePrincipalAssignmentResource 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 + SynapseDatabasePrincipalAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // KustoPoolDatabasePrincipalAssignmentsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDedicatedSqlMinimalTlsSettingCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDedicatedSqlMinimalTlsSettingCollection.cs index 2616d3d237c5..8ac62a787945 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDedicatedSqlMinimalTlsSettingCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseDedicatedSqlMinimalTlsSettingCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetWorkspaceManagedSqlServerDedicatedSqlMinimalTlsSetti Console.WriteLine($"Succeeded: {result}"); } + // Get workspace managed sql server dedicated sql minimal tls settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspaceManagedSqlServerDedicatedSqlMinimalTlsSettings() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetWorkspaceManagedSqlServerDedicatedSQLminimalTlsSettings.json + // this example is just showing the usage of "WorkspaceManagedSqlServerDedicatedSQLMinimalTlsSettings_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "workspace-6852"; + string workspaceName = "workspace-2080"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseDedicatedSqlMinimalTlsSettingResource + SynapseDedicatedSqlMinimalTlsSettingCollection collection = synapseWorkspace.GetSynapseDedicatedSqlMinimalTlsSettings(); + + // invoke the operation + string dedicatedSQLminimalTlsSettingsName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(dedicatedSQLminimalTlsSettingsName); + SynapseDedicatedSqlMinimalTlsSettingResource 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 + SynapseDedicatedSqlMinimalTlsSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List dedicated sql minimal tls settings of the workspace managed sql server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseEncryptionProtectorCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseEncryptionProtectorCollection.cs index 5b9ed3c6a45d..3096b1e49b9d 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseEncryptionProtectorCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseEncryptionProtectorCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetWorkspaceManagedSqlServerSEncryptionProtector() Console.WriteLine($"Succeeded: {result}"); } + // Get workspace managed sql Server's encryption protector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspaceManagedSqlServerSEncryptionProtector() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetWorkspaceManagedSqlServerEncryptionProtector.json + // this example is just showing the usage of "WorkspaceManagedSqlServerEncryptionProtector_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "wsg-7398"; + string workspaceName = "testWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseEncryptionProtectorResource + SynapseEncryptionProtectorCollection collection = synapseWorkspace.GetSynapseEncryptionProtectors(); + + // invoke the operation + SynapseEncryptionProtectorName encryptionProtectorName = SynapseEncryptionProtectorName.Current; + NullableResponse response = await collection.GetIfExistsAsync(encryptionProtectorName); + SynapseEncryptionProtectorResource 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 + SynapseEncryptionProtectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update the encryption protector to key vault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseExtendedServerBlobAuditingPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseExtendedServerBlobAuditingPolicyCollection.cs index f3fa42cdba49..4cffa683d1d7 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseExtendedServerBlobAuditingPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseExtendedServerBlobAuditingPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetWorkspaceManagedSqlServersExtendedBlobAuditingSettin Console.WriteLine($"Succeeded: {result}"); } + // Get workspace managed sql servers' extended blob auditing settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspaceManagedSqlServersExtendedBlobAuditingSettings() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetWorkspaceManagedSqlExtendedServerBlobAuditingSettings.json + // this example is just showing the usage of "WorkspaceManagedSqlServerExtendedBlobAuditingPolicies_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "wsg-7398"; + string workspaceName = "testWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseExtendedServerBlobAuditingPolicyResource + SynapseExtendedServerBlobAuditingPolicyCollection collection = synapseWorkspace.GetSynapseExtendedServerBlobAuditingPolicies(); + + // invoke the operation + SynapseBlobAuditingPolicyName blobAuditingPolicyName = SynapseBlobAuditingPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(blobAuditingPolicyName); + SynapseExtendedServerBlobAuditingPolicyResource 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 + SynapseExtendedServerBlobAuditingPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update workspace managed sql server's extended blob auditing policy of with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseGeoBackupPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseGeoBackupPolicyCollection.cs index cdf1238a2387..38664950d840 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseGeoBackupPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseGeoBackupPolicyCollection.cs @@ -161,5 +161,49 @@ public async Task Exists_GetSqlPoolGeoBackupPolicy() Console.WriteLine($"Succeeded: {result}"); } + + // Get Sql pool geo backup policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSqlPoolGeoBackupPolicy() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolGeoBackupPolicy.json + // this example is just showing the usage of "SqlPoolGeoBackupPolicies_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-4799"; + string workspaceName = "sqlcrudtest-5961"; + string sqlPoolName = "testdw"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseGeoBackupPolicyResource + SynapseGeoBackupPolicyCollection collection = synapseSqlPool.GetSynapseGeoBackupPolicies(); + + // invoke the operation + SynapseGeoBackupPolicyName geoBackupPolicyName = SynapseGeoBackupPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(geoBackupPolicyName); + SynapseGeoBackupPolicyResource 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 + SynapseGeoBackupPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseIPFirewallRuleInfoCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseIPFirewallRuleInfoCollection.cs index a276c8df7037..4b06cb598c41 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseIPFirewallRuleInfoCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseIPFirewallRuleInfoCollection.cs @@ -161,5 +161,48 @@ public async Task Exists_GetIPFirewallRule() Console.WriteLine($"Succeeded: {result}"); } + + // Get IP firewall rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetIPFirewallRule() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetIpFirewallRule.json + // this example is just showing the usage of "IpFirewallRules_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "01234567-89ab-4def-0123-456789abcdef"; + string resourceGroupName = "ExampleResourceGroup"; + string workspaceName = "ExampleWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseIPFirewallRuleInfoResource + SynapseIPFirewallRuleInfoCollection collection = synapseWorkspace.GetSynapseIPFirewallRuleInfos(); + + // invoke the operation + string ruleName = "ExampleIpFirewallRule"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + SynapseIPFirewallRuleInfoResource 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 + SynapseIPFirewallRuleInfoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseIntegrationRuntimeCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseIntegrationRuntimeCollection.cs index 78c7df62b0ed..80bf16d14be4 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseIntegrationRuntimeCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseIntegrationRuntimeCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetIntegrationRuntime() Console.WriteLine($"Succeeded: {result}"); } + // Get integration runtime + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetIntegrationRuntime() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/IntegrationRuntimes_Get.json + // this example is just showing the usage of "IntegrationRuntimes_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string workspaceName = "exampleWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseIntegrationRuntimeResource + SynapseIntegrationRuntimeCollection collection = synapseWorkspace.GetSynapseIntegrationRuntimes(); + + // invoke the operation + string integrationRuntimeName = "exampleIntegrationRuntime"; + NullableResponse response = await collection.GetIfExistsAsync(integrationRuntimeName); + SynapseIntegrationRuntimeResource 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 + SynapseIntegrationRuntimeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create integration runtime [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseKeyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseKeyCollection.cs index e7b23f46f82a..81362a9be292 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseKeyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseKeyCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetAWorkspaceKey() Console.WriteLine($"Succeeded: {result}"); } + // Get a workspace key + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkspaceKey() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetKey.json + // this example is just showing the usage of "Keys_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "ExampleResourceGroup"; + string workspaceName = "ExampleWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseKeyResource + SynapseKeyCollection collection = synapseWorkspace.GetSynapseKeys(); + + // invoke the operation + string keyName = "somekey"; + NullableResponse response = await collection.GetIfExistsAsync(keyName); + SynapseKeyResource 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 + SynapseKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a workspace key [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseKustoPoolCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseKustoPoolCollection.cs index 8d00bd2e0248..d9e054a62c2d 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseKustoPoolCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseKustoPoolCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_KustoPoolsGet() Console.WriteLine($"Succeeded: {result}"); } + // kustoPoolsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KustoPoolsGet() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/KustoPoolsGet.json + // this example is just showing the usage of "KustoPools_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "12345678-1234-1234-1234-123456789098"; + string resourceGroupName = "kustorptest"; + string workspaceName = "synapseWorkspaceName"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseKustoPoolResource + SynapseKustoPoolCollection collection = synapseWorkspace.GetSynapseKustoPools(); + + // invoke the operation + string kustoPoolName = "kustoclusterrptest4"; + NullableResponse response = await collection.GetIfExistsAsync(kustoPoolName); + SynapseKustoPoolResource 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 + SynapseKustoPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // kustoPoolsCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseLibraryCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseLibraryCollection.cs index 4bccc2050d45..c6363fc2bc4a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseLibraryCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseLibraryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetLibraryByName() Console.WriteLine($"Succeeded: {result}"); } + // Get Library by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLibraryByName() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/Library_Get.json + // this example is just showing the usage of "Library_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string workspaceName = "exampleWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseLibraryResource + SynapseLibraryCollection collection = synapseWorkspace.GetSynapseLibraries(); + + // invoke the operation + string libraryName = "exampleLibraryName.jar"; + NullableResponse response = await collection.GetIfExistsAsync(libraryName); + SynapseLibraryResource 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 + SynapseLibraryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List libraries in a workspace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateEndpointConnectionCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateEndpointConnectionCollection.cs index c7b36cc0a8cb..4f58544d060d 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateEndpointConnectionCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get private endpoint connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpointConnection() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "01234567-89ab-4def-0123-456789abcdef"; + string resourceGroupName = "ExampleResourceGroup"; + string workspaceName = "ExampleWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapsePrivateEndpointConnectionResource + SynapsePrivateEndpointConnectionCollection collection = synapseWorkspace.GetSynapsePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "ExamplePrivateEndpointConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + SynapsePrivateEndpointConnectionResource 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 + SynapsePrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve private endpoint connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.cs index fd02bc01963c..a85a3c46efb9 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetAPrivateLinkHub() Console.WriteLine($"Succeeded: {result}"); } + + // Get a privateLinkHub + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateLinkHub() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/PrivateEndpointConnectionsPrivateLinkHub_Get.json + // this example is just showing the usage of "PrivateEndpointConnectionsPrivateLinkHub_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 SynapsePrivateLinkHubResource created on azure + // for more information of creating SynapsePrivateLinkHubResource, please refer to the document of SynapsePrivateLinkHubResource + string subscriptionId = "48b08652-d7a1-4d52-b13f-5a2471dce57b"; + string resourceGroupName = "gh-res-grp"; + string privateLinkHubName = "pe0"; + ResourceIdentifier synapsePrivateLinkHubResourceId = SynapsePrivateLinkHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateLinkHubName); + SynapsePrivateLinkHubResource synapsePrivateLinkHub = client.GetSynapsePrivateLinkHubResource(synapsePrivateLinkHubResourceId); + + // get the collection of this SynapsePrivateEndpointConnectionForPrivateLinkHubResource + SynapsePrivateEndpointConnectionForPrivateLinkHubCollection collection = synapsePrivateLinkHub.GetSynapsePrivateEndpointConnectionForPrivateLinkHubs(); + + // invoke the operation + string privateEndpointConnectionName = "pe0-f3ed30f5-338c-4855-a542-24a403694ad2"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + SynapsePrivateEndpointConnectionForPrivateLinkHubResource 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 + SynapsePrivateEndpointConnectionForPrivateLinkHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateLinkHubCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateLinkHubCollection.cs index bc493cc5eac0..d72b80537bc2 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateLinkHubCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateLinkHubCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetAPrivateLinkHub() Console.WriteLine($"Succeeded: {result}"); } + // Get a privateLinkHub + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateLinkHub() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetPrivateLinkHub.json + // this example is just showing the usage of "PrivateLinkHubs_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-1111-2222-3333-444444444444"; + string resourceGroupName = "resourceGroup1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SynapsePrivateLinkHubResource + SynapsePrivateLinkHubCollection collection = resourceGroupResource.GetSynapsePrivateLinkHubs(); + + // invoke the operation + string privateLinkHubName = "privateLinkHub1"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkHubName); + SynapsePrivateLinkHubResource 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 + SynapsePrivateLinkHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a privateLinkHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateLinkResourceCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateLinkResourceCollection.cs index e6b5e68c8102..caf38f6e8fad 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateLinkResourceCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapsePrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetPrivateLinkResourcesForPrivateLinkHub() Console.WriteLine($"Succeeded: {result}"); } + + // Get private link resources for private link hub + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateLinkResourcesForPrivateLinkHub() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetPrivateLinkHubPrivateLinkResource.json + // this example is just showing the usage of "PrivateLinkHubPrivateLinkResources_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 SynapsePrivateLinkHubResource created on azure + // for more information of creating SynapsePrivateLinkHubResource, please refer to the document of SynapsePrivateLinkHubResource + string subscriptionId = "01234567-89ab-4def-0123-456789abcdef"; + string resourceGroupName = "ExampleResourceGroup"; + string privateLinkHubName = "ExamplePrivateLinkHub"; + ResourceIdentifier synapsePrivateLinkHubResourceId = SynapsePrivateLinkHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateLinkHubName); + SynapsePrivateLinkHubResource synapsePrivateLinkHub = client.GetSynapsePrivateLinkHubResource(synapsePrivateLinkHubResourceId); + + // get the collection of this SynapsePrivateLinkResource + SynapsePrivateLinkResourceCollection collection = synapsePrivateLinkHub.GetSynapsePrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "sql"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + SynapsePrivateLinkResource 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 + SynapsePrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRecoverableSqlPoolCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRecoverableSqlPoolCollection.cs index 6692452de552..0e6587cf1fba 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRecoverableSqlPoolCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRecoverableSqlPoolCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetRecoverableSqlPoolsForTheServer() Console.WriteLine($"Succeeded: {result}"); } + + // Get recoverable sql pools for the server + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRecoverableSqlPoolsForTheServer() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetWorkspaceManagedSqlServerRecoverableSqlPool.json + // this example is just showing the usage of "WorkspaceManagedSqlServerRecoverableSqlPools_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "wsg-7398"; + string workspaceName = "testWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseRecoverableSqlPoolResource + SynapseRecoverableSqlPoolCollection collection = synapseWorkspace.GetSynapseRecoverableSqlPools(); + + // invoke the operation + string sqlPoolName = "recoverableSqlpools-1235"; + NullableResponse response = await collection.GetIfExistsAsync(sqlPoolName); + SynapseRecoverableSqlPoolResource 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 + SynapseRecoverableSqlPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseReplicationLinkCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseReplicationLinkCollection.cs index 3da7773df10f..b23465f288e9 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseReplicationLinkCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseReplicationLinkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_ListsASqlAnalyticPoolSReplicationLinks() Console.WriteLine($"Succeeded: {result}"); } + + // Lists a Sql Analytic pool's replication links + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ListsASqlAnalyticPoolSReplicationLinks() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/SqlPoolReplicationLinks_GetByName.json + // this example is just showing the usage of "SqlPoolReplicationLinks_GetByName" 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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-4799"; + string workspaceName = "sqlcrudtest-6440"; + string sqlPoolName = "testdb"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseReplicationLinkResource + SynapseReplicationLinkCollection collection = synapseSqlPool.GetSynapseReplicationLinks(); + + // invoke the operation + string linkId = "5b301b68-03f6-4b26-b0f4-73ebb8634238"; + NullableResponse response = await collection.GetIfExistsAsync(linkId); + SynapseReplicationLinkResource 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 + SynapseReplicationLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRestorableDroppedSqlPoolCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRestorableDroppedSqlPoolCollection.cs index 43888066d7b0..72f714e560af 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRestorableDroppedSqlPoolCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRestorableDroppedSqlPoolCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetARestorableDroppedSqlPool() Console.WriteLine($"Succeeded: {result}"); } + // Get a restorable dropped Sql pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARestorableDroppedSqlPool() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/RestorableDroppedSqlPoolGet.json + // this example is just showing the usage of "RestorableDroppedSqlPools_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "restorabledroppeddatabasetest-1257"; + string workspaceName = "restorabledroppeddatabasetest-2389"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseRestorableDroppedSqlPoolResource + SynapseRestorableDroppedSqlPoolCollection collection = synapseWorkspace.GetSynapseRestorableDroppedSqlPools(); + + // invoke the operation + string restorableDroppedSqlPoolId = "restorabledroppeddatabasetest-7654,131403269876900000"; + NullableResponse response = await collection.GetIfExistsAsync(restorableDroppedSqlPoolId); + SynapseRestorableDroppedSqlPoolResource 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 + SynapseRestorableDroppedSqlPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get list of restorable dropped Sql pools [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRestorePointCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRestorePointCollection.cs index 07b422917aff..b0da3dc198b5 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRestorePointCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseRestorePointCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetsASqlPoolRestorePoint() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a Sql pool restore point. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsASqlPoolRestorePoint() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/SqlPoolRestorePointsGet.json + // this example is just showing the usage of "SqlPoolRestorePoints_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string workspaceName = "testws"; + string sqlPoolName = "testpool"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseRestorePointResource + SynapseRestorePointCollection collection = synapseSqlPool.GetSynapseRestorePoints(); + + // invoke the operation + string restorePointName = "131546477590000000"; + NullableResponse response = await collection.GetIfExistsAsync(restorePointName); + SynapseRestorePointResource 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 + SynapseRestorePointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSensitivityLabelCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSensitivityLabelCollection.cs index 1383b3b98dfb..02f24d86e435 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSensitivityLabelCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSensitivityLabelCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -90,5 +91,52 @@ public async Task Exists_GetsTheSensitivityLabelOfAGivenColumn() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the sensitivity label of a given column + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheSensitivityLabelOfAGivenColumn() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolColumnSensitivityLabelGet.json + // this example is just showing the usage of "SqlPoolSensitivityLabels_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 SynapseSqlPoolColumnResource created on azure + // for more information of creating SynapseSqlPoolColumnResource, please refer to the document of SynapseSqlPoolColumnResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string workspaceName = "myServer"; + string sqlPoolName = "myDatabase"; + string schemaName = "dbo"; + string tableName = "myTable"; + string columnName = "myColumn"; + ResourceIdentifier synapseSqlPoolColumnResourceId = SynapseSqlPoolColumnResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName); + SynapseSqlPoolColumnResource synapseSqlPoolColumn = client.GetSynapseSqlPoolColumnResource(synapseSqlPoolColumnResourceId); + + // get the collection of this SynapseSensitivityLabelResource + SynapseSensitivityLabelCollection collection = synapseSqlPoolColumn.GetSynapseSensitivityLabels(); + + // invoke the operation + SynapseSensitivityLabelSource sensitivityLabelSource = SynapseSensitivityLabelSource.Current; + NullableResponse response = await collection.GetIfExistsAsync(sensitivityLabelSource); + SynapseSensitivityLabelResource 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 + SynapseSensitivityLabelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerBlobAuditingPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerBlobAuditingPolicyCollection.cs index 0d56c9c87ccb..04004d2f0bdc 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerBlobAuditingPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerBlobAuditingPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetBlobAuditingSettingOfWorkspaceManagedSqlServer() Console.WriteLine($"Succeeded: {result}"); } + // Get blob auditing setting of workspace managed sql Server + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBlobAuditingSettingOfWorkspaceManagedSqlServer() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetWorkspaceManagedSqlServerBlobAuditingSettings.json + // this example is just showing the usage of "WorkspaceManagedSqlServerBlobAuditingPolicies_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "wsg-7398"; + string workspaceName = "testWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseServerBlobAuditingPolicyResource + SynapseServerBlobAuditingPolicyCollection collection = synapseWorkspace.GetSynapseServerBlobAuditingPolicies(); + + // invoke the operation + SynapseBlobAuditingPolicyName blobAuditingPolicyName = SynapseBlobAuditingPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(blobAuditingPolicyName); + SynapseServerBlobAuditingPolicyResource 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 + SynapseServerBlobAuditingPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update blob auditing policy of workspace SQL Server with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerSecurityAlertPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerSecurityAlertPolicyCollection.cs index 336e60dd71d0..c219af39babe 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerSecurityAlertPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerSecurityAlertPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetWorkspaceManagedSqlServerSSecurityAlertPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get workspace managed sql Server's security alert policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspaceManagedSqlServerSSecurityAlertPolicy() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetWorkspaceManagedSqlServerSecurityAlertPolicy.json + // this example is just showing the usage of "WorkspaceManagedSqlServerSecurityAlertPolicy_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "wsg-7398"; + string workspaceName = "testWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseServerSecurityAlertPolicyResource + SynapseServerSecurityAlertPolicyCollection collection = synapseWorkspace.GetSynapseServerSecurityAlertPolicies(); + + // invoke the operation + SqlServerSecurityAlertPolicyName securityAlertPolicyName = SqlServerSecurityAlertPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(securityAlertPolicyName); + SynapseServerSecurityAlertPolicyResource 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 + SynapseServerSecurityAlertPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a workspace managed sql server's threat detection policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerVulnerabilityAssessmentCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerVulnerabilityAssessmentCollection.cs index 5e5e00982033..d431fa799310 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerVulnerabilityAssessmentCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseServerVulnerabilityAssessmentCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetWorkspaceManagedSqlServerSVulnerabilityAssessment() Console.WriteLine($"Succeeded: {result}"); } + // Get workspace managed sql Server's vulnerability assessment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspaceManagedSqlServerSVulnerabilityAssessment() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetWorkspaceManagedSqlServerVulnerabilityAssessment.json + // this example is just showing the usage of "WorkspaceManagedSqlServerVulnerabilityAssessments_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "wsg-7398"; + string workspaceName = "testWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseServerVulnerabilityAssessmentResource + SynapseServerVulnerabilityAssessmentCollection collection = synapseWorkspace.GetSynapseServerVulnerabilityAssessments(); + + // invoke the operation + SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName = SynapseVulnerabilityAssessmentName.Default; + NullableResponse response = await collection.GetIfExistsAsync(vulnerabilityAssessmentName); + SynapseServerVulnerabilityAssessmentResource 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 + SynapseServerVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update a workspace managed sql server's vulnerability assessment with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSparkConfigurationCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSparkConfigurationCollection.cs index 2cbebceb5083..562d80333c35 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSparkConfigurationCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSparkConfigurationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetSparkConfigurationByName() Console.WriteLine($"Succeeded: {result}"); } + // Get SparkConfiguration by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSparkConfigurationByName() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/SparkConfiguration_Get.json + // this example is just showing the usage of "SparkConfiguration_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string workspaceName = "exampleWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseSparkConfigurationResource + SynapseSparkConfigurationCollection collection = synapseWorkspace.GetSynapseSparkConfigurations(); + + // invoke the operation + string sparkConfigurationName = "exampleSparkConfigurationName"; + NullableResponse response = await collection.GetIfExistsAsync(sparkConfigurationName); + SynapseSparkConfigurationResource 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 + SynapseSparkConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List sparkConfigurations in a workspace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolCollection.cs index 61506dcc73d4..2d2d313b5b3c 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetASQLAnalyticsPool() Console.WriteLine($"Succeeded: {result}"); } + // Get a SQL Analytics pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASQLAnalyticsPool() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPool.json + // this example is just showing the usage of "SqlPools_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-6852"; + string workspaceName = "sqlcrudtest-2080"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseSqlPoolResource + SynapseSqlPoolCollection collection = synapseWorkspace.GetSynapseSqlPools(); + + // invoke the operation + string sqlPoolName = "sqlcrudtest-9187"; + NullableResponse response = await collection.GetIfExistsAsync(sqlPoolName); + SynapseSqlPoolResource 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 + SynapseSqlPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a SQL Analytics pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolColumnCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolColumnCollection.cs index d29fd23ea33a..7ad50c48cd6d 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolColumnCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolColumnCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -127,5 +128,51 @@ public async Task Exists_GetDatabaseColumn() Console.WriteLine($"Succeeded: {result}"); } + + // Get database column + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatabaseColumn() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/SqlPoolColumnGet.json + // this example is just showing the usage of "SqlPoolColumns_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 SynapseSqlPoolTableResource created on azure + // for more information of creating SynapseSqlPoolTableResource, please refer to the document of SynapseSqlPoolTableResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string workspaceName = "serverName"; + string sqlPoolName = "myDatabase"; + string schemaName = "dbo"; + string tableName = "table1"; + ResourceIdentifier synapseSqlPoolTableResourceId = SynapseSqlPoolTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName); + SynapseSqlPoolTableResource synapseSqlPoolTable = client.GetSynapseSqlPoolTableResource(synapseSqlPoolTableResourceId); + + // get the collection of this SynapseSqlPoolColumnResource + SynapseSqlPoolColumnCollection collection = synapseSqlPoolTable.GetSynapseSqlPoolColumns(); + + // invoke the operation + string columnName = "column1"; + NullableResponse response = await collection.GetIfExistsAsync(columnName); + SynapseSqlPoolColumnResource 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 + SynapseSqlPoolColumnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolConnectionPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolConnectionPolicyCollection.cs index 003558008ca1..0a935ee78875 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolConnectionPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolConnectionPolicyCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,5 +85,49 @@ public async Task Exists_GetAConnectionPolicyOfASQLAnalyticsPool() Console.WriteLine($"Succeeded: {result}"); } + + // Get a connection policy of a SQL Analytics pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAConnectionPolicyOfASQLAnalyticsPool() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolConnectionPolicy.json + // this example is just showing the usage of "SqlPoolConnectionPolicies_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "blobauditingtest-6852"; + string workspaceName = "blobauditingtest-2080"; + string sqlPoolName = "testdb"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseSqlPoolConnectionPolicyResource + SynapseSqlPoolConnectionPolicyCollection collection = synapseSqlPool.GetSynapseSqlPoolConnectionPolicies(); + + // invoke the operation + SqlPoolConnectionPolicyName connectionPolicyName = SqlPoolConnectionPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(connectionPolicyName); + SynapseSqlPoolConnectionPolicyResource 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 + SynapseSqlPoolConnectionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolSchemaCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolSchemaCollection.cs index 733a605d37e2..f0aa19f754d5 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolSchemaCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolSchemaCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetDatabaseSchema() Console.WriteLine($"Succeeded: {result}"); } + + // Get database schema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatabaseSchema() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/SqlPoolSchemaGet.json + // this example is just showing the usage of "SqlPoolSchemas_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string workspaceName = "serverName"; + string sqlPoolName = "myDatabase"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseSqlPoolSchemaResource + SynapseSqlPoolSchemaCollection collection = synapseSqlPool.GetSynapseSqlPoolSchemas(); + + // invoke the operation + string schemaName = "dbo"; + NullableResponse response = await collection.GetIfExistsAsync(schemaName); + SynapseSqlPoolSchemaResource 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 + SynapseSqlPoolSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolSecurityAlertPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolSecurityAlertPolicyCollection.cs index 1ebff49e5473..57eb1033c406 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolSecurityAlertPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolSecurityAlertPolicyCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetASecurityAlertOfASQLAnalyticsPool() Console.WriteLine($"Succeeded: {result}"); } + // Get a security alert of a SQL Analytics pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASecurityAlertOfASQLAnalyticsPool() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolSecurityAlert.json + // this example is just showing the usage of "SqlPoolSecurityAlertPolicies_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "securityalert-6852"; + string workspaceName = "securityalert-2080"; + string sqlPoolName = "testdb"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseSqlPoolSecurityAlertPolicyResource + SynapseSqlPoolSecurityAlertPolicyCollection collection = synapseSqlPool.GetSynapseSqlPoolSecurityAlertPolicies(); + + // invoke the operation + SqlPoolSecurityAlertPolicyName securityAlertPolicyName = SqlPoolSecurityAlertPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(securityAlertPolicyName); + SynapseSqlPoolSecurityAlertPolicyResource 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 + SynapseSqlPoolSecurityAlertPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a Sql pool's threat detection policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolTableCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolTableCollection.cs index b9947e19057e..1961b8f6b0ec 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolTableCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolTableCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetDatabaseTable() Console.WriteLine($"Succeeded: {result}"); } + + // Get database table + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatabaseTable() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/SqlPoolTableGet.json + // this example is just showing the usage of "SqlPoolTables_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 SynapseSqlPoolSchemaResource created on azure + // for more information of creating SynapseSqlPoolSchemaResource, please refer to the document of SynapseSqlPoolSchemaResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string workspaceName = "serverName"; + string sqlPoolName = "myDatabase"; + string schemaName = "dbo"; + ResourceIdentifier synapseSqlPoolSchemaResourceId = SynapseSqlPoolSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName, schemaName); + SynapseSqlPoolSchemaResource synapseSqlPoolSchema = client.GetSynapseSqlPoolSchemaResource(synapseSqlPoolSchemaResourceId); + + // get the collection of this SynapseSqlPoolTableResource + SynapseSqlPoolTableCollection collection = synapseSqlPoolSchema.GetSynapseSqlPoolTables(); + + // invoke the operation + string tableName = "table1"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + SynapseSqlPoolTableResource 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 + SynapseSqlPoolTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolVulnerabilityAssessmentCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolVulnerabilityAssessmentCollection.cs index be12bb09fd32..92bea3e29609 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolVulnerabilityAssessmentCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolVulnerabilityAssessmentCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetASqlPoolSVulnerabilityAssessment() Console.WriteLine($"Succeeded: {result}"); } + // Get a Sql pool's vulnerability assessment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASqlPoolSVulnerabilityAssessment() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolVulnerabilityAssessment.json + // this example is just showing the usage of "SqlPoolVulnerabilityAssessments_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4799"; + string workspaceName = "vulnerabilityaseessmenttest-6440"; + string sqlPoolName = "testdb"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseSqlPoolVulnerabilityAssessmentResource + SynapseSqlPoolVulnerabilityAssessmentCollection collection = synapseSqlPool.GetSynapseSqlPoolVulnerabilityAssessments(); + + // invoke the operation + SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName = SynapseVulnerabilityAssessmentName.Default; + NullableResponse response = await collection.GetIfExistsAsync(vulnerabilityAssessmentName); + SynapseSqlPoolVulnerabilityAssessmentResource 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 + SynapseSqlPoolVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a database's vulnerability assessment with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.cs index 63c8dad27560..ade1637eb19e 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.cs @@ -144,5 +144,51 @@ public async Task Exists_GetsASqlPoolSVulnerabilityAssessmentRuleBaseline() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a Sql pool's vulnerability assessment rule baseline. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsASqlPoolSVulnerabilityAssessmentRuleBaseline() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/SqlPoolVulnerabilityAssessmentRuleBaselineGet.json + // this example is just showing the usage of "SqlPoolVulnerabilityAssessmentRuleBaselines_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 SynapseSqlPoolVulnerabilityAssessmentResource created on azure + // for more information of creating SynapseSqlPoolVulnerabilityAssessmentResource, please refer to the document of SynapseSqlPoolVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4711"; + string workspaceName = "vulnerabilityaseessmenttest-6411"; + string sqlPoolName = "testdb"; + SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName = SynapseVulnerabilityAssessmentName.Default; + ResourceIdentifier synapseSqlPoolVulnerabilityAssessmentResourceId = SynapseSqlPoolVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName); + SynapseSqlPoolVulnerabilityAssessmentResource synapseSqlPoolVulnerabilityAssessment = client.GetSynapseSqlPoolVulnerabilityAssessmentResource(synapseSqlPoolVulnerabilityAssessmentResourceId); + + // get the collection of this SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource + SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection collection = synapseSqlPoolVulnerabilityAssessment.GetSynapseSqlPoolVulnerabilityAssessmentRuleBaselines(); + + // invoke the operation + string ruleId = "VA1001"; + SynapseVulnerabilityAssessmentPolicyBaselineName baselineName = SynapseVulnerabilityAssessmentPolicyBaselineName.Master; + NullableResponse response = await collection.GetIfExistsAsync(ruleId, baselineName); + SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource 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 + SynapseSqlPoolVulnerabilityAssessmentRuleBaselineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseTransparentDataEncryptionCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseTransparentDataEncryptionCollection.cs index 635c9dfa2d8a..2a9317ad5dbb 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseTransparentDataEncryptionCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseTransparentDataEncryptionCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetTransparentDataEncryptionConfigurationOfASQLAnalytic Console.WriteLine($"Succeeded: {result}"); } + // Get transparent data encryption configuration of a SQL Analytics pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTransparentDataEncryptionConfigurationOfASQLAnalyticsPool() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolTransparentDataEncryption.json + // this example is just showing the usage of "SqlPoolTransparentDataEncryptions_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-6852"; + string workspaceName = "sqlcrudtest-2080"; + string sqlPoolName = "sqlcrudtest-9187"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseTransparentDataEncryptionResource + SynapseTransparentDataEncryptionCollection collection = synapseSqlPool.GetSynapseTransparentDataEncryptions(); + + // invoke the operation + SynapseTransparentDataEncryptionName transparentDataEncryptionName = SynapseTransparentDataEncryptionName.Current; + NullableResponse response = await collection.GetIfExistsAsync(transparentDataEncryptionName); + SynapseTransparentDataEncryptionResource 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 + SynapseTransparentDataEncryptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a Sql pool's transparent data encryption configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseVulnerabilityAssessmentScanRecordCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseVulnerabilityAssessmentScanRecordCollection.cs index 97a926056533..3a253e3d365a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseVulnerabilityAssessmentScanRecordCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseVulnerabilityAssessmentScanRecordCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -125,5 +126,50 @@ public async Task Exists_GetsADatabaseVulnerabilityAssessmentScanRecordByScanID( Console.WriteLine($"Succeeded: {result}"); } + + // Gets a database vulnerability assessment scan record by scan ID + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseVulnerabilityAssessmentScanRecordByScanID() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/SqlPoolVulnerabilityAssessmentScanRecordsGet.json + // this example is just showing the usage of "SqlPoolVulnerabilityAssessmentScans_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 SynapseSqlPoolVulnerabilityAssessmentResource created on azure + // for more information of creating SynapseSqlPoolVulnerabilityAssessmentResource, please refer to the document of SynapseSqlPoolVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityassessmenttest-4711"; + string workspaceName = "vulnerabilityassessmenttest-6411"; + string sqlPoolName = "testdb"; + SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName = SynapseVulnerabilityAssessmentName.Default; + ResourceIdentifier synapseSqlPoolVulnerabilityAssessmentResourceId = SynapseSqlPoolVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName); + SynapseSqlPoolVulnerabilityAssessmentResource synapseSqlPoolVulnerabilityAssessment = client.GetSynapseSqlPoolVulnerabilityAssessmentResource(synapseSqlPoolVulnerabilityAssessmentResourceId); + + // get the collection of this SynapseVulnerabilityAssessmentScanRecordResource + SynapseVulnerabilityAssessmentScanRecordCollection collection = synapseSqlPoolVulnerabilityAssessment.GetSynapseVulnerabilityAssessmentScanRecords(); + + // invoke the operation + string scanId = "scan001"; + NullableResponse response = await collection.GetIfExistsAsync(scanId); + SynapseVulnerabilityAssessmentScanRecordResource 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 + SynapseVulnerabilityAssessmentScanRecordData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkloadClassifierCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkloadClassifierCollection.cs index f8015d61c7ac..bedc1c5e7aa5 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkloadClassifierCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkloadClassifierCollection.cs @@ -87,6 +87,51 @@ public async Task Exists_GetAWorkloadClassifierForSQLAnalyticsPoolSWorkloadGroup Console.WriteLine($"Succeeded: {result}"); } + // Get a workload classifier for SQL Analytics pool's workload group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkloadClassifierForSQLAnalyticsPoolSWorkloadGroup() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolWorkloadGroupWorkloadClassifier.json + // this example is just showing the usage of "SqlPoolWorkloadClassifier_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 SynapseWorkloadGroupResource created on azure + // for more information of creating SynapseWorkloadGroupResource, please refer to the document of SynapseWorkloadGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-6852"; + string workspaceName = "sqlcrudtest-2080"; + string sqlPoolName = "sqlcrudtest-9187"; + string workloadGroupName = "wlm_workloadgroup"; + ResourceIdentifier synapseWorkloadGroupResourceId = SynapseWorkloadGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName, workloadGroupName); + SynapseWorkloadGroupResource synapseWorkloadGroup = client.GetSynapseWorkloadGroupResource(synapseWorkloadGroupResourceId); + + // get the collection of this SynapseWorkloadClassifierResource + SynapseWorkloadClassifierCollection collection = synapseWorkloadGroup.GetSynapseWorkloadClassifiers(); + + // invoke the operation + string workloadClassifierName = "wlm_classifier"; + NullableResponse response = await collection.GetIfExistsAsync(workloadClassifierName); + SynapseWorkloadClassifierResource 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 + SynapseWorkloadClassifierData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a workload classifier with all properties specified. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkloadGroupCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkloadGroupCollection.cs index 27f24cf36cda..a8fc29535039 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkloadGroupCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkloadGroupCollection.cs @@ -85,6 +85,50 @@ public async Task Exists_GetAAWorkloadGroupOfASQLAnalyticsPool() Console.WriteLine($"Succeeded: {result}"); } + // Get a a workload group of a SQL Analytics pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAAWorkloadGroupOfASQLAnalyticsPool() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolWorkloadGroup.json + // this example is just showing the usage of "SqlPoolWorkloadGroup_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 SynapseSqlPoolResource created on azure + // for more information of creating SynapseSqlPoolResource, please refer to the document of SynapseSqlPoolResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-6852"; + string workspaceName = "sqlcrudtest-2080"; + string sqlPoolName = "sqlcrudtest-9187"; + ResourceIdentifier synapseSqlPoolResourceId = SynapseSqlPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, sqlPoolName); + SynapseSqlPoolResource synapseSqlPool = client.GetSynapseSqlPoolResource(synapseSqlPoolResourceId); + + // get the collection of this SynapseWorkloadGroupResource + SynapseWorkloadGroupCollection collection = synapseSqlPool.GetSynapseWorkloadGroups(); + + // invoke the operation + string workloadGroupName = "smallrc"; + NullableResponse response = await collection.GetIfExistsAsync(workloadGroupName); + SynapseWorkloadGroupResource 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 + SynapseWorkloadGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a workload group with all properties specified. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkspaceCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkspaceCollection.cs index c5193e0b68f0..4ebfa84d0a37 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkspaceCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkspaceCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetAWorkspace() Console.WriteLine($"Succeeded: {result}"); } + // Get a workspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkspace() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetWorkspace.json + // this example is just showing the usage of "Workspaces_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-1111-2222-3333-444444444444"; + string resourceGroupName = "resourceGroup1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SynapseWorkspaceResource + SynapseWorkspaceCollection collection = resourceGroupResource.GetSynapseWorkspaces(); + + // invoke the operation + string workspaceName = "workspace1"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + SynapseWorkspaceResource 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 + SynapseWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a workspace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkspacePrivateLinkResourceCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkspacePrivateLinkResourceCollection.cs index 8c75f49c150a..1ffc2766275a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkspacePrivateLinkResourceCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/samples/Generated/Samples/Sample_SynapseWorkspacePrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetPrivateLinkResourcesForWorkspace() Console.WriteLine($"Succeeded: {result}"); } + + // Get private link resources for workspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateLinkResourcesForWorkspace() + { + // Generated from example definition: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetPrivateLinkResource.json + // this example is just showing the usage of "PrivateLinkResources_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 SynapseWorkspaceResource created on azure + // for more information of creating SynapseWorkspaceResource, please refer to the document of SynapseWorkspaceResource + string subscriptionId = "01234567-89ab-4def-0123-456789abcdef"; + string resourceGroupName = "ExampleResourceGroup"; + string workspaceName = "ExampleWorkspace"; + ResourceIdentifier synapseWorkspaceResourceId = SynapseWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + SynapseWorkspaceResource synapseWorkspace = client.GetSynapseWorkspaceResource(synapseWorkspaceResourceId); + + // get the collection of this SynapseWorkspacePrivateLinkResource + SynapseWorkspacePrivateLinkResourceCollection collection = synapseWorkspace.GetSynapseWorkspacePrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "sql"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + SynapseWorkspacePrivateLinkResource 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 + SynapsePrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAadOnlyAuthenticationCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAadOnlyAuthenticationCollection.cs index d578c88e5ddc..f1d9d9dfd8fc 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAadOnlyAuthenticationCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAadOnlyAuthenticationCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SynapseAadOnlyAuthenticationName azureADOnl } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName} + /// + /// + /// Operation Id + /// AzureADOnlyAuthentications_Get + /// + /// + /// + /// name of the property. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseAadOnlyAuthenticationName azureADOnlyAuthenticationName, CancellationToken cancellationToken = default) + { + using var scope = _synapseAadOnlyAuthenticationAzureADOnlyAuthenticationsClientDiagnostics.CreateScope("SynapseAadOnlyAuthenticationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseAadOnlyAuthenticationAzureADOnlyAuthenticationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, azureADOnlyAuthenticationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseAadOnlyAuthenticationResource(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.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName} + /// + /// + /// Operation Id + /// AzureADOnlyAuthentications_Get + /// + /// + /// + /// name of the property. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseAadOnlyAuthenticationName azureADOnlyAuthenticationName, CancellationToken cancellationToken = default) + { + using var scope = _synapseAadOnlyAuthenticationAzureADOnlyAuthenticationsClientDiagnostics.CreateScope("SynapseAadOnlyAuthenticationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseAadOnlyAuthenticationAzureADOnlyAuthenticationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, azureADOnlyAuthenticationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseAadOnlyAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAttachedDatabaseConfigurationCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAttachedDatabaseConfigurationCollection.cs index 9156baf399f6..62ef647af32f 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAttachedDatabaseConfigurationCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAttachedDatabaseConfigurationCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string attachedDatabaseConfigurationName, C } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName} + /// + /// + /// Operation Id + /// KustoPoolAttachedDatabaseConfigurations_Get + /// + /// + /// + /// The name of the attached database configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string attachedDatabaseConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedDatabaseConfigurationName, nameof(attachedDatabaseConfigurationName)); + + using var scope = _synapseAttachedDatabaseConfigurationKustoPoolAttachedDatabaseConfigurationsClientDiagnostics.CreateScope("SynapseAttachedDatabaseConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseAttachedDatabaseConfigurationKustoPoolAttachedDatabaseConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, attachedDatabaseConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseAttachedDatabaseConfigurationResource(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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName} + /// + /// + /// Operation Id + /// KustoPoolAttachedDatabaseConfigurations_Get + /// + /// + /// + /// The name of the attached database configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string attachedDatabaseConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedDatabaseConfigurationName, nameof(attachedDatabaseConfigurationName)); + + using var scope = _synapseAttachedDatabaseConfigurationKustoPoolAttachedDatabaseConfigurationsClientDiagnostics.CreateScope("SynapseAttachedDatabaseConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseAttachedDatabaseConfigurationKustoPoolAttachedDatabaseConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, attachedDatabaseConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseAttachedDatabaseConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseBigDataPoolInfoCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseBigDataPoolInfoCollection.cs index f98ca5ed08fb..0982df07c0bb 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseBigDataPoolInfoCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseBigDataPoolInfoCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string bigDataPoolName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName} + /// + /// + /// Operation Id + /// BigDataPools_Get + /// + /// + /// + /// Big Data pool name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string bigDataPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bigDataPoolName, nameof(bigDataPoolName)); + + using var scope = _synapseBigDataPoolInfoBigDataPoolsClientDiagnostics.CreateScope("SynapseBigDataPoolInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseBigDataPoolInfoBigDataPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, bigDataPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseBigDataPoolInfoResource(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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName} + /// + /// + /// Operation Id + /// BigDataPools_Get + /// + /// + /// + /// Big Data pool name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string bigDataPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bigDataPoolName, nameof(bigDataPoolName)); + + using var scope = _synapseBigDataPoolInfoBigDataPoolsClientDiagnostics.CreateScope("SynapseBigDataPoolInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseBigDataPoolInfoBigDataPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, bigDataPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseBigDataPoolInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseClusterPrincipalAssignmentCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseClusterPrincipalAssignmentCollection.cs index a2acde927db3..35a879768b87 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseClusterPrincipalAssignmentCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseClusterPrincipalAssignmentCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string principalAssignmentName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName} + /// + /// + /// Operation Id + /// KustoPoolPrincipalAssignments_Get + /// + /// + /// + /// The name of the Kusto principalAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string principalAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(principalAssignmentName, nameof(principalAssignmentName)); + + using var scope = _synapseClusterPrincipalAssignmentKustoPoolPrincipalAssignmentsClientDiagnostics.CreateScope("SynapseClusterPrincipalAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseClusterPrincipalAssignmentKustoPoolPrincipalAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, principalAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseClusterPrincipalAssignmentResource(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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName} + /// + /// + /// Operation Id + /// KustoPoolPrincipalAssignments_Get + /// + /// + /// + /// The name of the Kusto principalAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string principalAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(principalAssignmentName, nameof(principalAssignmentName)); + + using var scope = _synapseClusterPrincipalAssignmentKustoPoolPrincipalAssignmentsClientDiagnostics.CreateScope("SynapseClusterPrincipalAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseClusterPrincipalAssignmentKustoPoolPrincipalAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, principalAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseClusterPrincipalAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataConnectionCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataConnectionCollection.cs index 27a98361d113..5b5636c2b3e2 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataConnectionCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string dataConnectionName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName} + /// + /// + /// Operation Id + /// KustoPoolDataConnections_Get + /// + /// + /// + /// The name of the data connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + using var scope = _synapseDataConnectionKustoPoolDataConnectionsClientDiagnostics.CreateScope("SynapseDataConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseDataConnectionKustoPoolDataConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, dataConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDataConnectionResource(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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName} + /// + /// + /// Operation Id + /// KustoPoolDataConnections_Get + /// + /// + /// + /// The name of the data connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + using var scope = _synapseDataConnectionKustoPoolDataConnectionsClientDiagnostics.CreateScope("SynapseDataConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseDataConnectionKustoPoolDataConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, dataConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDataConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingRuleCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingRuleCollection.cs index cc8cf9709ded..e61ebf00de20 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingRuleCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingRuleCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string dataMaskingRuleName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName} + /// + /// + /// Operation Id + /// DataMaskingRules_Get + /// + /// + /// + /// The name of the data masking rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataMaskingRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataMaskingRuleName, nameof(dataMaskingRuleName)); + + using var scope = _synapseDataMaskingRuleDataMaskingRulesClientDiagnostics.CreateScope("SynapseDataMaskingRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseDataMaskingRuleDataMaskingRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, dataMaskingRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDataMaskingRuleResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName} + /// + /// + /// Operation Id + /// DataMaskingRules_Get + /// + /// + /// + /// The name of the data masking rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataMaskingRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataMaskingRuleName, nameof(dataMaskingRuleName)); + + using var scope = _synapseDataMaskingRuleDataMaskingRulesClientDiagnostics.CreateScope("SynapseDataMaskingRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseDataMaskingRuleDataMaskingRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, dataMaskingRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDataMaskingRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataWarehouseUserActivityCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataWarehouseUserActivityCollection.cs index 49e4b04bd4b3..2859136e43b2 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataWarehouseUserActivityCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataWarehouseUserActivityCollection.cs @@ -178,5 +178,71 @@ public virtual Response Exists(SynapseDataWarehouseUserActivityName dataWa throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName} + /// + /// + /// Operation Id + /// SqlPoolDataWarehouseUserActivities_Get + /// + /// + /// + /// The activity name of the Sql pool. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseDataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default) + { + using var scope = _synapseDataWarehouseUserActivitySqlPoolDataWarehouseUserActivitiesClientDiagnostics.CreateScope("SynapseDataWarehouseUserActivityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseDataWarehouseUserActivitySqlPoolDataWarehouseUserActivitiesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataWarehouseUserActivityName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDataWarehouseUserActivityResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName} + /// + /// + /// Operation Id + /// SqlPoolDataWarehouseUserActivities_Get + /// + /// + /// + /// The activity name of the Sql pool. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseDataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default) + { + using var scope = _synapseDataWarehouseUserActivitySqlPoolDataWarehouseUserActivitiesClientDiagnostics.CreateScope("SynapseDataWarehouseUserActivityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseDataWarehouseUserActivitySqlPoolDataWarehouseUserActivitiesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataWarehouseUserActivityName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDataWarehouseUserActivityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseCollection.cs index d6b5cbf1e1f3..2ae736312c07 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName} + /// + /// + /// Operation Id + /// KustoPoolDatabases_Get + /// + /// + /// + /// The name of the database in the Kusto pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _synapseDatabaseKustoPoolDatabasesClientDiagnostics.CreateScope("SynapseDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseDatabaseKustoPoolDatabasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDatabaseResource(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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName} + /// + /// + /// Operation Id + /// KustoPoolDatabases_Get + /// + /// + /// + /// The name of the database in the Kusto pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _synapseDatabaseKustoPoolDatabasesClientDiagnostics.CreateScope("SynapseDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseDatabaseKustoPoolDatabasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabasePrincipalAssignmentCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabasePrincipalAssignmentCollection.cs index d335599d26ff..08f729ed1adb 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabasePrincipalAssignmentCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabasePrincipalAssignmentCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string principalAssignmentName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName} + /// + /// + /// Operation Id + /// KustoPoolDatabasePrincipalAssignments_Get + /// + /// + /// + /// The name of the Kusto principalAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string principalAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(principalAssignmentName, nameof(principalAssignmentName)); + + using var scope = _synapseDatabasePrincipalAssignmentKustoPoolDatabasePrincipalAssignmentsClientDiagnostics.CreateScope("SynapseDatabasePrincipalAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseDatabasePrincipalAssignmentKustoPoolDatabasePrincipalAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, principalAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDatabasePrincipalAssignmentResource(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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName} + /// + /// + /// Operation Id + /// KustoPoolDatabasePrincipalAssignments_Get + /// + /// + /// + /// The name of the Kusto principalAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string principalAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(principalAssignmentName, nameof(principalAssignmentName)); + + using var scope = _synapseDatabasePrincipalAssignmentKustoPoolDatabasePrincipalAssignmentsClientDiagnostics.CreateScope("SynapseDatabasePrincipalAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseDatabasePrincipalAssignmentKustoPoolDatabasePrincipalAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, principalAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDatabasePrincipalAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDedicatedSqlMinimalTlsSettingCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDedicatedSqlMinimalTlsSettingCollection.cs index 316c6c831d41..4688fad57cfe 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDedicatedSqlMinimalTlsSettingCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDedicatedSqlMinimalTlsSettingCollection.cs @@ -320,6 +320,80 @@ public virtual Response Exists(string dedicatedSQLminimalTlsSettingsName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/dedicatedSQLminimalTlsSettings/{dedicatedSQLminimalTlsSettingsName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerDedicatedSQLMinimalTlsSettings_Get + /// + /// + /// + /// The name of the dedicated sql minimal tls settings. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dedicatedSQLminimalTlsSettingsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dedicatedSQLminimalTlsSettingsName, nameof(dedicatedSQLminimalTlsSettingsName)); + + using var scope = _synapseDedicatedSqlMinimalTlsSettingWorkspaceManagedSqlServerDedicatedSQLMinimalTlsSettingsClientDiagnostics.CreateScope("SynapseDedicatedSqlMinimalTlsSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseDedicatedSqlMinimalTlsSettingWorkspaceManagedSqlServerDedicatedSQLMinimalTlsSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dedicatedSQLminimalTlsSettingsName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDedicatedSqlMinimalTlsSettingResource(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.Synapse/workspaces/{workspaceName}/dedicatedSQLminimalTlsSettings/{dedicatedSQLminimalTlsSettingsName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerDedicatedSQLMinimalTlsSettings_Get + /// + /// + /// + /// The name of the dedicated sql minimal tls settings. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dedicatedSQLminimalTlsSettingsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dedicatedSQLminimalTlsSettingsName, nameof(dedicatedSQLminimalTlsSettingsName)); + + using var scope = _synapseDedicatedSqlMinimalTlsSettingWorkspaceManagedSqlServerDedicatedSQLMinimalTlsSettingsClientDiagnostics.CreateScope("SynapseDedicatedSqlMinimalTlsSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseDedicatedSqlMinimalTlsSettingWorkspaceManagedSqlServerDedicatedSQLMinimalTlsSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dedicatedSQLminimalTlsSettingsName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseDedicatedSqlMinimalTlsSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseEncryptionProtectorCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseEncryptionProtectorCollection.cs index 3b9adb70db1d..d1c93f08d476 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseEncryptionProtectorCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseEncryptionProtectorCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SynapseEncryptionProtectorName encryptionPr } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerEncryptionProtector_Get + /// + /// + /// + /// The name of the encryption protector. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseEncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + { + using var scope = _synapseEncryptionProtectorWorkspaceManagedSqlServerEncryptionProtectorClientDiagnostics.CreateScope("SynapseEncryptionProtectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseEncryptionProtectorWorkspaceManagedSqlServerEncryptionProtectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionProtectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseEncryptionProtectorResource(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.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerEncryptionProtector_Get + /// + /// + /// + /// The name of the encryption protector. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseEncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + { + using var scope = _synapseEncryptionProtectorWorkspaceManagedSqlServerEncryptionProtectorClientDiagnostics.CreateScope("SynapseEncryptionProtectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseEncryptionProtectorWorkspaceManagedSqlServerEncryptionProtectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionProtectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseEncryptionProtectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedServerBlobAuditingPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedServerBlobAuditingPolicyCollection.cs index b0f45c88a2c7..08e428117e8f 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedServerBlobAuditingPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedServerBlobAuditingPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SynapseBlobAuditingPolicyName blobAuditingP } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerExtendedBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseBlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseExtendedServerBlobAuditingPolicyWorkspaceManagedSqlServerExtendedBlobAuditingPoliciesClientDiagnostics.CreateScope("SynapseExtendedServerBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseExtendedServerBlobAuditingPolicyWorkspaceManagedSqlServerExtendedBlobAuditingPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseExtendedServerBlobAuditingPolicyResource(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.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerExtendedBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseBlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseExtendedServerBlobAuditingPolicyWorkspaceManagedSqlServerExtendedBlobAuditingPoliciesClientDiagnostics.CreateScope("SynapseExtendedServerBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseExtendedServerBlobAuditingPolicyWorkspaceManagedSqlServerExtendedBlobAuditingPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseExtendedServerBlobAuditingPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseGeoBackupPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseGeoBackupPolicyCollection.cs index 321fc4561c24..d9acb1585bb8 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseGeoBackupPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseGeoBackupPolicyCollection.cs @@ -302,6 +302,72 @@ public virtual Response Exists(SynapseGeoBackupPolicyName geoBackupPolicyN } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName} + /// + /// + /// Operation Id + /// SqlPoolGeoBackupPolicies_Get + /// + /// + /// + /// The name of the geo backup policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseGeoBackupPolicyName geoBackupPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseGeoBackupPolicySqlPoolGeoBackupPoliciesClientDiagnostics.CreateScope("SynapseGeoBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseGeoBackupPolicySqlPoolGeoBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, geoBackupPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseGeoBackupPolicyResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName} + /// + /// + /// Operation Id + /// SqlPoolGeoBackupPolicies_Get + /// + /// + /// + /// The name of the geo backup policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseGeoBackupPolicyName geoBackupPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseGeoBackupPolicySqlPoolGeoBackupPoliciesClientDiagnostics.CreateScope("SynapseGeoBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseGeoBackupPolicySqlPoolGeoBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, geoBackupPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseGeoBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIPFirewallRuleInfoCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIPFirewallRuleInfoCollection.cs index 7557e423450b..378f328ac29f 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIPFirewallRuleInfoCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIPFirewallRuleInfoCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName} + /// + /// + /// Operation Id + /// IpFirewallRules_Get + /// + /// + /// + /// The IP firewall rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _synapseIPFirewallRuleInfoIPFirewallRulesClientDiagnostics.CreateScope("SynapseIPFirewallRuleInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseIPFirewallRuleInfoIPFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseIPFirewallRuleInfoResource(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.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName} + /// + /// + /// Operation Id + /// IpFirewallRules_Get + /// + /// + /// + /// The IP firewall rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _synapseIPFirewallRuleInfoIPFirewallRulesClientDiagnostics.CreateScope("SynapseIPFirewallRuleInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseIPFirewallRuleInfoIPFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseIPFirewallRuleInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIntegrationRuntimeCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIntegrationRuntimeCollection.cs index 76da052963c6..92389a837a75 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIntegrationRuntimeCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIntegrationRuntimeCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string integrationRuntimeName, string ifNon } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName} + /// + /// + /// Operation Id + /// IntegrationRuntimes_Get + /// + /// + /// + /// Integration runtime name. + /// ETag of the integration runtime entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string integrationRuntimeName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(integrationRuntimeName, nameof(integrationRuntimeName)); + + using var scope = _synapseIntegrationRuntimeIntegrationRuntimesClientDiagnostics.CreateScope("SynapseIntegrationRuntimeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseIntegrationRuntimeIntegrationRuntimesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationRuntimeName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseIntegrationRuntimeResource(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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName} + /// + /// + /// Operation Id + /// IntegrationRuntimes_Get + /// + /// + /// + /// Integration runtime name. + /// ETag of the integration runtime entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string integrationRuntimeName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(integrationRuntimeName, nameof(integrationRuntimeName)); + + using var scope = _synapseIntegrationRuntimeIntegrationRuntimesClientDiagnostics.CreateScope("SynapseIntegrationRuntimeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseIntegrationRuntimeIntegrationRuntimesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationRuntimeName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseIntegrationRuntimeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKeyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKeyCollection.cs index c3c9cbc8b8ed..dbb211952aee 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKeyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKeyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string keyName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName} + /// + /// + /// Operation Id + /// Keys_Get + /// + /// + /// + /// The name of the workspace key. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _synapseKeyKeysClientDiagnostics.CreateScope("SynapseKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseKeyKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseKeyResource(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.Synapse/workspaces/{workspaceName}/keys/{keyName} + /// + /// + /// Operation Id + /// Keys_Get + /// + /// + /// + /// The name of the workspace key. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _synapseKeyKeysClientDiagnostics.CreateScope("SynapseKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseKeyKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseKeyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolCollection.cs index c4809c4ee515..ed8eb7e4ae61 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string kustoPoolName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName} + /// + /// + /// Operation Id + /// KustoPools_Get + /// + /// + /// + /// The name of the Kusto pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string kustoPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(kustoPoolName, nameof(kustoPoolName)); + + using var scope = _synapseKustoPoolKustoPoolsClientDiagnostics.CreateScope("SynapseKustoPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseKustoPoolKustoPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, kustoPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseKustoPoolResource(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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName} + /// + /// + /// Operation Id + /// KustoPools_Get + /// + /// + /// + /// The name of the Kusto pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string kustoPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(kustoPoolName, nameof(kustoPoolName)); + + using var scope = _synapseKustoPoolKustoPoolsClientDiagnostics.CreateScope("SynapseKustoPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseKustoPoolKustoPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, kustoPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseKustoPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseLibraryCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseLibraryCollection.cs index e70e4c6b80ca..5d92eebc1486 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseLibraryCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseLibraryCollection.cs @@ -246,6 +246,80 @@ public virtual Response Exists(string libraryName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/libraries/{libraryName} + /// + /// + /// Operation Id + /// Library_Get + /// + /// + /// + /// Library name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string libraryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(libraryName, nameof(libraryName)); + + using var scope = _synapseLibraryLibraryClientDiagnostics.CreateScope("SynapseLibraryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseLibraryLibraryRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, libraryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseLibraryResource(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.Synapse/workspaces/{workspaceName}/libraries/{libraryName} + /// + /// + /// Operation Id + /// Library_Get + /// + /// + /// + /// Library name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string libraryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(libraryName, nameof(libraryName)); + + using var scope = _synapseLibraryLibraryClientDiagnostics.CreateScope("SynapseLibraryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseLibraryLibraryRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, libraryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseLibraryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionCollection.cs index c3e1ad8b5cc0..67b4ae6c84d9 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _synapsePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("SynapsePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapsePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapsePrivateEndpointConnectionResource(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.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _synapsePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("SynapsePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapsePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapsePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.cs index 5a393abf8ca9..0e385b2b4b74 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnectionsPrivateLinkHub_Get + /// + /// + /// + /// Name of the privateEndpointConnection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _synapsePrivateEndpointConnectionForPrivateLinkHubPrivateEndpointConnectionsPrivateLinkHubClientDiagnostics.CreateScope("SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapsePrivateEndpointConnectionForPrivateLinkHubPrivateEndpointConnectionsPrivateLinkHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapsePrivateEndpointConnectionForPrivateLinkHubResource(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.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnectionsPrivateLinkHub_Get + /// + /// + /// + /// Name of the privateEndpointConnection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _synapsePrivateEndpointConnectionForPrivateLinkHubPrivateEndpointConnectionsPrivateLinkHubClientDiagnostics.CreateScope("SynapsePrivateEndpointConnectionForPrivateLinkHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapsePrivateEndpointConnectionForPrivateLinkHubPrivateEndpointConnectionsPrivateLinkHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapsePrivateEndpointConnectionForPrivateLinkHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubCollection.cs index 8b40c958a4b6..6d02f1e72d88 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string privateLinkHubName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName} + /// + /// + /// Operation Id + /// PrivateLinkHubs_Get + /// + /// + /// + /// Name of the privateLinkHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateLinkHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkHubName, nameof(privateLinkHubName)); + + using var scope = _synapsePrivateLinkHubPrivateLinkHubsClientDiagnostics.CreateScope("SynapsePrivateLinkHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapsePrivateLinkHubPrivateLinkHubsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateLinkHubName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapsePrivateLinkHubResource(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.Synapse/privateLinkHubs/{privateLinkHubName} + /// + /// + /// Operation Id + /// PrivateLinkHubs_Get + /// + /// + /// + /// Name of the privateLinkHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkHubName, nameof(privateLinkHubName)); + + using var scope = _synapsePrivateLinkHubPrivateLinkHubsClientDiagnostics.CreateScope("SynapsePrivateLinkHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapsePrivateLinkHubPrivateLinkHubsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateLinkHubName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapsePrivateLinkHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkResourceCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkResourceCollection.cs index 05de768f84d2..8e7a549a61e3 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkResourceCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkHubPrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _synapsePrivateLinkResourcePrivateLinkHubPrivateLinkResourcesClientDiagnostics.CreateScope("SynapsePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapsePrivateLinkResourcePrivateLinkHubPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapsePrivateLinkResource(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.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkHubPrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _synapsePrivateLinkResourcePrivateLinkHubPrivateLinkResourcesClientDiagnostics.CreateScope("SynapsePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapsePrivateLinkResourcePrivateLinkHubPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapsePrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRecoverableSqlPoolCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRecoverableSqlPoolCollection.cs index f1af0fa822e3..d282979458a8 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRecoverableSqlPoolCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRecoverableSqlPoolCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string sqlPoolName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlPoolName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerRecoverableSqlPools_Get + /// + /// + /// + /// The name of the sql pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sqlPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlPoolName, nameof(sqlPoolName)); + + using var scope = _synapseRecoverableSqlPoolWorkspaceManagedSqlServerRecoverableSqlPoolsClientDiagnostics.CreateScope("SynapseRecoverableSqlPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseRecoverableSqlPoolWorkspaceManagedSqlServerRecoverableSqlPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sqlPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseRecoverableSqlPoolResource(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.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlPoolName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerRecoverableSqlPools_Get + /// + /// + /// + /// The name of the sql pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sqlPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlPoolName, nameof(sqlPoolName)); + + using var scope = _synapseRecoverableSqlPoolWorkspaceManagedSqlServerRecoverableSqlPoolsClientDiagnostics.CreateScope("SynapseRecoverableSqlPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseRecoverableSqlPoolWorkspaceManagedSqlServerRecoverableSqlPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sqlPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseRecoverableSqlPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseReplicationLinkCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseReplicationLinkCollection.cs index 8e8fcfed2585..2e755e232522 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseReplicationLinkCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseReplicationLinkCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string linkId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// SqlPoolReplicationLinks_GetByName + /// + /// + /// + /// The ID of the replication link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string linkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); + + using var scope = _synapseReplicationLinkSqlPoolReplicationLinksClientDiagnostics.CreateScope("SynapseReplicationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseReplicationLinkSqlPoolReplicationLinksRestClient.GetByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseReplicationLinkResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// SqlPoolReplicationLinks_GetByName + /// + /// + /// + /// The ID of the replication link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); + + using var scope = _synapseReplicationLinkSqlPoolReplicationLinksClientDiagnostics.CreateScope("SynapseReplicationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseReplicationLinkSqlPoolReplicationLinksRestClient.GetByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseReplicationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorableDroppedSqlPoolCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorableDroppedSqlPoolCollection.cs index 00013ee00f51..75ffb51a4864 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorableDroppedSqlPoolCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorableDroppedSqlPoolCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string restorableDroppedSqlPoolId, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId} + /// + /// + /// Operation Id + /// RestorableDroppedSqlPools_Get + /// + /// + /// + /// The id of the deleted Sql Pool in the form of sqlPoolName,deletionTimeInFileTimeFormat. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string restorableDroppedSqlPoolId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorableDroppedSqlPoolId, nameof(restorableDroppedSqlPoolId)); + + using var scope = _synapseRestorableDroppedSqlPoolRestorableDroppedSqlPoolsClientDiagnostics.CreateScope("SynapseRestorableDroppedSqlPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseRestorableDroppedSqlPoolRestorableDroppedSqlPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restorableDroppedSqlPoolId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseRestorableDroppedSqlPoolResource(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.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId} + /// + /// + /// Operation Id + /// RestorableDroppedSqlPools_Get + /// + /// + /// + /// The id of the deleted Sql Pool in the form of sqlPoolName,deletionTimeInFileTimeFormat. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string restorableDroppedSqlPoolId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorableDroppedSqlPoolId, nameof(restorableDroppedSqlPoolId)); + + using var scope = _synapseRestorableDroppedSqlPoolRestorableDroppedSqlPoolsClientDiagnostics.CreateScope("SynapseRestorableDroppedSqlPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseRestorableDroppedSqlPoolRestorableDroppedSqlPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restorableDroppedSqlPoolId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseRestorableDroppedSqlPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorePointCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorePointCollection.cs index c7f0874761cb..420c2182624a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorePointCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorePointCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string restorePointName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName} + /// + /// + /// Operation Id + /// SqlPoolRestorePoints_Get + /// + /// + /// + /// The name of the restore point. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string restorePointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorePointName, nameof(restorePointName)); + + using var scope = _synapseRestorePointSqlPoolRestorePointsClientDiagnostics.CreateScope("SynapseRestorePointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseRestorePointSqlPoolRestorePointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, restorePointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseRestorePointResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName} + /// + /// + /// Operation Id + /// SqlPoolRestorePoints_Get + /// + /// + /// + /// The name of the restore point. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string restorePointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorePointName, nameof(restorePointName)); + + using var scope = _synapseRestorePointSqlPoolRestorePointsClientDiagnostics.CreateScope("SynapseRestorePointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseRestorePointSqlPoolRestorePointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, restorePointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseRestorePointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSensitivityLabelCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSensitivityLabelCollection.cs index 625dce7637ad..fcef7cd9fb80 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSensitivityLabelCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSensitivityLabelCollection.cs @@ -254,5 +254,71 @@ public virtual Response Exists(SynapseSensitivityLabelSource sensitivityLa throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource} + /// + /// + /// Operation Id + /// SqlPoolSensitivityLabels_Get + /// + /// + /// + /// The source of the sensitivity label. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseSensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + { + using var scope = _synapseSensitivityLabelSqlPoolSensitivityLabelsClientDiagnostics.CreateScope("SynapseSensitivityLabelCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSensitivityLabelSqlPoolSensitivityLabelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, sensitivityLabelSource, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSensitivityLabelResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource} + /// + /// + /// Operation Id + /// SqlPoolSensitivityLabels_Get + /// + /// + /// + /// The source of the sensitivity label. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseSensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + { + using var scope = _synapseSensitivityLabelSqlPoolSensitivityLabelsClientDiagnostics.CreateScope("SynapseSensitivityLabelCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSensitivityLabelSqlPoolSensitivityLabelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, sensitivityLabelSource, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSensitivityLabelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerBlobAuditingPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerBlobAuditingPolicyCollection.cs index 859299831b40..45a21bbbe81b 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerBlobAuditingPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerBlobAuditingPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SynapseBlobAuditingPolicyName blobAuditingP } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseBlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseServerBlobAuditingPolicyWorkspaceManagedSqlServerBlobAuditingPoliciesClientDiagnostics.CreateScope("SynapseServerBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseServerBlobAuditingPolicyWorkspaceManagedSqlServerBlobAuditingPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseServerBlobAuditingPolicyResource(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.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseBlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseServerBlobAuditingPolicyWorkspaceManagedSqlServerBlobAuditingPoliciesClientDiagnostics.CreateScope("SynapseServerBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseServerBlobAuditingPolicyWorkspaceManagedSqlServerBlobAuditingPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseServerBlobAuditingPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerSecurityAlertPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerSecurityAlertPolicyCollection.cs index e0d3e3c13f0a..037a87968b4d 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerSecurityAlertPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerSecurityAlertPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlServerSecurityAlertPolicyName securityAl } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerSecurityAlertPolicy_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlServerSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseServerSecurityAlertPolicyWorkspaceManagedSqlServerSecurityAlertPolicyClientDiagnostics.CreateScope("SynapseServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseServerSecurityAlertPolicyWorkspaceManagedSqlServerSecurityAlertPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseServerSecurityAlertPolicyResource(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.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerSecurityAlertPolicy_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlServerSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseServerSecurityAlertPolicyWorkspaceManagedSqlServerSecurityAlertPolicyClientDiagnostics.CreateScope("SynapseServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseServerSecurityAlertPolicyWorkspaceManagedSqlServerSecurityAlertPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseServerSecurityAlertPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerVulnerabilityAssessmentCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerVulnerabilityAssessmentCollection.cs index bef2c1b5f6ca..0f31117ba850 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerVulnerabilityAssessmentCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerVulnerabilityAssessmentCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SynapseVulnerabilityAssessmentName vulnerab } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _synapseServerVulnerabilityAssessmentWorkspaceManagedSqlServerVulnerabilityAssessmentsClientDiagnostics.CreateScope("SynapseServerVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseServerVulnerabilityAssessmentWorkspaceManagedSqlServerVulnerabilityAssessmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseServerVulnerabilityAssessmentResource(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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// WorkspaceManagedSqlServerVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _synapseServerVulnerabilityAssessmentWorkspaceManagedSqlServerVulnerabilityAssessmentsClientDiagnostics.CreateScope("SynapseServerVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseServerVulnerabilityAssessmentWorkspaceManagedSqlServerVulnerabilityAssessmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseServerVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSparkConfigurationCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSparkConfigurationCollection.cs index 12f8ce58046f..e0685d708080 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSparkConfigurationCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSparkConfigurationCollection.cs @@ -246,6 +246,80 @@ public virtual Response Exists(string sparkConfigurationName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sparkconfigurations/{sparkConfigurationName} + /// + /// + /// Operation Id + /// SparkConfiguration_Get + /// + /// + /// + /// SparkConfiguration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sparkConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sparkConfigurationName, nameof(sparkConfigurationName)); + + using var scope = _synapseSparkConfigurationSparkConfigurationClientDiagnostics.CreateScope("SynapseSparkConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSparkConfigurationSparkConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sparkConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSparkConfigurationResource(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.Synapse/workspaces/{workspaceName}/sparkconfigurations/{sparkConfigurationName} + /// + /// + /// Operation Id + /// SparkConfiguration_Get + /// + /// + /// + /// SparkConfiguration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sparkConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sparkConfigurationName, nameof(sparkConfigurationName)); + + using var scope = _synapseSparkConfigurationSparkConfigurationClientDiagnostics.CreateScope("SynapseSparkConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSparkConfigurationSparkConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sparkConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSparkConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolCollection.cs index 9e38d5fc3fed..e65ede6c72db 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string sqlPoolName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName} + /// + /// + /// Operation Id + /// SqlPools_Get + /// + /// + /// + /// SQL pool name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sqlPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlPoolName, nameof(sqlPoolName)); + + using var scope = _synapseSqlPoolSqlPoolsClientDiagnostics.CreateScope("SynapseSqlPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSqlPoolSqlPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sqlPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName} + /// + /// + /// Operation Id + /// SqlPools_Get + /// + /// + /// + /// SQL pool name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sqlPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlPoolName, nameof(sqlPoolName)); + + using var scope = _synapseSqlPoolSqlPoolsClientDiagnostics.CreateScope("SynapseSqlPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSqlPoolSqlPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sqlPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnCollection.cs index a53d189e8fdd..d2b0ad513391 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnCollection.cs @@ -248,6 +248,80 @@ public virtual Response Exists(string columnName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName} + /// + /// + /// Operation Id + /// SqlPoolColumns_Get + /// + /// + /// + /// The name of the column. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string columnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + + using var scope = _synapseSqlPoolColumnSqlPoolColumnsClientDiagnostics.CreateScope("SynapseSqlPoolColumnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSqlPoolColumnSqlPoolColumnsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, columnName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolColumnResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName} + /// + /// + /// Operation Id + /// SqlPoolColumns_Get + /// + /// + /// + /// The name of the column. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string columnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + + using var scope = _synapseSqlPoolColumnSqlPoolColumnsClientDiagnostics.CreateScope("SynapseSqlPoolColumnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSqlPoolColumnSqlPoolColumnsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, columnName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolColumnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolConnectionPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolConnectionPolicyCollection.cs index ec8e6c2b58b0..f97d85f27671 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolConnectionPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolConnectionPolicyCollection.cs @@ -178,5 +178,71 @@ public virtual Response Exists(SqlPoolConnectionPolicyName connectionPolic throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName} + /// + /// + /// Operation Id + /// SqlPoolConnectionPolicies_Get + /// + /// + /// + /// The name of the connection policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlPoolConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseSqlPoolConnectionPolicySqlPoolConnectionPoliciesClientDiagnostics.CreateScope("SynapseSqlPoolConnectionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSqlPoolConnectionPolicySqlPoolConnectionPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolConnectionPolicyResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName} + /// + /// + /// Operation Id + /// SqlPoolConnectionPolicies_Get + /// + /// + /// + /// The name of the connection policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlPoolConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseSqlPoolConnectionPolicySqlPoolConnectionPoliciesClientDiagnostics.CreateScope("SynapseSqlPoolConnectionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSqlPoolConnectionPolicySqlPoolConnectionPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolConnectionPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaCollection.cs index 007a52de29ab..a41e3b78fa64 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string schemaName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// SqlPoolSchemas_Get + /// + /// + /// + /// The name of the schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _synapseSqlPoolSchemaSqlPoolSchemasClientDiagnostics.CreateScope("SynapseSqlPoolSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSqlPoolSchemaSqlPoolSchemasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolSchemaResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// SqlPoolSchemas_Get + /// + /// + /// + /// The name of the schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _synapseSqlPoolSchemaSqlPoolSchemasClientDiagnostics.CreateScope("SynapseSqlPoolSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSqlPoolSchemaSqlPoolSchemasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSecurityAlertPolicyCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSecurityAlertPolicyCollection.cs index 95851b0b40ed..2a201f136b6a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSecurityAlertPolicyCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSecurityAlertPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlPoolSecurityAlertPolicyName securityAler } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// SqlPoolSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlPoolSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseSqlPoolSecurityAlertPolicySqlPoolSecurityAlertPoliciesClientDiagnostics.CreateScope("SynapseSqlPoolSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSqlPoolSecurityAlertPolicySqlPoolSecurityAlertPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolSecurityAlertPolicyResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// SqlPoolSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlPoolSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _synapseSqlPoolSecurityAlertPolicySqlPoolSecurityAlertPoliciesClientDiagnostics.CreateScope("SynapseSqlPoolSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSqlPoolSecurityAlertPolicySqlPoolSecurityAlertPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolSecurityAlertPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableCollection.cs index 5a5fcda8648f..0d6691b3b9ec 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string tableName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName} + /// + /// + /// Operation Id + /// SqlPoolTables_Get + /// + /// + /// + /// The name of the table. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _synapseSqlPoolTableSqlPoolTablesClientDiagnostics.CreateScope("SynapseSqlPoolTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSqlPoolTableSqlPoolTablesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolTableResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName} + /// + /// + /// Operation Id + /// SqlPoolTables_Get + /// + /// + /// + /// The name of the table. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _synapseSqlPoolTableSqlPoolTablesClientDiagnostics.CreateScope("SynapseSqlPoolTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSqlPoolTableSqlPoolTablesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolTableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentCollection.cs index e9bde4daf75d..46230fe84653 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SynapseVulnerabilityAssessmentName vulnerab } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// SqlPoolVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _synapseSqlPoolVulnerabilityAssessmentSqlPoolVulnerabilityAssessmentsClientDiagnostics.CreateScope("SynapseSqlPoolVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSqlPoolVulnerabilityAssessmentSqlPoolVulnerabilityAssessmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolVulnerabilityAssessmentResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// SqlPoolVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _synapseSqlPoolVulnerabilityAssessmentSqlPoolVulnerabilityAssessmentsClientDiagnostics.CreateScope("SynapseSqlPoolVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSqlPoolVulnerabilityAssessmentSqlPoolVulnerabilityAssessmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.cs index 4a804a357a9c..542dc834fe66 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.cs @@ -282,5 +282,81 @@ public virtual Response Exists(string ruleId, SynapseVulnerabilityAssessme throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName} + /// + /// + /// Operation Id + /// SqlPoolVulnerabilityAssessmentRuleBaselines_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for server level rule). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleId, SynapseVulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _synapseSqlPoolVulnerabilityAssessmentRuleBaselineSqlPoolVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseSqlPoolVulnerabilityAssessmentRuleBaselineSqlPoolVulnerabilityAssessmentRuleBaselinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName} + /// + /// + /// Operation Id + /// SqlPoolVulnerabilityAssessmentRuleBaselines_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for server level rule). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleId, SynapseVulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _synapseSqlPoolVulnerabilityAssessmentRuleBaselineSqlPoolVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseSqlPoolVulnerabilityAssessmentRuleBaselineSqlPoolVulnerabilityAssessmentRuleBaselinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseTransparentDataEncryptionCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseTransparentDataEncryptionCollection.cs index cb9a8a2ae89f..058feae45c8a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseTransparentDataEncryptionCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseTransparentDataEncryptionCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SynapseTransparentDataEncryptionName transp } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName} + /// + /// + /// Operation Id + /// SqlPoolTransparentDataEncryptions_Get + /// + /// + /// + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SynapseTransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + { + using var scope = _synapseTransparentDataEncryptionSqlPoolTransparentDataEncryptionsClientDiagnostics.CreateScope("SynapseTransparentDataEncryptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseTransparentDataEncryptionSqlPoolTransparentDataEncryptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, transparentDataEncryptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseTransparentDataEncryptionResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName} + /// + /// + /// Operation Id + /// SqlPoolTransparentDataEncryptions_Get + /// + /// + /// + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SynapseTransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + { + using var scope = _synapseTransparentDataEncryptionSqlPoolTransparentDataEncryptionsClientDiagnostics.CreateScope("SynapseTransparentDataEncryptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseTransparentDataEncryptionSqlPoolTransparentDataEncryptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, transparentDataEncryptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseTransparentDataEncryptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseVulnerabilityAssessmentScanRecordCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseVulnerabilityAssessmentScanRecordCollection.cs index e08bd8dd48b6..252082d6963c 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseVulnerabilityAssessmentScanRecordCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseVulnerabilityAssessmentScanRecordCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string scanId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// SqlPoolVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _synapseVulnerabilityAssessmentScanRecordSqlPoolVulnerabilityAssessmentScansClientDiagnostics.CreateScope("SynapseVulnerabilityAssessmentScanRecordCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseVulnerabilityAssessmentScanRecordSqlPoolVulnerabilityAssessmentScansRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseVulnerabilityAssessmentScanRecordResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// SqlPoolVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _synapseVulnerabilityAssessmentScanRecordSqlPoolVulnerabilityAssessmentScansClientDiagnostics.CreateScope("SynapseVulnerabilityAssessmentScanRecordCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseVulnerabilityAssessmentScanRecordSqlPoolVulnerabilityAssessmentScansRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseVulnerabilityAssessmentScanRecordResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadClassifierCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadClassifierCollection.cs index ff23ec8f892e..b1154b888bed 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadClassifierCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadClassifierCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string workloadClassifierName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName} + /// + /// + /// Operation Id + /// SqlPoolWorkloadClassifier_Get + /// + /// + /// + /// The name of the workload classifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workloadClassifierName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadClassifierName, nameof(workloadClassifierName)); + + using var scope = _synapseWorkloadClassifierSqlPoolWorkloadClassifierClientDiagnostics.CreateScope("SynapseWorkloadClassifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseWorkloadClassifierSqlPoolWorkloadClassifierRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, workloadClassifierName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseWorkloadClassifierResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName} + /// + /// + /// Operation Id + /// SqlPoolWorkloadClassifier_Get + /// + /// + /// + /// The name of the workload classifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workloadClassifierName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadClassifierName, nameof(workloadClassifierName)); + + using var scope = _synapseWorkloadClassifierSqlPoolWorkloadClassifierClientDiagnostics.CreateScope("SynapseWorkloadClassifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseWorkloadClassifierSqlPoolWorkloadClassifierRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, workloadClassifierName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseWorkloadClassifierResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupCollection.cs index 4175cc078b5f..315968043ef4 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string workloadGroupName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName} + /// + /// + /// Operation Id + /// SqlPoolWorkloadGroup_Get + /// + /// + /// + /// The name of the workload group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workloadGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadGroupName, nameof(workloadGroupName)); + + using var scope = _synapseWorkloadGroupSqlPoolWorkloadGroupClientDiagnostics.CreateScope("SynapseWorkloadGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseWorkloadGroupSqlPoolWorkloadGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseWorkloadGroupResource(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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName} + /// + /// + /// Operation Id + /// SqlPoolWorkloadGroup_Get + /// + /// + /// + /// The name of the workload group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workloadGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadGroupName, nameof(workloadGroupName)); + + using var scope = _synapseWorkloadGroupSqlPoolWorkloadGroupClientDiagnostics.CreateScope("SynapseWorkloadGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseWorkloadGroupSqlPoolWorkloadGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseWorkloadGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceCollection.cs index 3aa2e960fdf5..d884280669f5 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _synapseWorkspaceWorkspacesClientDiagnostics.CreateScope("SynapseWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseWorkspaceWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseWorkspaceResource(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.Synapse/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _synapseWorkspaceWorkspacesClientDiagnostics.CreateScope("SynapseWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspacePrivateLinkResourceCollection.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspacePrivateLinkResourceCollection.cs index 85470820fef3..525bcd6fba88 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspacePrivateLinkResourceCollection.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspacePrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _synapseWorkspacePrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("SynapseWorkspacePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _synapseWorkspacePrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseWorkspacePrivateLinkResource(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.Synapse/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _synapseWorkspacePrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("SynapseWorkspacePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _synapseWorkspacePrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SynapseWorkspacePrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerEndpointCollection.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerEndpointCollection.cs index ca1c9a41e374..350fc0146309 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerEndpointCollection.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerEndpointCollection.cs @@ -87,6 +87,50 @@ public async Task Exists_EndpointGETExternalWithGeoMapping() Console.WriteLine($"Succeeded: {result}"); } + // Endpoint-GET-External-WithGeoMapping + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EndpointGETExternalWithGeoMapping() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Endpoint-GET-External-WithGeoMapping.json + // this example is just showing the usage of "Endpoints_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 TrafficManagerProfileResource created on azure + // for more information of creating TrafficManagerProfileResource, please refer to the document of TrafficManagerProfileResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager2191"; + string profileName = "azuresdkfornetautoresttrafficmanager8224"; + ResourceIdentifier trafficManagerProfileResourceId = TrafficManagerProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + TrafficManagerProfileResource trafficManagerProfile = client.GetTrafficManagerProfileResource(trafficManagerProfileResourceId); + + // get the collection of this TrafficManagerEndpointResource + TrafficManagerEndpointCollection collection = trafficManagerProfile.GetTrafficManagerEndpoints(); + + // invoke the operation + string endpointType = "ExternalEndpoints"; + string endpointName = "My%20external%20endpoint"; + NullableResponse response = await collection.GetIfExistsAsync(endpointType, endpointName); + TrafficManagerEndpointResource 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 + TrafficManagerEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Endpoint-GET-External-WithLocation [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -155,6 +199,50 @@ public async Task Exists_EndpointGETExternalWithLocation() Console.WriteLine($"Succeeded: {result}"); } + // Endpoint-GET-External-WithLocation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EndpointGETExternalWithLocation() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Endpoint-GET-External-WithLocation.json + // this example is just showing the usage of "Endpoints_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 TrafficManagerProfileResource created on azure + // for more information of creating TrafficManagerProfileResource, please refer to the document of TrafficManagerProfileResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager1421"; + string profileName = "azsmnet6386"; + ResourceIdentifier trafficManagerProfileResourceId = TrafficManagerProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + TrafficManagerProfileResource trafficManagerProfile = client.GetTrafficManagerProfileResource(trafficManagerProfileResourceId); + + // get the collection of this TrafficManagerEndpointResource + TrafficManagerEndpointCollection collection = trafficManagerProfile.GetTrafficManagerEndpoints(); + + // invoke the operation + string endpointType = "ExternalEndpoints"; + string endpointName = "azsmnet7187"; + NullableResponse response = await collection.GetIfExistsAsync(endpointType, endpointName); + TrafficManagerEndpointResource 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 + TrafficManagerEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Endpoint-GET-External-WithSubnetMapping [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -223,6 +311,50 @@ public async Task Exists_EndpointGETExternalWithSubnetMapping() Console.WriteLine($"Succeeded: {result}"); } + // Endpoint-GET-External-WithSubnetMapping + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EndpointGETExternalWithSubnetMapping() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Endpoint-GET-External-WithSubnetMapping.json + // this example is just showing the usage of "Endpoints_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 TrafficManagerProfileResource created on azure + // for more information of creating TrafficManagerProfileResource, please refer to the document of TrafficManagerProfileResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager2191"; + string profileName = "azuresdkfornetautoresttrafficmanager8224"; + ResourceIdentifier trafficManagerProfileResourceId = TrafficManagerProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + TrafficManagerProfileResource trafficManagerProfile = client.GetTrafficManagerProfileResource(trafficManagerProfileResourceId); + + // get the collection of this TrafficManagerEndpointResource + TrafficManagerEndpointCollection collection = trafficManagerProfile.GetTrafficManagerEndpoints(); + + // invoke the operation + string endpointType = "ExternalEndpoints"; + string endpointName = "My%20external%20endpoint"; + NullableResponse response = await collection.GetIfExistsAsync(endpointType, endpointName); + TrafficManagerEndpointResource 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 + TrafficManagerEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Endpoint-PUT-External-WithAlwaysServe [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerHeatMapCollection.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerHeatMapCollection.cs index c797b2b56dce..0a7ee5ea52f3 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerHeatMapCollection.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerHeatMapCollection.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,49 @@ public async Task Exists_HeatMapGET() Console.WriteLine($"Succeeded: {result}"); } + // HeatMap-GET + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HeatMapGET() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/HeatMap-GET.json + // this example is just showing the usage of "HeatMap_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 TrafficManagerProfileResource created on azure + // for more information of creating TrafficManagerProfileResource, please refer to the document of TrafficManagerProfileResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323"; + string profileName = "azuresdkfornetautoresttrafficmanager3880"; + ResourceIdentifier trafficManagerProfileResourceId = TrafficManagerProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + TrafficManagerProfileResource trafficManagerProfile = client.GetTrafficManagerProfileResource(trafficManagerProfileResourceId); + + // get the collection of this TrafficManagerHeatMapResource + TrafficManagerHeatMapCollection collection = trafficManagerProfile.GetTrafficManagerHeatMaps(); + + // invoke the operation + TrafficManagerHeatMapType heatMapType = TrafficManagerHeatMapType.Default; + NullableResponse response = await collection.GetIfExistsAsync(heatMapType); + TrafficManagerHeatMapResource 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 + TrafficManagerHeatMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HeatMap-GET-With-Null-Values [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -150,6 +194,49 @@ public async Task Exists_HeatMapGETWithNullValues() Console.WriteLine($"Succeeded: {result}"); } + // HeatMap-GET-With-Null-Values + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HeatMapGETWithNullValues() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/HeatMap-GET-With-Null-Values.json + // this example is just showing the usage of "HeatMap_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 TrafficManagerProfileResource created on azure + // for more information of creating TrafficManagerProfileResource, please refer to the document of TrafficManagerProfileResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323"; + string profileName = "azuresdkfornetautoresttrafficmanager3880"; + ResourceIdentifier trafficManagerProfileResourceId = TrafficManagerProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + TrafficManagerProfileResource trafficManagerProfile = client.GetTrafficManagerProfileResource(trafficManagerProfileResourceId); + + // get the collection of this TrafficManagerHeatMapResource + TrafficManagerHeatMapCollection collection = trafficManagerProfile.GetTrafficManagerHeatMaps(); + + // invoke the operation + TrafficManagerHeatMapType heatMapType = TrafficManagerHeatMapType.Default; + NullableResponse response = await collection.GetIfExistsAsync(heatMapType); + TrafficManagerHeatMapResource 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 + TrafficManagerHeatMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HeatMap-GET-With-TopLeft-BotRight [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -231,5 +318,56 @@ public async Task Exists_HeatMapGETWithTopLeftBotRight() Console.WriteLine($"Succeeded: {result}"); } + + // HeatMap-GET-With-TopLeft-BotRight + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HeatMapGETWithTopLeftBotRight() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/HeatMap-GET-With-TopLeft-BotRight.json + // this example is just showing the usage of "HeatMap_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 TrafficManagerProfileResource created on azure + // for more information of creating TrafficManagerProfileResource, please refer to the document of TrafficManagerProfileResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323"; + string profileName = "azuresdkfornetautoresttrafficmanager3880"; + ResourceIdentifier trafficManagerProfileResourceId = TrafficManagerProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, profileName); + TrafficManagerProfileResource trafficManagerProfile = client.GetTrafficManagerProfileResource(trafficManagerProfileResourceId); + + // get the collection of this TrafficManagerHeatMapResource + TrafficManagerHeatMapCollection collection = trafficManagerProfile.GetTrafficManagerHeatMaps(); + + // invoke the operation + TrafficManagerHeatMapType heatMapType = TrafficManagerHeatMapType.Default; + IEnumerable topLeft = new double[] + { +10,50.001 + }; + IEnumerable botRight = new double[] + { +-50.001,80 + }; + NullableResponse response = await collection.GetIfExistsAsync(heatMapType, topLeft: topLeft, botRight: botRight); + TrafficManagerHeatMapResource 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 + TrafficManagerHeatMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerProfileCollection.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerProfileCollection.cs index 5a7c06875f4b..1db5457b9bd3 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerProfileCollection.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/samples/Generated/Samples/Sample_TrafficManagerProfileCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_ProfileGETWithEndpoints() Console.WriteLine($"Succeeded: {result}"); } + // Profile-GET-WithEndpoints + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProfileGETWithEndpoints() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithEndpoints.json + // this example is just showing the usage of "Profiles_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 = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this TrafficManagerProfileResource + TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles(); + + // invoke the operation + string profileName = "azuresdkfornetautoresttrafficmanager3880"; + NullableResponse response = await collection.GetIfExistsAsync(profileName); + TrafficManagerProfileResource 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 + TrafficManagerProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Profile-GET-WithTrafficViewDisabled [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -183,6 +225,48 @@ public async Task Exists_ProfileGETWithTrafficViewDisabled() Console.WriteLine($"Succeeded: {result}"); } + // Profile-GET-WithTrafficViewDisabled + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProfileGETWithTrafficViewDisabled() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewDisabled.json + // this example is just showing the usage of "Profiles_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 = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this TrafficManagerProfileResource + TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles(); + + // invoke the operation + string profileName = "azuresdkfornetautoresttrafficmanager3880"; + NullableResponse response = await collection.GetIfExistsAsync(profileName); + TrafficManagerProfileResource 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 + TrafficManagerProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Profile-GET-WithTrafficViewEnabled [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -247,6 +331,48 @@ public async Task Exists_ProfileGETWithTrafficViewEnabled() Console.WriteLine($"Succeeded: {result}"); } + // Profile-GET-WithTrafficViewEnabled + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProfileGETWithTrafficViewEnabled() + { + // Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewEnabled.json + // this example is just showing the usage of "Profiles_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 = "{subscription-id}"; + string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this TrafficManagerProfileResource + TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles(); + + // invoke the operation + string profileName = "azuresdkfornetautoresttrafficmanager3880"; + NullableResponse response = await collection.GetIfExistsAsync(profileName); + TrafficManagerProfileResource 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 + TrafficManagerProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Profile-PUT-MultiValue [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerEndpointCollection.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerEndpointCollection.cs index c64dcf2f8d76..079fdadf5bb3 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerEndpointCollection.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerEndpointCollection.cs @@ -287,5 +287,83 @@ public virtual Response Exists(string endpointType, string endpointName, C throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName} + /// + /// + /// Operation Id + /// Endpoints_Get + /// + /// + /// + /// The type of the Traffic Manager endpoint. Only AzureEndpoints, ExternalEndpoints and NestedEndpoints are allowed here. + /// The name of the Traffic Manager endpoint. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string endpointType, string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _trafficManagerEndpointEndpointsClientDiagnostics.CreateScope("TrafficManagerEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _trafficManagerEndpointEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointType, endpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TrafficManagerEndpointResource(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.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName} + /// + /// + /// Operation Id + /// Endpoints_Get + /// + /// + /// + /// The type of the Traffic Manager endpoint. Only AzureEndpoints, ExternalEndpoints and NestedEndpoints are allowed here. + /// The name of the Traffic Manager endpoint. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string endpointType, string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName)); + + using var scope = _trafficManagerEndpointEndpointsClientDiagnostics.CreateScope("TrafficManagerEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _trafficManagerEndpointEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointType, endpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TrafficManagerEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerHeatMapCollection.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerHeatMapCollection.cs index 47119b88a8b9..02a0a7e9650a 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerHeatMapCollection.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerHeatMapCollection.cs @@ -187,5 +187,75 @@ public virtual Response Exists(TrafficManagerHeatMapType heatMapType, IEnu throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType} + /// + /// + /// Operation Id + /// HeatMap_Get + /// + /// + /// + /// The type of HeatMap for the Traffic Manager profile. + /// The top left latitude,longitude pair of the rectangular viewport to query for. + /// The bottom right latitude,longitude pair of the rectangular viewport to query for. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(TrafficManagerHeatMapType heatMapType, IEnumerable topLeft = null, IEnumerable botRight = null, CancellationToken cancellationToken = default) + { + using var scope = _trafficManagerHeatMapHeatMapClientDiagnostics.CreateScope("TrafficManagerHeatMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _trafficManagerHeatMapHeatMapRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, heatMapType, topLeft, botRight, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TrafficManagerHeatMapResource(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.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType} + /// + /// + /// Operation Id + /// HeatMap_Get + /// + /// + /// + /// The type of HeatMap for the Traffic Manager profile. + /// The top left latitude,longitude pair of the rectangular viewport to query for. + /// The bottom right latitude,longitude pair of the rectangular viewport to query for. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(TrafficManagerHeatMapType heatMapType, IEnumerable topLeft = null, IEnumerable botRight = null, CancellationToken cancellationToken = default) + { + using var scope = _trafficManagerHeatMapHeatMapClientDiagnostics.CreateScope("TrafficManagerHeatMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = _trafficManagerHeatMapHeatMapRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, heatMapType, topLeft, botRight, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TrafficManagerHeatMapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileCollection.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileCollection.cs index 14b3cb7bf6bd..c60798708a53 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileCollection.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string profileName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// The name of the Traffic Manager profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string profileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); + + using var scope = _trafficManagerProfileProfilesClientDiagnostics.CreateScope("TrafficManagerProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _trafficManagerProfileProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, profileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TrafficManagerProfileResource(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.Network/trafficmanagerprofiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// The name of the Traffic Manager profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string profileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); + + using var scope = _trafficManagerProfileProfilesClientDiagnostics.CreateScope("TrafficManagerProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _trafficManagerProfileProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, profileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TrafficManagerProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/Generated/Samples/Sample_VoiceServicesCommunicationsGatewayCollection.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/Generated/Samples/Sample_VoiceServicesCommunicationsGatewayCollection.cs index 3111fd22712d..8b51f4988453 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/Generated/Samples/Sample_VoiceServicesCommunicationsGatewayCollection.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/Generated/Samples/Sample_VoiceServicesCommunicationsGatewayCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetCommunicationsGatewayResource() Console.WriteLine($"Succeeded: {result}"); } + // GetCommunicationsGatewayResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCommunicationsGatewayResource() + { + // Generated from example definition: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_Get.json + // this example is just showing the usage of "CommunicationsGateways_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 = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VoiceServicesCommunicationsGatewayResource + VoiceServicesCommunicationsGatewayCollection collection = resourceGroupResource.GetVoiceServicesCommunicationsGateways(); + + // invoke the operation + string communicationsGatewayName = "myname"; + NullableResponse response = await collection.GetIfExistsAsync(communicationsGatewayName); + VoiceServicesCommunicationsGatewayResource 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 + VoiceServicesCommunicationsGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateCommunicationsGatewayResource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/Generated/Samples/Sample_VoiceServicesTestLineCollection.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/Generated/Samples/Sample_VoiceServicesTestLineCollection.cs index cae4f02f982f..011f784a541a 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/Generated/Samples/Sample_VoiceServicesTestLineCollection.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/Generated/Samples/Sample_VoiceServicesTestLineCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetTestLineResource() Console.WriteLine($"Succeeded: {result}"); } + // GetTestLineResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTestLineResource() + { + // Generated from example definition: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_Get.json + // this example is just showing the usage of "TestLines_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 VoiceServicesCommunicationsGatewayResource created on azure + // for more information of creating VoiceServicesCommunicationsGatewayResource, please refer to the document of VoiceServicesCommunicationsGatewayResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string communicationsGatewayName = "myname"; + ResourceIdentifier voiceServicesCommunicationsGatewayResourceId = VoiceServicesCommunicationsGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationsGatewayName); + VoiceServicesCommunicationsGatewayResource voiceServicesCommunicationsGateway = client.GetVoiceServicesCommunicationsGatewayResource(voiceServicesCommunicationsGatewayResourceId); + + // get the collection of this VoiceServicesTestLineResource + VoiceServicesTestLineCollection collection = voiceServicesCommunicationsGateway.GetVoiceServicesTestLines(); + + // invoke the operation + string testLineName = "myline"; + NullableResponse response = await collection.GetIfExistsAsync(testLineName); + VoiceServicesTestLineResource 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 + VoiceServicesTestLineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateTestLineResource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayCollection.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayCollection.cs index fb3a292fce53..a1eaa10e5414 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayCollection.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string communicationsGatewayName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices/communicationsGateways/{communicationsGatewayName} + /// + /// + /// Operation Id + /// CommunicationsGateways_Get + /// + /// + /// + /// Unique identifier for this deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string communicationsGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(communicationsGatewayName, nameof(communicationsGatewayName)); + + using var scope = _voiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics.CreateScope("VoiceServicesCommunicationsGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _voiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, communicationsGatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VoiceServicesCommunicationsGatewayResource(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.VoiceServices/communicationsGateways/{communicationsGatewayName} + /// + /// + /// Operation Id + /// CommunicationsGateways_Get + /// + /// + /// + /// Unique identifier for this deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string communicationsGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(communicationsGatewayName, nameof(communicationsGatewayName)); + + using var scope = _voiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics.CreateScope("VoiceServicesCommunicationsGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _voiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, communicationsGatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VoiceServicesCommunicationsGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesTestLineCollection.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesTestLineCollection.cs index d0e3124056c3..7364a48cf01a 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesTestLineCollection.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesTestLineCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string testLineName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices/communicationsGateways/{communicationsGatewayName}/testLines/{testLineName} + /// + /// + /// Operation Id + /// TestLines_Get + /// + /// + /// + /// Unique identifier for this test line. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string testLineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testLineName, nameof(testLineName)); + + using var scope = _voiceServicesTestLineTestLinesClientDiagnostics.CreateScope("VoiceServicesTestLineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _voiceServicesTestLineTestLinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, testLineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VoiceServicesTestLineResource(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.VoiceServices/communicationsGateways/{communicationsGatewayName}/testLines/{testLineName} + /// + /// + /// Operation Id + /// TestLines_Get + /// + /// + /// + /// Unique identifier for this test line. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string testLineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(testLineName, nameof(testLineName)); + + using var scope = _voiceServicesTestLineTestLinesClientDiagnostics.CreateScope("VoiceServicesTestLineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _voiceServicesTestLineTestLinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, testLineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VoiceServicesTestLineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubCollection.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubCollection.cs index 14593496bf19..7f17ebf192a6 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubCollection.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_WebPubSubGet() Console.WriteLine($"Succeeded: {result}"); } + // WebPubSub_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WebPubSubGet() + { + // Generated from example definition: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSub_Get.json + // this example is just showing the usage of "WebPubSub_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebPubSubResource + WebPubSubCollection collection = resourceGroupResource.GetWebPubSubs(); + + // invoke the operation + string resourceName = "myWebPubSubService"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + WebPubSubResource 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 + WebPubSubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WebPubSub_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubHubCollection.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubHubCollection.cs index 498e8b04d542..5d84a6e4e438 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubHubCollection.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubHubCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WebPubSubHubsGet() Console.WriteLine($"Succeeded: {result}"); } + // WebPubSubHubs_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WebPubSubHubsGet() + { + // Generated from example definition: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubHubs_Get.json + // this example is just showing the usage of "WebPubSubHubs_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 WebPubSubResource created on azure + // for more information of creating WebPubSubResource, please refer to the document of WebPubSubResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "myWebPubSubService"; + ResourceIdentifier webPubSubResourceId = WebPubSubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + WebPubSubResource webPubSub = client.GetWebPubSubResource(webPubSubResourceId); + + // get the collection of this WebPubSubHubResource + WebPubSubHubCollection collection = webPubSub.GetWebPubSubHubs(); + + // invoke the operation + string hubName = "exampleHub"; + NullableResponse response = await collection.GetIfExistsAsync(hubName); + WebPubSubHubResource 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 + WebPubSubHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WebPubSubHubs_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubPrivateEndpointConnectionCollection.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubPrivateEndpointConnectionCollection.cs index 234e7eb33c96..006a2723e04b 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubPrivateEndpointConnectionCollection.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WebPubSubPrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // WebPubSubPrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WebPubSubPrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubPrivateEndpointConnections_Get.json + // this example is just showing the usage of "WebPubSubPrivateEndpointConnections_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 WebPubSubResource created on azure + // for more information of creating WebPubSubResource, please refer to the document of WebPubSubResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "myWebPubSubService"; + ResourceIdentifier webPubSubResourceId = WebPubSubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + WebPubSubResource webPubSub = client.GetWebPubSubResource(webPubSubResourceId); + + // get the collection of this WebPubSubPrivateEndpointConnectionResource + WebPubSubPrivateEndpointConnectionCollection collection = webPubSub.GetWebPubSubPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + WebPubSubPrivateEndpointConnectionResource 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 + WebPubSubPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WebPubSubPrivateEndpointConnections_Update [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubSharedPrivateLinkCollection.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubSharedPrivateLinkCollection.cs index 0cc6a029d3b0..710294b935f6 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubSharedPrivateLinkCollection.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/samples/Generated/Samples/Sample_WebPubSubSharedPrivateLinkCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_WebPubSubSharedPrivateLinkResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + // WebPubSubSharedPrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WebPubSubSharedPrivateLinkResourcesGet() + { + // Generated from example definition: specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/WebPubSubSharedPrivateLinkResources_Get.json + // this example is just showing the usage of "WebPubSubSharedPrivateLinkResources_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 WebPubSubResource created on azure + // for more information of creating WebPubSubResource, please refer to the document of WebPubSubResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string resourceName = "myWebPubSubService"; + ResourceIdentifier webPubSubResourceId = WebPubSubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); + WebPubSubResource webPubSub = client.GetWebPubSubResource(webPubSubResourceId); + + // get the collection of this WebPubSubSharedPrivateLinkResource + WebPubSubSharedPrivateLinkCollection collection = webPubSub.GetWebPubSubSharedPrivateLinks(); + + // invoke the operation + string sharedPrivateLinkResourceName = "upstream"; + NullableResponse response = await collection.GetIfExistsAsync(sharedPrivateLinkResourceName); + WebPubSubSharedPrivateLinkResource 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 + WebPubSubSharedPrivateLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WebPubSubSharedPrivateLinkResources_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubCollection.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubCollection.cs index 047b194caf43..23719643e6e5 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubCollection.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName} + /// + /// + /// Operation Id + /// WebPubSub_Get + /// + /// + /// + /// The name of the 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _webPubSubClientDiagnostics.CreateScope("WebPubSubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webPubSubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebPubSubResource(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.SignalRService/webPubSub/{resourceName} + /// + /// + /// Operation Id + /// WebPubSub_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _webPubSubClientDiagnostics.CreateScope("WebPubSubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webPubSubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebPubSubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubHubCollection.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubHubCollection.cs index 7e58adfba447..62157d736231 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubHubCollection.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubHubCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string hubName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName} + /// + /// + /// Operation Id + /// WebPubSubHubs_Get + /// + /// + /// + /// The hub name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hubName, nameof(hubName)); + + using var scope = _webPubSubHubClientDiagnostics.CreateScope("WebPubSubHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webPubSubHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hubName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebPubSubHubResource(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.SignalRService/webPubSub/{resourceName}/hubs/{hubName} + /// + /// + /// Operation Id + /// WebPubSubHubs_Get + /// + /// + /// + /// The hub name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hubName, nameof(hubName)); + + using var scope = _webPubSubHubClientDiagnostics.CreateScope("WebPubSubHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webPubSubHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hubName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebPubSubHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubPrivateEndpointConnectionCollection.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubPrivateEndpointConnectionCollection.cs index 273c48675e18..b59d636d4c30 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubPrivateEndpointConnectionCollection.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// WebPubSubPrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _webPubSubPrivateEndpointConnectionClientDiagnostics.CreateScope("WebPubSubPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webPubSubPrivateEndpointConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebPubSubPrivateEndpointConnectionResource(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.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// WebPubSubPrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _webPubSubPrivateEndpointConnectionClientDiagnostics.CreateScope("WebPubSubPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webPubSubPrivateEndpointConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebPubSubPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubSharedPrivateLinkCollection.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubSharedPrivateLinkCollection.cs index b3501ec37a08..4956267929d1 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubSharedPrivateLinkCollection.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubSharedPrivateLinkCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string sharedPrivateLinkResourceName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// WebPubSubSharedPrivateLinkResources_Get + /// + /// + /// + /// The name of the shared private link 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 sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _webPubSubSharedPrivateLinkWebPubSubSharedPrivateLinkResourcesClientDiagnostics.CreateScope("WebPubSubSharedPrivateLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webPubSubSharedPrivateLinkWebPubSubSharedPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebPubSubSharedPrivateLinkResource(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.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// WebPubSubSharedPrivateLinkResources_Get + /// + /// + /// + /// The name of the shared private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _webPubSubSharedPrivateLinkWebPubSubSharedPrivateLinkResourcesClientDiagnostics.CreateScope("WebPubSubSharedPrivateLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webPubSubSharedPrivateLinkWebPubSubSharedPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebPubSubSharedPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateCollection.cs index 998f9ffb4df3..9d4cf1966344 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetCertificate() Console.WriteLine($"Succeeded: {result}"); } + // Get Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetCertificate.json + // this example is just showing the usage of "Certificates_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppCertificateResource + AppCertificateCollection collection = resourceGroupResource.GetAppCertificates(); + + // invoke the operation + string name = "testc6282"; + NullableResponse response = await collection.GetIfExistsAsync(name); + AppCertificateResource 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 + AppCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Or Update Certificate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanCollection.cs index 1ec85f9b8a1f..9df943fe42d1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetAppServicePlan() Console.WriteLine($"Succeeded: {result}"); } + // Get App Service plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppServicePlan() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetAppServicePlan.json + // this example is just showing the usage of "AppServicePlans_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServicePlanResource + AppServicePlanCollection collection = resourceGroupResource.GetAppServicePlans(); + + // invoke the operation + string name = "testsf6141"; + NullableResponse response = await collection.GetIfExistsAsync(name); + AppServicePlanResource 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 + AppServicePlanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Or Update App Service plan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorCollection.cs index 0010f052928b..fec4ac416e76 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetAppServiceCertificateOrderDetectorResponse() Console.WriteLine($"Succeeded: {result}"); } + + // Get app service certificate order detector response + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppServiceCertificateOrderDetectorResponse() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2021-02-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json + // this example is just showing the usage of "CertificateOrdersDiagnostics_GetAppServiceCertificateOrderDetectorResponse" 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 AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "5700fc96-77b4-4f8d-afce-c353d8c443bd"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // get the collection of this CertificateOrderDetectorResource + CertificateOrderDetectorCollection collection = appServiceCertificateOrder.GetCertificateOrderDetectors(); + + // invoke the operation + string detectorName = "AutoRenewStatus"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + CertificateOrderDetectorResource 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 + AppServiceDetectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteCollection.cs index 0d247805fe7f..923636ddb8ad 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -78,5 +79,46 @@ public async Task Exists_GetDeletedWebApp() Console.WriteLine($"Succeeded: {result}"); } + + // Get Deleted Web App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDeletedWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetDeletedWebApp.json + // this example is just showing the usage of "Global_GetDeletedWebApp" 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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this DeletedSiteResource + DeletedSiteCollection collection = subscriptionResource.GetDeletedSites(); + + // invoke the operation + string deletedSiteId = "9"; + NullableResponse response = await collection.GetIfExistsAsync(deletedSiteId); + DeletedSiteResource 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 + DeletedSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorCollection.cs index 2f374253c488..4d67b0767463 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetAppServiceEnvironmentDetectorResponses() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Service Environment Detector Responses + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppServiceEnvironmentDetectorResponses() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json + // this example is just showing the usage of "Diagnostics_GetHostingEnvironmentDetectorResponse" 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 AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string name = "SampleAppServiceEnvironment"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentDetectorResource + HostingEnvironmentDetectorCollection collection = appServiceEnvironment.GetHostingEnvironmentDetectors(); + + // invoke the operation + string detectorName = "runtimeavailability"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + HostingEnvironmentDetectorResource 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 + AppServiceDetectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentCollection.cs index d9131e912cb7..8e0621041e15 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetKubeEnvironmentsByName() Console.WriteLine($"Succeeded: {result}"); } + // Get kube environments by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetKubeEnvironmentsByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_Get.json + // this example is just showing the usage of "KubeEnvironments_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 = "8efdecc5-919e-44eb-b179-915dca89ebf9"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KubeEnvironmentResource + KubeEnvironmentCollection collection = resourceGroupResource.GetKubeEnvironments(); + + // invoke the operation + string name = "jlaw-demo1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + KubeEnvironmentResource 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 + KubeEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create kube environments [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingCollection.cs index a39f6f54e1ee..cdda20d97747 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetAzureKeyVaultAppSettingReference() Console.WriteLine($"Succeeded: {result}"); } + + // Get Azure Key Vault app setting reference + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureKeyVaultAppSettingReference() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSetting.json + // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReference" 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 WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testc6282"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteConfigAppsettingResource + SiteConfigAppsettingCollection collection = webSite.GetSiteConfigAppsettings(); + + // invoke the operation + string appSettingKey = "setting"; + NullableResponse response = await collection.GetIfExistsAsync(appSettingKey); + SiteConfigAppsettingResource 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 + ApiKeyVaultReferenceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorCollection.cs index 51544a8f234e..62a3d83b0c23 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -156,6 +157,49 @@ public async Task Exists_GetAppDetectorResponse() Console.WriteLine($"Succeeded: {result}"); } + // Get App Detector Response + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppDetectorResponse() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" 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 WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteDetectorResource + SiteDetectorCollection collection = webSite.GetSiteDetectors(); + + // invoke the operation + string detectorName = "runtimeavailability"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + SiteDetectorResource 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 + AppServiceDetectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get App Slot Detector Response [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -221,5 +265,48 @@ public async Task Exists_GetAppSlotDetectorResponse() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Slot Detector Response + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppSlotDetectorResponse() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" 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 WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteDetectorResource + SiteDetectorCollection collection = webSite.GetSiteDetectors(); + + // invoke the operation + string detectorName = "runtimeavailability"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + SiteDetectorResource 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 + AppServiceDetectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisCollection.cs index 542ae31dabdc..08efc623c3fa 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -160,6 +161,50 @@ public async Task Exists_GetAppAnalysis() Console.WriteLine($"Succeeded: {result}"); } + // Get App Analysis + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppAnalysis() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" 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 SiteDiagnosticResource created on azure + // for more information of creating SiteDiagnosticResource, please refer to the document of SiteDiagnosticResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string diagnosticCategory = "availability"; + ResourceIdentifier siteDiagnosticResourceId = SiteDiagnosticResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, diagnosticCategory); + SiteDiagnosticResource siteDiagnostic = client.GetSiteDiagnosticResource(siteDiagnosticResourceId); + + // get the collection of this SiteDiagnosticAnalysisResource + SiteDiagnosticAnalysisCollection collection = siteDiagnostic.GetSiteDiagnosticAnalyses(); + + // invoke the operation + string analysisName = "appanalysis"; + NullableResponse response = await collection.GetIfExistsAsync(analysisName); + SiteDiagnosticAnalysisResource 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 + WebSiteAnalysisDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get App Slot Analysis [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -227,5 +272,49 @@ public async Task Exists_GetAppSlotAnalysis() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Slot Analysis + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppSlotAnalysis() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" 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 SiteDiagnosticResource created on azure + // for more information of creating SiteDiagnosticResource, please refer to the document of SiteDiagnosticResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string diagnosticCategory = "availability"; + ResourceIdentifier siteDiagnosticResourceId = SiteDiagnosticResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, diagnosticCategory); + SiteDiagnosticResource siteDiagnostic = client.GetSiteDiagnosticResource(siteDiagnosticResourceId); + + // get the collection of this SiteDiagnosticAnalysisResource + SiteDiagnosticAnalysisCollection collection = siteDiagnostic.GetSiteDiagnosticAnalyses(); + + // invoke the operation + string analysisName = "appanalysis"; + NullableResponse response = await collection.GetIfExistsAsync(analysisName); + SiteDiagnosticAnalysisResource 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 + WebSiteAnalysisDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticCollection.cs index 3d9f9f7bd4de..8db4fbc5ba34 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -156,6 +157,49 @@ public async Task Exists_GetAppDiagnosticCategory() Console.WriteLine($"Succeeded: {result}"); } + // Get App Diagnostic Category + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppDiagnosticCategory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" 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 WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteDiagnosticResource + SiteDiagnosticCollection collection = webSite.GetSiteDiagnostics(); + + // invoke the operation + string diagnosticCategory = "availability"; + NullableResponse response = await collection.GetIfExistsAsync(diagnosticCategory); + SiteDiagnosticResource 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 + DiagnosticCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get App Slot Diagnostic Category [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -221,5 +265,48 @@ public async Task Exists_GetAppSlotDiagnosticCategory() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Slot Diagnostic Category + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppSlotDiagnosticCategory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" 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 WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteDiagnosticResource + SiteDiagnosticCollection collection = webSite.GetSiteDiagnostics(); + + // invoke the operation + string diagnosticCategory = "availability"; + NullableResponse response = await collection.GetIfExistsAsync(diagnosticCategory); + SiteDiagnosticResource 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 + DiagnosticCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorCollection.cs index c394e8508de7..b52fb1ac4e3a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -160,6 +161,50 @@ public async Task Exists_GetAppDetector() Console.WriteLine($"Succeeded: {result}"); } + // Get App Detector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppDetector() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // this example is just showing the usage of "Diagnostics_GetSiteDetector" 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 SiteDiagnosticResource created on azure + // for more information of creating SiteDiagnosticResource, please refer to the document of SiteDiagnosticResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string diagnosticCategory = "availability"; + ResourceIdentifier siteDiagnosticResourceId = SiteDiagnosticResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, diagnosticCategory); + SiteDiagnosticResource siteDiagnostic = client.GetSiteDiagnosticResource(siteDiagnosticResourceId); + + // get the collection of this SiteDiagnosticDetectorResource + SiteDiagnosticDetectorCollection collection = siteDiagnostic.GetSiteDiagnosticDetectors(); + + // invoke the operation + string detectorName = "sitecrashes"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + SiteDiagnosticDetectorResource 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 + DetectorDefinitionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get App Slot Detector [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -227,5 +272,49 @@ public async Task Exists_GetAppSlotDetector() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Slot Detector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppSlotDetector() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // this example is just showing the usage of "Diagnostics_GetSiteDetector" 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 SiteDiagnosticResource created on azure + // for more information of creating SiteDiagnosticResource, please refer to the document of SiteDiagnosticResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string diagnosticCategory = "availability"; + ResourceIdentifier siteDiagnosticResourceId = SiteDiagnosticResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, diagnosticCategory); + SiteDiagnosticResource siteDiagnostic = client.GetSiteDiagnosticResource(siteDiagnosticResourceId); + + // get the collection of this SiteDiagnosticDetectorResource + SiteDiagnosticDetectorCollection collection = siteDiagnostic.GetSiteDiagnosticDetectors(); + + // invoke the operation + string detectorName = "sitecrashes"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + SiteDiagnosticDetectorResource 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 + DetectorDefinitionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceCollection.cs index 0bf559f0d9a1..b89496fe0d70 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -81,5 +82,48 @@ public async Task Exists_GetSiteInstanceInfo() Console.WriteLine($"Succeeded: {result}"); } + + // Get site instance info + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSiteInstanceInfo() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // this example is just showing the usage of "WebApps_GetInstanceInfo" 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 WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "tests346"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteInstanceResource + SiteInstanceCollection collection = webSite.GetSiteInstances(); + + // invoke the operation + string instanceId = "134987120"; + NullableResponse response = await collection.GetIfExistsAsync(instanceId); + SiteInstanceResource 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 + WebSiteInstanceStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionCollection.cs index dbd88f2fbe6b..b6935d0d5568 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAPrivateEndpointConnectionForASite() Console.WriteLine($"Succeeded: {result}"); } + // Get a private endpoint connection for a site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // this example is just showing the usage of "WebApps_GetPrivateEndpointConnection" 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 WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SitePrivateEndpointConnectionResource + SitePrivateEndpointConnectionCollection collection = webSite.GetSitePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "connection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + SitePrivateEndpointConnectionResource 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 + RemotePrivateEndpointConnectionARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approves or rejects a private endpoint connection for a site. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorCollection.cs index bf51c640bf37..bdb57d52ee0a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -160,6 +161,50 @@ public async Task Exists_GetAppDetectorResponse() Console.WriteLine($"Succeeded: {result}"); } + // Get App Detector Response + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppDetectorResponse() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" 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 WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotDetectorResource + SiteSlotDetectorCollection collection = webSiteSlot.GetSiteSlotDetectors(); + + // invoke the operation + string detectorName = "runtimeavailability"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + SiteSlotDetectorResource 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 + AppServiceDetectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get App Slot Detector Response [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -227,5 +272,49 @@ public async Task Exists_GetAppSlotDetectorResponse() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Slot Detector Response + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppSlotDetectorResponse() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" 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 WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotDetectorResource + SiteSlotDetectorCollection collection = webSiteSlot.GetSiteSlotDetectors(); + + // invoke the operation + string detectorName = "runtimeavailability"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + SiteSlotDetectorResource 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 + AppServiceDetectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisCollection.cs index a685e5da529a..225560e4dc3b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -164,6 +165,51 @@ public async Task Exists_GetAppAnalysis() Console.WriteLine($"Succeeded: {result}"); } + // Get App Analysis + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppAnalysis() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" 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 SiteSlotDiagnosticResource created on azure + // for more information of creating SiteSlotDiagnosticResource, please refer to the document of SiteSlotDiagnosticResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string slot = "Production"; + string diagnosticCategory = "availability"; + ResourceIdentifier siteSlotDiagnosticResourceId = SiteSlotDiagnosticResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, slot, diagnosticCategory); + SiteSlotDiagnosticResource siteSlotDiagnostic = client.GetSiteSlotDiagnosticResource(siteSlotDiagnosticResourceId); + + // get the collection of this SiteSlotDiagnosticAnalysisResource + SiteSlotDiagnosticAnalysisCollection collection = siteSlotDiagnostic.GetSiteSlotDiagnosticAnalyses(); + + // invoke the operation + string analysisName = "appanalysis"; + NullableResponse response = await collection.GetIfExistsAsync(analysisName); + SiteSlotDiagnosticAnalysisResource 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 + WebSiteAnalysisDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get App Slot Analysis [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -233,5 +279,50 @@ public async Task Exists_GetAppSlotAnalysis() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Slot Analysis + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppSlotAnalysis() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" 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 SiteSlotDiagnosticResource created on azure + // for more information of creating SiteSlotDiagnosticResource, please refer to the document of SiteSlotDiagnosticResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string slot = "staging"; + string diagnosticCategory = "availability"; + ResourceIdentifier siteSlotDiagnosticResourceId = SiteSlotDiagnosticResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, slot, diagnosticCategory); + SiteSlotDiagnosticResource siteSlotDiagnostic = client.GetSiteSlotDiagnosticResource(siteSlotDiagnosticResourceId); + + // get the collection of this SiteSlotDiagnosticAnalysisResource + SiteSlotDiagnosticAnalysisCollection collection = siteSlotDiagnostic.GetSiteSlotDiagnosticAnalyses(); + + // invoke the operation + string analysisName = "appanalysis"; + NullableResponse response = await collection.GetIfExistsAsync(analysisName); + SiteSlotDiagnosticAnalysisResource 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 + WebSiteAnalysisDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticCollection.cs index 7e7e19f2d3b2..1a8118e09141 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -160,6 +161,50 @@ public async Task Exists_GetAppDiagnosticCategory() Console.WriteLine($"Succeeded: {result}"); } + // Get App Diagnostic Category + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppDiagnosticCategory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" 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 WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string slot = "Production"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotDiagnosticResource + SiteSlotDiagnosticCollection collection = webSiteSlot.GetSiteSlotDiagnostics(); + + // invoke the operation + string diagnosticCategory = "availability"; + NullableResponse response = await collection.GetIfExistsAsync(diagnosticCategory); + SiteSlotDiagnosticResource 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 + DiagnosticCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get App Slot Diagnostic Category [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -227,5 +272,49 @@ public async Task Exists_GetAppSlotDiagnosticCategory() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Slot Diagnostic Category + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppSlotDiagnosticCategory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" 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 WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotDiagnosticResource + SiteSlotDiagnosticCollection collection = webSiteSlot.GetSiteSlotDiagnostics(); + + // invoke the operation + string diagnosticCategory = "availability"; + NullableResponse response = await collection.GetIfExistsAsync(diagnosticCategory); + SiteSlotDiagnosticResource 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 + DiagnosticCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorCollection.cs index e44d4acd26c5..19e030d45653 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -164,6 +165,51 @@ public async Task Exists_GetAppDetector() Console.WriteLine($"Succeeded: {result}"); } + // Get App Detector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppDetector() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" 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 SiteSlotDiagnosticResource created on azure + // for more information of creating SiteSlotDiagnosticResource, please refer to the document of SiteSlotDiagnosticResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string slot = "Production"; + string diagnosticCategory = "availability"; + ResourceIdentifier siteSlotDiagnosticResourceId = SiteSlotDiagnosticResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, slot, diagnosticCategory); + SiteSlotDiagnosticResource siteSlotDiagnostic = client.GetSiteSlotDiagnosticResource(siteSlotDiagnosticResourceId); + + // get the collection of this SiteSlotDiagnosticDetectorResource + SiteSlotDiagnosticDetectorCollection collection = siteSlotDiagnostic.GetSiteSlotDiagnosticDetectors(); + + // invoke the operation + string detectorName = "sitecrashes"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + SiteSlotDiagnosticDetectorResource 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 + DetectorDefinitionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get App Slot Detector [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -233,5 +279,50 @@ public async Task Exists_GetAppSlotDetector() Console.WriteLine($"Succeeded: {result}"); } + + // Get App Slot Detector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppSlotDetector() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" 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 SiteSlotDiagnosticResource created on azure + // for more information of creating SiteSlotDiagnosticResource, please refer to the document of SiteSlotDiagnosticResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "Sample-WestUSResourceGroup"; + string siteName = "SampleApp"; + string slot = "staging"; + string diagnosticCategory = "availability"; + ResourceIdentifier siteSlotDiagnosticResourceId = SiteSlotDiagnosticResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName, slot, diagnosticCategory); + SiteSlotDiagnosticResource siteSlotDiagnostic = client.GetSiteSlotDiagnosticResource(siteSlotDiagnosticResourceId); + + // get the collection of this SiteSlotDiagnosticDetectorResource + SiteSlotDiagnosticDetectorCollection collection = siteSlotDiagnostic.GetSiteSlotDiagnosticDetectors(); + + // invoke the operation + string detectorName = "sitecrashes"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + SiteSlotDiagnosticDetectorResource 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 + DetectorDefinitionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceCollection.cs index a188927ef24f..f8c3906bcc32 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -83,5 +84,49 @@ public async Task Exists_GetSiteInstanceInfo() Console.WriteLine($"Succeeded: {result}"); } + + // Get site instance info + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSiteInstanceInfo() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // this example is just showing the usage of "WebApps_GetInstanceInfoSlot" 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 WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "tests346"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotInstanceResource + SiteSlotInstanceCollection collection = webSiteSlot.GetSiteSlotInstances(); + + // invoke the operation + string instanceId = "134987120"; + NullableResponse response = await collection.GetIfExistsAsync(instanceId); + SiteSlotInstanceResource 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 + WebSiteInstanceStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionCollection.cs index 13a5698e1f3f..8eeab7695a2e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetAPrivateEndpointConnectionForASite() Console.WriteLine($"Succeeded: {result}"); } + // Get a private endpoint connection for a site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnectionSlot.json + // this example is just showing the usage of "WebApps_GetPrivateEndpointConnectionSlot" 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 WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + string slot = "stage"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotPrivateEndpointConnectionResource + SiteSlotPrivateEndpointConnectionCollection collection = webSiteSlot.GetSiteSlotPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "connection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + SiteSlotPrivateEndpointConnectionResource 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 + RemotePrivateEndpointConnectionARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approves or rejects a private endpoint connection for a site. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildCollection.cs index 753fde05974c..dda864e9a26c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetAStaticSiteBuild() Console.WriteLine($"Succeeded: {result}"); } + + // Get a static site build + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_GetStaticSiteBuild" 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 StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteBuildResource + StaticSiteBuildCollection collection = staticSite.GetStaticSiteBuilds(); + + // invoke the operation + string environmentName = "12"; + NullableResponse response = await collection.GetIfExistsAsync(environmentName); + StaticSiteBuildResource 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 + StaticSiteBuildData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppCollection.cs index f3993c1d190b..4a9698f5714c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithASt Console.WriteLine($"Succeeded: {result}"); } + // Get details of the user provided function app registered with a static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSiteBuild" 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 StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildUserProvidedFunctionAppResource + StaticSiteBuildUserProvidedFunctionAppCollection collection = staticSiteBuild.GetStaticSiteBuildUserProvidedFunctionApps(); + + // invoke the operation + string functionAppName = "testFunctionApp"; + NullableResponse response = await collection.GetIfExistsAsync(functionAppName); + StaticSiteBuildUserProvidedFunctionAppResource 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 + StaticSiteUserProvidedFunctionAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Register a user provided function app with a static site build [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCollection.cs index 0fe2054c5135..241174364c35 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetDetailsForAStaticSite() Console.WriteLine($"Succeeded: {result}"); } + // Get details for a static site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSite.json + // this example is just showing the usage of "StaticSites_GetStaticSite" 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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this StaticSiteResource + StaticSiteCollection collection = resourceGroupResource.GetStaticSites(); + + // invoke the operation + string name = "testStaticSite0"; + NullableResponse response = await collection.GetIfExistsAsync(name); + StaticSiteResource 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 + StaticSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a static site [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewCollection.cs index f342f059a8f5..8765c8c1afd9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetCustomDomainForAStaticSite() Console.WriteLine($"Succeeded: {result}"); } + // Get custom domain for a static site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCustomDomainForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteCustomDomain.json + // this example is just showing the usage of "StaticSites_GetStaticSiteCustomDomain" 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 StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteCustomDomainOverviewResource + StaticSiteCustomDomainOverviewCollection collection = staticSite.GetStaticSiteCustomDomainOverviews(); + + // invoke the operation + string domainName = "custom.domain.net"; + NullableResponse response = await collection.GetIfExistsAsync(domainName); + StaticSiteCustomDomainOverviewResource 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 + StaticSiteCustomDomainOverviewData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a custom domain for a static site [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionCollection.cs index 15b3f01ac6d9..d9e932f94c3c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAPrivateEndpointConnectionForASite() Console.WriteLine($"Succeeded: {result}"); } + // Get a private endpoint connection for a site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // this example is just showing the usage of "StaticSites_GetPrivateEndpointConnection" 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 StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSitePrivateEndpointConnectionResource + StaticSitePrivateEndpointConnectionCollection collection = staticSite.GetStaticSitePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "connection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + StaticSitePrivateEndpointConnectionResource 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 + RemotePrivateEndpointConnectionARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approves or rejects a private endpoint connection for a site. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppCollection.cs index 8f8317372660..91f5f6d39865 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithASt Console.WriteLine($"Succeeded: {result}"); } + // Get details of the user provided function app registered with a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSite.json + // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSite" 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 StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteUserProvidedFunctionAppResource + StaticSiteUserProvidedFunctionAppCollection collection = staticSite.GetStaticSiteUserProvidedFunctionApps(); + + // invoke the operation + string functionAppName = "testFunctionApp"; + NullableResponse response = await collection.GetIfExistsAsync(functionAppName); + StaticSiteUserProvidedFunctionAppResource 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 + StaticSiteUserProvidedFunctionAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Register a user provided function app with a static site [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainCollection.cs index 5d472877ff44..8fec7cab1b67 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_GetTopLevelDomain() Console.WriteLine($"Succeeded: {result}"); } + + // Get Top Level Domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTopLevelDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/GetTopLevelDomain.json + // this example is just showing the usage of "TopLevelDomains_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this TopLevelDomainResource + TopLevelDomainCollection collection = subscriptionResource.GetTopLevelDomains(); + + // invoke the operation + string name = "com"; + NullableResponse response = await collection.GetIfExistsAsync(name); + TopLevelDomainResource 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 + TopLevelDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingCollection.cs index c39c5bccc12a..e79e68a8e333 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetAzureKeyVaultSlotAppSettingReference() Console.WriteLine($"Succeeded: {result}"); } + + // Get Azure Key Vault slot app setting reference + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureKeyVaultSlotAppSettingReference() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSettingSlot.json + // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReferenceSlot" 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 WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testc6282"; + string slot = "stage"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this WebSiteSlotConfigAppSettingResource + WebSiteSlotConfigAppSettingCollection collection = webSiteSlot.GetWebSiteSlotConfigAppSettings(); + + // invoke the operation + string appSettingKey = "setting"; + NullableResponse response = await collection.GetIfExistsAsync(appSettingKey); + WebSiteSlotConfigAppSettingResource 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 + ApiKeyVaultReferenceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs index 688948b3db01..cd91f9e18458 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// Name of the certificate. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _appCertificateCertificatesClientDiagnostics.CreateScope("AppCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appCertificateCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppCertificateResource(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.Web/certificates/{name} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// Name of the certificate. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _appCertificateCertificatesClientDiagnostics.CreateScope("AppCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appCertificateCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateCollection.cs index b2d293438b2b..ace8ee997368 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name} + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_GetCertificate + /// + /// + /// + /// Name of the certificate. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _appServiceCertificateAppServiceCertificateOrdersClientDiagnostics.CreateScope("AppServiceCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServiceCertificateAppServiceCertificateOrdersRestClient.GetCertificateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceCertificateResource(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.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name} + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_GetCertificate + /// + /// + /// + /// Name of the certificate. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _appServiceCertificateAppServiceCertificateOrdersClientDiagnostics.CreateScope("AppServiceCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServiceCertificateAppServiceCertificateOrdersRestClient.GetCertificate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderCollection.cs index 5e42b59d0467..8a326fa589a0 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string certificateOrderName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName} + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_Get + /// + /// + /// + /// Name of the certificate order.. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateOrderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateOrderName, nameof(certificateOrderName)); + + using var scope = _appServiceCertificateOrderClientDiagnostics.CreateScope("AppServiceCertificateOrderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServiceCertificateOrderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, certificateOrderName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceCertificateOrderResource(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.CertificateRegistration/certificateOrders/{certificateOrderName} + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_Get + /// + /// + /// + /// Name of the certificate order.. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateOrderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateOrderName, nameof(certificateOrderName)); + + using var scope = _appServiceCertificateOrderClientDiagnostics.CreateScope("AppServiceCertificateOrderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServiceCertificateOrderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, certificateOrderName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceCertificateOrderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainCollection.cs index bd1e06232a1c..8a0e19bf045b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string domainName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _appServiceDomainDomainsClientDiagnostics.CreateScope("AppServiceDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServiceDomainDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, domainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceDomainResource(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.DomainRegistration/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _appServiceDomainDomainsClientDiagnostics.CreateScope("AppServiceDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServiceDomainDomainsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, domainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentCollection.cs index 53191d2d6d6c..d607a1837b09 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name} + /// + /// + /// Operation Id + /// AppServiceEnvironments_Get + /// + /// + /// + /// Name of the App Service Environment. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _appServiceEnvironmentClientDiagnostics.CreateScope("AppServiceEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServiceEnvironmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceEnvironmentResource(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.Web/hostingEnvironments/{name} + /// + /// + /// Operation Id + /// AppServiceEnvironments_Get + /// + /// + /// + /// Name of the App Service Environment. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _appServiceEnvironmentClientDiagnostics.CreateScope("AppServiceEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServiceEnvironmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceEnvironmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanCollection.cs index 9535e34cf938..439beb89563c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name} + /// + /// + /// Operation Id + /// AppServicePlans_Get + /// + /// + /// + /// Name of the App Service plan. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _appServicePlanClientDiagnostics.CreateScope("AppServicePlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServicePlanRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServicePlanResource(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.Web/serverfarms/{name} + /// + /// + /// Operation Id + /// AppServicePlans_Get + /// + /// + /// + /// Name of the App Service plan. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _appServicePlanClientDiagnostics.CreateScope("AppServicePlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServicePlanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServicePlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayCollection.cs index cd807536e95d..614e1fa7b154 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayCollection.cs @@ -201,5 +201,83 @@ public virtual Response Exists(string namespaceName, string relayName, Can throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName} + /// + /// + /// Operation Id + /// AppServicePlans_GetHybridConnection + /// + /// + /// + /// Name of the Service Bus namespace. + /// Name of the Service Bus relay. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, string relayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(relayName, nameof(relayName)); + + using var scope = _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics.CreateScope("AppServicePlanHybridConnectionNamespaceRelayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.GetHybridConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, relayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServicePlanHybridConnectionNamespaceRelayResource(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.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName} + /// + /// + /// Operation Id + /// AppServicePlans_GetHybridConnection + /// + /// + /// + /// Name of the Service Bus namespace. + /// Name of the Service Bus relay. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string namespaceName, string relayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(relayName, nameof(relayName)); + + using var scope = _appServicePlanHybridConnectionNamespaceRelayAppServicePlansClientDiagnostics.CreateScope("AppServicePlanHybridConnectionNamespaceRelayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServicePlanHybridConnectionNamespaceRelayAppServicePlansRestClient.GetHybridConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, relayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServicePlanHybridConnectionNamespaceRelayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionCollection.cs index 42d03dea1e40..6aed5155eb81 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string vnetName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName} + /// + /// + /// Operation Id + /// AppServicePlans_GetVnetFromServerFarm + /// + /// + /// + /// Name of the Virtual Network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vnetName, nameof(vnetName)); + + using var scope = _appServicePlanVirtualNetworkConnectionAppServicePlansClientDiagnostics.CreateScope("AppServicePlanVirtualNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServicePlanVirtualNetworkConnectionAppServicePlansRestClient.GetVnetFromServerFarmAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vnetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServicePlanVirtualNetworkConnectionResource(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.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName} + /// + /// + /// Operation Id + /// AppServicePlans_GetVnetFromServerFarm + /// + /// + /// + /// Name of the Virtual Network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vnetName, nameof(vnetName)); + + using var scope = _appServicePlanVirtualNetworkConnectionAppServicePlansClientDiagnostics.CreateScope("AppServicePlanVirtualNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServicePlanVirtualNetworkConnectionAppServicePlansRestClient.GetVnetFromServerFarm(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vnetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServicePlanVirtualNetworkConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayCollection.cs index 4fbc8e69ca1d..e8e8ba060f4f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string gatewayName, CancellationToken cance throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName} + /// + /// + /// Operation Id + /// AppServicePlans_GetVnetGateway + /// + /// + /// + /// Name of the gateway. Only the 'primary' gateway is supported. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _appServicePlanVirtualNetworkConnectionGatewayAppServicePlansClientDiagnostics.CreateScope("AppServicePlanVirtualNetworkConnectionGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServicePlanVirtualNetworkConnectionGatewayAppServicePlansRestClient.GetVnetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServicePlanVirtualNetworkConnectionGatewayResource(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.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName} + /// + /// + /// Operation Id + /// AppServicePlans_GetVnetGateway + /// + /// + /// + /// Name of the gateway. Only the 'primary' gateway is supported. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _appServicePlanVirtualNetworkConnectionGatewayAppServicePlansClientDiagnostics.CreateScope("AppServicePlanVirtualNetworkConnectionGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServicePlanVirtualNetworkConnectionGatewayAppServicePlansRestClient.GetVnetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServicePlanVirtualNetworkConnectionGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlCollection.cs index 4bfb7b46aa86..34c9a69420a1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string sourceControlType, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Web/sourcecontrols/{sourceControlType} + /// + /// + /// Operation Id + /// GetSourceControl + /// + /// + /// + /// Type of source control. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sourceControlType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceControlType, nameof(sourceControlType)); + + using var scope = _appServiceSourceControlClientDiagnostics.CreateScope("AppServiceSourceControlCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _appServiceSourceControlRestClient.GetSourceControlAsync(sourceControlType, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceSourceControlResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Web/sourcecontrols/{sourceControlType} + /// + /// + /// Operation Id + /// GetSourceControl + /// + /// + /// + /// Type of source control. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sourceControlType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceControlType, nameof(sourceControlType)); + + using var scope = _appServiceSourceControlClientDiagnostics.CreateScope("AppServiceSourceControlCollection.GetIfExists"); + scope.Start(); + try + { + var response = _appServiceSourceControlRestClient.GetSourceControl(sourceControlType, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AppServiceSourceControlResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorCollection.cs index ed9c85ec49e1..0dec07524fbe 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorCollection.cs @@ -253,6 +253,86 @@ public virtual Response Exists(string detectorName, DateTimeOffset? startT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/detectors/{detectorName} + /// + /// + /// Operation Id + /// CertificateOrdersDiagnostics_GetAppServiceCertificateOrderDetectorResponse + /// + /// + /// + /// The detector name which needs to be run. + /// The start time for detector response. + /// The end time for the detector response. + /// The time grain for the detector response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _certificateOrderDetectorCertificateOrdersDiagnosticsClientDiagnostics.CreateScope("CertificateOrderDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _certificateOrderDetectorCertificateOrdersDiagnosticsRestClient.GetAppServiceCertificateOrderDetectorResponseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, startTime, endTime, timeGrain, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CertificateOrderDetectorResource(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.CertificateRegistration/certificateOrders/{certificateOrderName}/detectors/{detectorName} + /// + /// + /// Operation Id + /// CertificateOrdersDiagnostics_GetAppServiceCertificateOrderDetectorResponse + /// + /// + /// + /// The detector name which needs to be run. + /// The start time for detector response. + /// The end time for the detector response. + /// The time grain for the detector response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _certificateOrderDetectorCertificateOrdersDiagnosticsClientDiagnostics.CreateScope("CertificateOrderDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _certificateOrderDetectorCertificateOrdersDiagnosticsRestClient.GetAppServiceCertificateOrderDetectorResponse(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, startTime, endTime, timeGrain, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CertificateOrderDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteCollection.cs index 17472142fadd..9cd49acc00d4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string deletedSiteId, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + /// + /// + /// Operation Id + /// Global_GetDeletedWebApp + /// + /// + /// + /// The numeric ID of the deleted app, e.g. 12345. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deletedSiteId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deletedSiteId, nameof(deletedSiteId)); + + using var scope = _deletedSiteGlobalClientDiagnostics.CreateScope("DeletedSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deletedSiteGlobalRestClient.GetDeletedWebAppAsync(Id.SubscriptionId, deletedSiteId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedSiteResource(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}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + /// + /// + /// Operation Id + /// Global_GetDeletedWebApp + /// + /// + /// + /// The numeric ID of the deleted app, e.g. 12345. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deletedSiteId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deletedSiteId, nameof(deletedSiteId)); + + using var scope = _deletedSiteGlobalClientDiagnostics.CreateScope("DeletedSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deletedSiteGlobalRestClient.GetDeletedWebApp(Id.SubscriptionId, deletedSiteId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierCollection.cs index d1a22a121749..016696dc86ba 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name} + /// + /// + /// Operation Id + /// Domains_GetOwnershipIdentifier + /// + /// + /// + /// Name of identifier. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _domainOwnershipIdentifierDomainsClientDiagnostics.CreateScope("DomainOwnershipIdentifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _domainOwnershipIdentifierDomainsRestClient.GetOwnershipIdentifierAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DomainOwnershipIdentifierResource(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.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name} + /// + /// + /// Operation Id + /// Domains_GetOwnershipIdentifier + /// + /// + /// + /// Name of identifier. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _domainOwnershipIdentifierDomainsClientDiagnostics.CreateScope("DomainOwnershipIdentifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = _domainOwnershipIdentifierDomainsRestClient.GetOwnershipIdentifier(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DomainOwnershipIdentifierResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorCollection.cs index 0d4e47bef002..16010c28d808 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorCollection.cs @@ -253,6 +253,86 @@ public virtual Response Exists(string detectorName, DateTimeOffset? startT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetHostingEnvironmentDetectorResponse + /// + /// + /// + /// Detector Resource Name. + /// Start Time. + /// End Time. + /// Time Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _hostingEnvironmentDetectorDiagnosticsClientDiagnostics.CreateScope("HostingEnvironmentDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hostingEnvironmentDetectorDiagnosticsRestClient.GetHostingEnvironmentDetectorResponseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, startTime, endTime, timeGrain, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostingEnvironmentDetectorResource(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.Web/hostingEnvironments/{name}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetHostingEnvironmentDetectorResponse + /// + /// + /// + /// Detector Resource Name. + /// Start Time. + /// End Time. + /// Time Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _hostingEnvironmentDetectorDiagnosticsClientDiagnostics.CreateScope("HostingEnvironmentDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hostingEnvironmentDetectorDiagnosticsRestClient.GetHostingEnvironmentDetectorResponse(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, startTime, endTime, timeGrain, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostingEnvironmentDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionCollection.cs index 85178f92aace..41d925288fba 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// AppServiceEnvironments_GetPrivateEndpointConnection + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics.CreateScope("HostingEnvironmentPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.GetPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostingEnvironmentPrivateEndpointConnectionResource(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.Web/hostingEnvironments/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// AppServiceEnvironments_GetPrivateEndpointConnection + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics.CreateScope("HostingEnvironmentPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.GetPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostingEnvironmentPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationCollection.cs index fce4b29e53d0..f2df57940a3c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationCollection.cs @@ -201,5 +201,83 @@ public virtual Response Exists(string name, bool? updateSeen = null, strin throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name} + /// + /// + /// Operation Id + /// Recommendations_GetRuleDetailsByHostingEnvironment + /// + /// + /// + /// Name of the recommendation. + /// Specify <code>true</code> to update the last-seen timestamp of the recommendation object. + /// The GUID of the recommendation object if you query an expired one. You don't need to specify it to query an active entry. + /// 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, bool? updateSeen = null, string recommendationId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _hostingEnvironmentRecommendationRecommendationsClientDiagnostics.CreateScope("HostingEnvironmentRecommendationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hostingEnvironmentRecommendationRecommendationsRestClient.GetRuleDetailsByHostingEnvironmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, updateSeen, recommendationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostingEnvironmentRecommendationResource(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.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name} + /// + /// + /// Operation Id + /// Recommendations_GetRuleDetailsByHostingEnvironment + /// + /// + /// + /// Name of the recommendation. + /// Specify <code>true</code> to update the last-seen timestamp of the recommendation object. + /// The GUID of the recommendation object if you query an expired one. You don't need to specify it to query an active entry. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, bool? updateSeen = null, string recommendationId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _hostingEnvironmentRecommendationRecommendationsClientDiagnostics.CreateScope("HostingEnvironmentRecommendationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hostingEnvironmentRecommendationRecommendationsRestClient.GetRuleDetailsByHostingEnvironment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, updateSeen, recommendationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostingEnvironmentRecommendationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolCollection.cs index 3e3825d76439..2123bc61333c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string workerPoolName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName} + /// + /// + /// Operation Id + /// AppServiceEnvironments_GetWorkerPool + /// + /// + /// + /// Name of the worker pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workerPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerPoolName, nameof(workerPoolName)); + + using var scope = _hostingEnvironmentWorkerPoolAppServiceEnvironmentsClientDiagnostics.CreateScope("HostingEnvironmentWorkerPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hostingEnvironmentWorkerPoolAppServiceEnvironmentsRestClient.GetWorkerPoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workerPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostingEnvironmentWorkerPoolResource(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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName} + /// + /// + /// Operation Id + /// AppServiceEnvironments_GetWorkerPool + /// + /// + /// + /// Name of the worker pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workerPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerPoolName, nameof(workerPoolName)); + + using var scope = _hostingEnvironmentWorkerPoolAppServiceEnvironmentsClientDiagnostics.CreateScope("HostingEnvironmentWorkerPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hostingEnvironmentWorkerPoolAppServiceEnvironmentsRestClient.GetWorkerPool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workerPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostingEnvironmentWorkerPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentCollection.cs index eca78f6a738e..50bf058bb5ba 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments/{name} + /// + /// + /// Operation Id + /// KubeEnvironments_Get + /// + /// + /// + /// Name of the Kubernetes Environment. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _kubeEnvironmentClientDiagnostics.CreateScope("KubeEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kubeEnvironmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KubeEnvironmentResource(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.Web/kubeEnvironments/{name} + /// + /// + /// Operation Id + /// KubeEnvironments_Get + /// + /// + /// + /// Name of the Kubernetes Environment. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _kubeEnvironmentClientDiagnostics.CreateScope("KubeEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kubeEnvironmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KubeEnvironmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/NetworkFeatureCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/NetworkFeatureCollection.cs index 2960329820bd..1b6b861a85fa 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/NetworkFeatureCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/NetworkFeatureCollection.cs @@ -193,5 +193,79 @@ public virtual Response Exists(string view, CancellationToken cancellation throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view} + /// + /// + /// Operation Id + /// WebApps_ListNetworkFeaturesSlot + /// + /// + /// + /// The type of view. Only "summary" is supported at this time. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string view, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(view, nameof(view)); + + using var scope = _networkFeatureWebAppsClientDiagnostics.CreateScope("NetworkFeatureCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFeatureWebAppsRestClient.ListNetworkFeaturesSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, view, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFeatureResource(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.Web/sites/{name}/slots/{slot}/networkFeatures/{view} + /// + /// + /// Operation Id + /// WebApps_ListNetworkFeaturesSlot + /// + /// + /// + /// The type of view. Only "summary" is supported at this time. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string view, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(view, nameof(view)); + + using var scope = _networkFeatureWebAppsClientDiagnostics.CreateScope("NetworkFeatureCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFeatureWebAppsRestClient.ListNetworkFeaturesSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, view, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFeatureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteBackupCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteBackupCollection.cs index 5c786d2d027b..1b9145e5ce72 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteBackupCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteBackupCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string backupId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId} + /// + /// + /// Operation Id + /// WebApps_GetBackupStatus + /// + /// + /// + /// ID of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _siteBackupWebAppsClientDiagnostics.CreateScope("SiteBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteBackupWebAppsRestClient.GetBackupStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteBackupResource(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.Web/sites/{name}/backups/{backupId} + /// + /// + /// Operation Id + /// WebApps_GetBackupStatus + /// + /// + /// + /// ID of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _siteBackupWebAppsClientDiagnostics.CreateScope("SiteBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteBackupWebAppsRestClient.GetBackupStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigAppsettingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigAppsettingCollection.cs index b22e26e01192..c3bd8bdce48f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigAppsettingCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigAppsettingCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string appSettingKey, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings/{appSettingKey} + /// + /// + /// Operation Id + /// WebApps_GetAppSettingKeyVaultReference + /// + /// + /// + /// App Setting key name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string appSettingKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appSettingKey, nameof(appSettingKey)); + + using var scope = _siteConfigAppsettingWebAppsClientDiagnostics.CreateScope("SiteConfigAppsettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteConfigAppsettingWebAppsRestClient.GetAppSettingKeyVaultReferenceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, appSettingKey, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteConfigAppsettingResource(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.Web/sites/{name}/config/configreferences/appsettings/{appSettingKey} + /// + /// + /// Operation Id + /// WebApps_GetAppSettingKeyVaultReference + /// + /// + /// + /// App Setting key name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string appSettingKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appSettingKey, nameof(appSettingKey)); + + using var scope = _siteConfigAppsettingWebAppsClientDiagnostics.CreateScope("SiteConfigAppsettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteConfigAppsettingWebAppsRestClient.GetAppSettingKeyVaultReference(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, appSettingKey, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteConfigAppsettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigSnapshotCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigSnapshotCollection.cs index 86c9c2227723..b87b39e0e742 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigSnapshotCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigSnapshotCollection.cs @@ -193,5 +193,79 @@ public virtual Response Exists(string snapshotId, CancellationToken cancel throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId} + /// + /// + /// Operation Id + /// WebApps_GetConfigurationSnapshot + /// + /// + /// + /// The ID of the snapshot to read. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string snapshotId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotId, nameof(snapshotId)); + + using var scope = _siteConfigSnapshotWebAppsClientDiagnostics.CreateScope("SiteConfigSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteConfigSnapshotWebAppsRestClient.GetConfigurationSnapshotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, snapshotId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteConfigSnapshotResource(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.Web/sites/{name}/config/web/snapshots/{snapshotId} + /// + /// + /// Operation Id + /// WebApps_GetConfigurationSnapshot + /// + /// + /// + /// The ID of the snapshot to read. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string snapshotId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotId, nameof(snapshotId)); + + using var scope = _siteConfigSnapshotWebAppsClientDiagnostics.CreateScope("SiteConfigSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteConfigSnapshotWebAppsRestClient.GetConfigurationSnapshot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, snapshotId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteConfigSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDeploymentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDeploymentCollection.cs index 8aedfe56e044..69a48e4b25bb 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDeploymentCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDeploymentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string id, CancellationToken cancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id} + /// + /// + /// Operation Id + /// WebApps_GetDeployment + /// + /// + /// + /// Deployment ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _siteDeploymentWebAppsClientDiagnostics.CreateScope("SiteDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteDeploymentWebAppsRestClient.GetDeploymentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDeploymentResource(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.Web/sites/{name}/deployments/{id} + /// + /// + /// Operation Id + /// WebApps_GetDeployment + /// + /// + /// + /// Deployment ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _siteDeploymentWebAppsClientDiagnostics.CreateScope("SiteDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteDeploymentWebAppsRestClient.GetDeployment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDetectorCollection.cs index 02df648d817b..72b4a45ecabb 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDetectorCollection.cs @@ -253,6 +253,86 @@ public virtual Response Exists(string detectorName, DateTimeOffset? startT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDetectorResponse + /// + /// + /// + /// Detector Resource Name. + /// Start Time. + /// End Time. + /// Time Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _siteDetectorDiagnosticsClientDiagnostics.CreateScope("SiteDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteDetectorDiagnosticsRestClient.GetSiteDetectorResponseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, startTime, endTime, timeGrain, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDetectorResource(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.Web/sites/{siteName}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDetectorResponse + /// + /// + /// + /// Detector Resource Name. + /// Start Time. + /// End Time. + /// Time Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _siteDetectorDiagnosticsClientDiagnostics.CreateScope("SiteDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteDetectorDiagnosticsRestClient.GetSiteDetectorResponse(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, startTime, endTime, timeGrain, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticAnalysisCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticAnalysisCollection.cs index 9ab2bf1be3c1..4c9a8f67cfe6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticAnalysisCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticAnalysisCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string analysisName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteAnalysis + /// + /// + /// + /// Analysis Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string analysisName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(analysisName, nameof(analysisName)); + + using var scope = _siteDiagnosticAnalysisDiagnosticsClientDiagnostics.CreateScope("SiteDiagnosticAnalysisCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteDiagnosticAnalysisDiagnosticsRestClient.GetSiteAnalysisAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, analysisName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDiagnosticAnalysisResource(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.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteAnalysis + /// + /// + /// + /// Analysis Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string analysisName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(analysisName, nameof(analysisName)); + + using var scope = _siteDiagnosticAnalysisDiagnosticsClientDiagnostics.CreateScope("SiteDiagnosticAnalysisCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteDiagnosticAnalysisDiagnosticsRestClient.GetSiteAnalysis(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, analysisName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDiagnosticAnalysisResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticCollection.cs index a7a67f423e7c..53647475e752 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string diagnosticCategory, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDiagnosticCategory + /// + /// + /// + /// Diagnostic Category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diagnosticCategory, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticCategory, nameof(diagnosticCategory)); + + using var scope = _siteDiagnosticDiagnosticsClientDiagnostics.CreateScope("SiteDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteDiagnosticDiagnosticsRestClient.GetSiteDiagnosticCategoryAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, diagnosticCategory, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDiagnosticResource(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.Web/sites/{siteName}/diagnostics/{diagnosticCategory} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDiagnosticCategory + /// + /// + /// + /// Diagnostic Category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diagnosticCategory, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticCategory, nameof(diagnosticCategory)); + + using var scope = _siteDiagnosticDiagnosticsClientDiagnostics.CreateScope("SiteDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteDiagnosticDiagnosticsRestClient.GetSiteDiagnosticCategory(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, diagnosticCategory, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDiagnosticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticDetectorCollection.cs index 3ce1016047b1..eb9365139113 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticDetectorCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string detectorName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDetector + /// + /// + /// + /// Detector Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _siteDiagnosticDetectorDiagnosticsClientDiagnostics.CreateScope("SiteDiagnosticDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteDiagnosticDetectorDiagnosticsRestClient.GetSiteDetectorAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, detectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDiagnosticDetectorResource(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.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDetector + /// + /// + /// + /// Detector Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _siteDiagnosticDetectorDiagnosticsClientDiagnostics.CreateScope("SiteDiagnosticDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteDiagnosticDetectorDiagnosticsRestClient.GetSiteDetector(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, detectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDiagnosticDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDomainOwnershipIdentifierCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDomainOwnershipIdentifierCollection.cs index 0afc02d6b29d..e59b0ea1d808 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDomainOwnershipIdentifierCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDomainOwnershipIdentifierCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string domainOwnershipIdentifierName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName} + /// + /// + /// Operation Id + /// WebApps_GetDomainOwnershipIdentifier + /// + /// + /// + /// Name of domain ownership identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string domainOwnershipIdentifierName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainOwnershipIdentifierName, nameof(domainOwnershipIdentifierName)); + + using var scope = _siteDomainOwnershipIdentifierWebAppsClientDiagnostics.CreateScope("SiteDomainOwnershipIdentifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteDomainOwnershipIdentifierWebAppsRestClient.GetDomainOwnershipIdentifierAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, domainOwnershipIdentifierName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDomainOwnershipIdentifierResource(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.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName} + /// + /// + /// Operation Id + /// WebApps_GetDomainOwnershipIdentifier + /// + /// + /// + /// Name of domain ownership identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainOwnershipIdentifierName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainOwnershipIdentifierName, nameof(domainOwnershipIdentifierName)); + + using var scope = _siteDomainOwnershipIdentifierWebAppsClientDiagnostics.CreateScope("SiteDomainOwnershipIdentifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteDomainOwnershipIdentifierWebAppsRestClient.GetDomainOwnershipIdentifier(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, domainOwnershipIdentifierName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteDomainOwnershipIdentifierResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteFunctionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteFunctionCollection.cs index ba21f9d2f300..4a5d9f96b68d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteFunctionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteFunctionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string functionName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName} + /// + /// + /// Operation Id + /// WebApps_GetFunction + /// + /// + /// + /// Function name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string functionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionName, nameof(functionName)); + + using var scope = _siteFunctionWebAppsClientDiagnostics.CreateScope("SiteFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteFunctionWebAppsRestClient.GetFunctionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, functionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteFunctionResource(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.Web/sites/{name}/functions/{functionName} + /// + /// + /// Operation Id + /// WebApps_GetFunction + /// + /// + /// + /// Function name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string functionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionName, nameof(functionName)); + + using var scope = _siteFunctionWebAppsClientDiagnostics.CreateScope("SiteFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteFunctionWebAppsRestClient.GetFunction(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, functionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHostNameBindingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHostNameBindingCollection.cs index 657617450397..a12e5f2452ed 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHostNameBindingCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHostNameBindingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string hostName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName} + /// + /// + /// Operation Id + /// WebApps_GetHostNameBinding + /// + /// + /// + /// Hostname in the hostname binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostName, nameof(hostName)); + + using var scope = _siteHostNameBindingWebAppsClientDiagnostics.CreateScope("SiteHostNameBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteHostNameBindingWebAppsRestClient.GetHostNameBindingAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hostName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteHostNameBindingResource(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.Web/sites/{name}/hostNameBindings/{hostName} + /// + /// + /// Operation Id + /// WebApps_GetHostNameBinding + /// + /// + /// + /// Hostname in the hostname binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostName, nameof(hostName)); + + using var scope = _siteHostNameBindingWebAppsClientDiagnostics.CreateScope("SiteHostNameBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteHostNameBindingWebAppsRestClient.GetHostNameBinding(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hostName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteHostNameBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionNamespaceRelayCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionNamespaceRelayCollection.cs index 35613d3da3fa..f6775d8037c8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionNamespaceRelayCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionNamespaceRelayCollection.cs @@ -287,5 +287,83 @@ public virtual Response Exists(string namespaceName, string relayName, Can throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName} + /// + /// + /// Operation Id + /// WebApps_GetHybridConnection + /// + /// + /// + /// The namespace for this hybrid connection. + /// The relay name for this hybrid connection. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, string relayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(relayName, nameof(relayName)); + + using var scope = _siteHybridConnectionNamespaceRelayWebAppsClientDiagnostics.CreateScope("SiteHybridConnectionNamespaceRelayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteHybridConnectionNamespaceRelayWebAppsRestClient.GetHybridConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, relayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteHybridConnectionNamespaceRelayResource(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.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName} + /// + /// + /// Operation Id + /// WebApps_GetHybridConnection + /// + /// + /// + /// The namespace for this hybrid connection. + /// The relay name for this hybrid connection. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string namespaceName, string relayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(relayName, nameof(relayName)); + + using var scope = _siteHybridConnectionNamespaceRelayWebAppsClientDiagnostics.CreateScope("SiteHybridConnectionNamespaceRelayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteHybridConnectionNamespaceRelayWebAppsRestClient.GetHybridConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namespaceName, relayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteHybridConnectionNamespaceRelayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceCollection.cs index a71cc37b6aa1..d21e260cd642 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string instanceId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId} + /// + /// + /// Operation Id + /// WebApps_GetInstanceInfo + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string instanceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceId, nameof(instanceId)); + + using var scope = _siteInstanceWebAppsClientDiagnostics.CreateScope("SiteInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteInstanceWebAppsRestClient.GetInstanceInfoAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, instanceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteInstanceResource(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.Web/sites/{name}/instances/{instanceId} + /// + /// + /// Operation Id + /// WebApps_GetInstanceInfo + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string instanceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceId, nameof(instanceId)); + + using var scope = _siteInstanceWebAppsClientDiagnostics.CreateScope("SiteInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteInstanceWebAppsRestClient.GetInstanceInfo(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, instanceId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessCollection.cs index 9f7d3b3bf920..068a6dda78e0 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string processId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId} + /// + /// + /// Operation Id + /// WebApps_GetInstanceProcess + /// + /// + /// + /// PID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string processId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(processId, nameof(processId)); + + using var scope = _siteInstanceProcessWebAppsClientDiagnostics.CreateScope("SiteInstanceProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteInstanceProcessWebAppsRestClient.GetInstanceProcessAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, processId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteInstanceProcessResource(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.Web/sites/{name}/instances/{instanceId}/processes/{processId} + /// + /// + /// Operation Id + /// WebApps_GetInstanceProcess + /// + /// + /// + /// PID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string processId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(processId, nameof(processId)); + + using var scope = _siteInstanceProcessWebAppsClientDiagnostics.CreateScope("SiteInstanceProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteInstanceProcessWebAppsRestClient.GetInstanceProcess(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, processId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteInstanceProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessModuleCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessModuleCollection.cs index 33084b53c9ce..4afff84a1f27 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessModuleCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessModuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string baseAddress, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress} + /// + /// + /// Operation Id + /// WebApps_GetInstanceProcessModule + /// + /// + /// + /// Module base address. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string baseAddress, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(baseAddress, nameof(baseAddress)); + + using var scope = _siteInstanceProcessModuleWebAppsClientDiagnostics.CreateScope("SiteInstanceProcessModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteInstanceProcessModuleWebAppsRestClient.GetInstanceProcessModuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, baseAddress, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteInstanceProcessModuleResource(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.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress} + /// + /// + /// Operation Id + /// WebApps_GetInstanceProcessModule + /// + /// + /// + /// Module base address. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string baseAddress, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(baseAddress, nameof(baseAddress)); + + using var scope = _siteInstanceProcessModuleWebAppsClientDiagnostics.CreateScope("SiteInstanceProcessModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteInstanceProcessModuleWebAppsRestClient.GetInstanceProcessModule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, baseAddress, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteInstanceProcessModuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePrivateEndpointConnectionCollection.cs index 70ab7d819a77..6d001d6dff9b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePrivateEndpointConnectionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// WebApps_GetPrivateEndpointConnection + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _sitePrivateEndpointConnectionWebAppsClientDiagnostics.CreateScope("SitePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sitePrivateEndpointConnectionWebAppsRestClient.GetPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SitePrivateEndpointConnectionResource(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.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// WebApps_GetPrivateEndpointConnection + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _sitePrivateEndpointConnectionWebAppsClientDiagnostics.CreateScope("SitePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sitePrivateEndpointConnectionWebAppsRestClient.GetPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SitePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessCollection.cs index e3cfc9a2c1f6..991603956d94 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string processId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId} + /// + /// + /// Operation Id + /// WebApps_GetProcess + /// + /// + /// + /// PID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string processId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(processId, nameof(processId)); + + using var scope = _siteProcessWebAppsClientDiagnostics.CreateScope("SiteProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteProcessWebAppsRestClient.GetProcessAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, processId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteProcessResource(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.Web/sites/{name}/processes/{processId} + /// + /// + /// Operation Id + /// WebApps_GetProcess + /// + /// + /// + /// PID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string processId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(processId, nameof(processId)); + + using var scope = _siteProcessWebAppsClientDiagnostics.CreateScope("SiteProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteProcessWebAppsRestClient.GetProcess(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, processId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessModuleCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessModuleCollection.cs index 8fa422339290..6c39946a5133 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessModuleCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessModuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string baseAddress, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress} + /// + /// + /// Operation Id + /// WebApps_GetProcessModule + /// + /// + /// + /// Module base address. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string baseAddress, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(baseAddress, nameof(baseAddress)); + + using var scope = _siteProcessModuleWebAppsClientDiagnostics.CreateScope("SiteProcessModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteProcessModuleWebAppsRestClient.GetProcessModuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, baseAddress, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteProcessModuleResource(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.Web/sites/{name}/processes/{processId}/modules/{baseAddress} + /// + /// + /// Operation Id + /// WebApps_GetProcessModule + /// + /// + /// + /// Module base address. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string baseAddress, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(baseAddress, nameof(baseAddress)); + + using var scope = _siteProcessModuleWebAppsClientDiagnostics.CreateScope("SiteProcessModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteProcessModuleWebAppsRestClient.GetProcessModule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, baseAddress, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteProcessModuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePublicCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePublicCertificateCollection.cs index ee6237a244db..769064557599 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePublicCertificateCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePublicCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string publicCertificateName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName} + /// + /// + /// Operation Id + /// WebApps_GetPublicCertificate + /// + /// + /// + /// Public certificate name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publicCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCertificateName, nameof(publicCertificateName)); + + using var scope = _sitePublicCertificateWebAppsClientDiagnostics.CreateScope("SitePublicCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sitePublicCertificateWebAppsRestClient.GetPublicCertificateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicCertificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SitePublicCertificateResource(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.Web/sites/{name}/publicCertificates/{publicCertificateName} + /// + /// + /// Operation Id + /// WebApps_GetPublicCertificate + /// + /// + /// + /// Public certificate name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publicCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCertificateName, nameof(publicCertificateName)); + + using var scope = _sitePublicCertificateWebAppsClientDiagnostics.CreateScope("SitePublicCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sitePublicCertificateWebAppsRestClient.GetPublicCertificate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicCertificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SitePublicCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteRecommendationCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteRecommendationCollection.cs index f177eb772571..f4e841c85fd7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteRecommendationCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteRecommendationCollection.cs @@ -201,5 +201,83 @@ public virtual Response Exists(string name, bool? updateSeen = null, strin throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name} + /// + /// + /// Operation Id + /// Recommendations_GetRuleDetailsByWebApp + /// + /// + /// + /// Name of the recommendation. + /// Specify <code>true</code> to update the last-seen timestamp of the recommendation object. + /// The GUID of the recommendation object if you query an expired one. You don't need to specify it to query an active entry. + /// 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, bool? updateSeen = null, string recommendationId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _siteRecommendationRecommendationsClientDiagnostics.CreateScope("SiteRecommendationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecommendationRecommendationsRestClient.GetRuleDetailsByWebAppAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, updateSeen, recommendationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecommendationResource(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.Web/sites/{siteName}/recommendations/{name} + /// + /// + /// Operation Id + /// Recommendations_GetRuleDetailsByWebApp + /// + /// + /// + /// Name of the recommendation. + /// Specify <code>true</code> to update the last-seen timestamp of the recommendation object. + /// The GUID of the recommendation object if you query an expired one. You don't need to specify it to query an active entry. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, bool? updateSeen = null, string recommendationId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _siteRecommendationRecommendationsClientDiagnostics.CreateScope("SiteRecommendationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecommendationRecommendationsRestClient.GetRuleDetailsByWebApp(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, updateSeen, recommendationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecommendationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotBackupCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotBackupCollection.cs index b8eaff188bd4..eb724b864a8c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotBackupCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotBackupCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string backupId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId} + /// + /// + /// Operation Id + /// WebApps_GetBackupStatusSlot + /// + /// + /// + /// ID of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _siteSlotBackupWebAppsClientDiagnostics.CreateScope("SiteSlotBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotBackupWebAppsRestClient.GetBackupStatusSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotBackupResource(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.Web/sites/{name}/slots/{slot}/backups/{backupId} + /// + /// + /// Operation Id + /// WebApps_GetBackupStatusSlot + /// + /// + /// + /// ID of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _siteSlotBackupWebAppsClientDiagnostics.CreateScope("SiteSlotBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotBackupWebAppsRestClient.GetBackupStatusSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigSnapshotCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigSnapshotCollection.cs index 7010e9031bc3..b7262f12584b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigSnapshotCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigSnapshotCollection.cs @@ -193,5 +193,79 @@ public virtual Response Exists(string snapshotId, CancellationToken cancel throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId} + /// + /// + /// Operation Id + /// WebApps_GetConfigurationSnapshotSlot + /// + /// + /// + /// The ID of the snapshot to read. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string snapshotId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotId, nameof(snapshotId)); + + using var scope = _siteSlotConfigSnapshotWebAppsClientDiagnostics.CreateScope("SiteSlotConfigSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotConfigSnapshotWebAppsRestClient.GetConfigurationSnapshotSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, snapshotId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotConfigSnapshotResource(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.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId} + /// + /// + /// Operation Id + /// WebApps_GetConfigurationSnapshotSlot + /// + /// + /// + /// The ID of the snapshot to read. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string snapshotId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotId, nameof(snapshotId)); + + using var scope = _siteSlotConfigSnapshotWebAppsClientDiagnostics.CreateScope("SiteSlotConfigSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotConfigSnapshotWebAppsRestClient.GetConfigurationSnapshotSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, snapshotId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotConfigSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDeploymentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDeploymentCollection.cs index 16cf64c01c36..a75411368f2a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDeploymentCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDeploymentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string id, CancellationToken cancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id} + /// + /// + /// Operation Id + /// WebApps_GetDeploymentSlot + /// + /// + /// + /// Deployment ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _siteSlotDeploymentWebAppsClientDiagnostics.CreateScope("SiteSlotDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotDeploymentWebAppsRestClient.GetDeploymentSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDeploymentResource(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.Web/sites/{name}/slots/{slot}/deployments/{id} + /// + /// + /// Operation Id + /// WebApps_GetDeploymentSlot + /// + /// + /// + /// Deployment ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _siteSlotDeploymentWebAppsClientDiagnostics.CreateScope("SiteSlotDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotDeploymentWebAppsRestClient.GetDeploymentSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDetectorCollection.cs index 211e1a4e601d..9e2943094f6a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDetectorCollection.cs @@ -253,6 +253,86 @@ public virtual Response Exists(string detectorName, DateTimeOffset? startT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDetectorResponseSlot + /// + /// + /// + /// Detector Resource Name. + /// Start Time. + /// End Time. + /// Time Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _siteSlotDetectorDiagnosticsClientDiagnostics.CreateScope("SiteSlotDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotDetectorDiagnosticsRestClient.GetSiteDetectorResponseSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, detectorName, startTime, endTime, timeGrain, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDetectorResource(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.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDetectorResponseSlot + /// + /// + /// + /// Detector Resource Name. + /// Start Time. + /// End Time. + /// Time Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _siteSlotDetectorDiagnosticsClientDiagnostics.CreateScope("SiteSlotDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotDetectorDiagnosticsRestClient.GetSiteDetectorResponseSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, detectorName, startTime, endTime, timeGrain, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticAnalysisCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticAnalysisCollection.cs index 7000a19e3085..d79c5fa39794 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticAnalysisCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticAnalysisCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string analysisName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteAnalysisSlot + /// + /// + /// + /// Analysis Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string analysisName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(analysisName, nameof(analysisName)); + + using var scope = _siteSlotDiagnosticAnalysisDiagnosticsClientDiagnostics.CreateScope("SiteSlotDiagnosticAnalysisCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotDiagnosticAnalysisDiagnosticsRestClient.GetSiteAnalysisSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, analysisName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDiagnosticAnalysisResource(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.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteAnalysisSlot + /// + /// + /// + /// Analysis Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string analysisName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(analysisName, nameof(analysisName)); + + using var scope = _siteSlotDiagnosticAnalysisDiagnosticsClientDiagnostics.CreateScope("SiteSlotDiagnosticAnalysisCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotDiagnosticAnalysisDiagnosticsRestClient.GetSiteAnalysisSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, analysisName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDiagnosticAnalysisResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticCollection.cs index 5608e834c1f3..333154d7db64 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string diagnosticCategory, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDiagnosticCategorySlot + /// + /// + /// + /// Diagnostic Category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diagnosticCategory, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticCategory, nameof(diagnosticCategory)); + + using var scope = _siteSlotDiagnosticDiagnosticsClientDiagnostics.CreateScope("SiteSlotDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotDiagnosticDiagnosticsRestClient.GetSiteDiagnosticCategorySlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diagnosticCategory, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDiagnosticResource(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.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDiagnosticCategorySlot + /// + /// + /// + /// Diagnostic Category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diagnosticCategory, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticCategory, nameof(diagnosticCategory)); + + using var scope = _siteSlotDiagnosticDiagnosticsClientDiagnostics.CreateScope("SiteSlotDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotDiagnosticDiagnosticsRestClient.GetSiteDiagnosticCategorySlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diagnosticCategory, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDiagnosticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticDetectorCollection.cs index b93ecb0c22c6..a8a300642dd2 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticDetectorCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string detectorName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDetectorSlot + /// + /// + /// + /// Detector Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _siteSlotDiagnosticDetectorDiagnosticsClientDiagnostics.CreateScope("SiteSlotDiagnosticDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotDiagnosticDetectorDiagnosticsRestClient.GetSiteDetectorSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, detectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDiagnosticDetectorResource(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.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName} + /// + /// + /// Operation Id + /// Diagnostics_GetSiteDetectorSlot + /// + /// + /// + /// Detector Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _siteSlotDiagnosticDetectorDiagnosticsClientDiagnostics.CreateScope("SiteSlotDiagnosticDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotDiagnosticDetectorDiagnosticsRestClient.GetSiteDetectorSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, detectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDiagnosticDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDomainOwnershipIdentifierCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDomainOwnershipIdentifierCollection.cs index f9afc9a77a47..b7b734d76827 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDomainOwnershipIdentifierCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDomainOwnershipIdentifierCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string domainOwnershipIdentifierName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName} + /// + /// + /// Operation Id + /// WebApps_GetDomainOwnershipIdentifierSlot + /// + /// + /// + /// Name of domain ownership identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string domainOwnershipIdentifierName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainOwnershipIdentifierName, nameof(domainOwnershipIdentifierName)); + + using var scope = _siteSlotDomainOwnershipIdentifierWebAppsClientDiagnostics.CreateScope("SiteSlotDomainOwnershipIdentifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotDomainOwnershipIdentifierWebAppsRestClient.GetDomainOwnershipIdentifierSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, domainOwnershipIdentifierName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDomainOwnershipIdentifierResource(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.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName} + /// + /// + /// Operation Id + /// WebApps_GetDomainOwnershipIdentifierSlot + /// + /// + /// + /// Name of domain ownership identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainOwnershipIdentifierName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainOwnershipIdentifierName, nameof(domainOwnershipIdentifierName)); + + using var scope = _siteSlotDomainOwnershipIdentifierWebAppsClientDiagnostics.CreateScope("SiteSlotDomainOwnershipIdentifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotDomainOwnershipIdentifierWebAppsRestClient.GetDomainOwnershipIdentifierSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, domainOwnershipIdentifierName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotDomainOwnershipIdentifierResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotFunctionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotFunctionCollection.cs index 443a3ede3e88..4ae5b5ea38d9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotFunctionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotFunctionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string functionName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName} + /// + /// + /// Operation Id + /// WebApps_GetInstanceFunctionSlot + /// + /// + /// + /// Function name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string functionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionName, nameof(functionName)); + + using var scope = _siteSlotFunctionWebAppsClientDiagnostics.CreateScope("SiteSlotFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotFunctionWebAppsRestClient.GetInstanceFunctionSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, functionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotFunctionResource(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.Web/sites/{name}/slots/{slot}/functions/{functionName} + /// + /// + /// Operation Id + /// WebApps_GetInstanceFunctionSlot + /// + /// + /// + /// Function name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string functionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionName, nameof(functionName)); + + using var scope = _siteSlotFunctionWebAppsClientDiagnostics.CreateScope("SiteSlotFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotFunctionWebAppsRestClient.GetInstanceFunctionSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, functionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHostNameBindingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHostNameBindingCollection.cs index fb1ad4189d22..bf1cd003719b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHostNameBindingCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHostNameBindingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string hostName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName} + /// + /// + /// Operation Id + /// WebApps_GetHostNameBindingSlot + /// + /// + /// + /// Hostname in the hostname binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostName, nameof(hostName)); + + using var scope = _siteSlotHostNameBindingWebAppsClientDiagnostics.CreateScope("SiteSlotHostNameBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotHostNameBindingWebAppsRestClient.GetHostNameBindingSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hostName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotHostNameBindingResource(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.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName} + /// + /// + /// Operation Id + /// WebApps_GetHostNameBindingSlot + /// + /// + /// + /// Hostname in the hostname binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostName, nameof(hostName)); + + using var scope = _siteSlotHostNameBindingWebAppsClientDiagnostics.CreateScope("SiteSlotHostNameBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotHostNameBindingWebAppsRestClient.GetHostNameBindingSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hostName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotHostNameBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHybridConnectionNamespaceRelayCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHybridConnectionNamespaceRelayCollection.cs index 1a9961961442..0dab9324a554 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHybridConnectionNamespaceRelayCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHybridConnectionNamespaceRelayCollection.cs @@ -287,5 +287,83 @@ public virtual Response Exists(string namespaceName, string relayName, Can throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName} + /// + /// + /// Operation Id + /// WebApps_GetHybridConnectionSlot + /// + /// + /// + /// The namespace for this hybrid connection. + /// The relay name for this hybrid connection. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, string relayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(relayName, nameof(relayName)); + + using var scope = _siteSlotHybridConnectionNamespaceRelayWebAppsClientDiagnostics.CreateScope("SiteSlotHybridConnectionNamespaceRelayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotHybridConnectionNamespaceRelayWebAppsRestClient.GetHybridConnectionSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namespaceName, relayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotHybridConnectionNamespaceRelayResource(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.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName} + /// + /// + /// Operation Id + /// WebApps_GetHybridConnectionSlot + /// + /// + /// + /// The namespace for this hybrid connection. + /// The relay name for this hybrid connection. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string namespaceName, string relayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + Argument.AssertNotNullOrEmpty(relayName, nameof(relayName)); + + using var scope = _siteSlotHybridConnectionNamespaceRelayWebAppsClientDiagnostics.CreateScope("SiteSlotHybridConnectionNamespaceRelayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotHybridConnectionNamespaceRelayWebAppsRestClient.GetHybridConnectionSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namespaceName, relayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotHybridConnectionNamespaceRelayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceCollection.cs index 05ebe668a29e..3a64ebe57f6e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string instanceId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId} + /// + /// + /// Operation Id + /// WebApps_GetInstanceInfoSlot + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string instanceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceId, nameof(instanceId)); + + using var scope = _siteSlotInstanceWebAppsClientDiagnostics.CreateScope("SiteSlotInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotInstanceWebAppsRestClient.GetInstanceInfoSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, instanceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotInstanceResource(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.Web/sites/{name}/slots/{slot}/instances/{instanceId} + /// + /// + /// Operation Id + /// WebApps_GetInstanceInfoSlot + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string instanceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceId, nameof(instanceId)); + + using var scope = _siteSlotInstanceWebAppsClientDiagnostics.CreateScope("SiteSlotInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotInstanceWebAppsRestClient.GetInstanceInfoSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, instanceId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessCollection.cs index 7b1a8df3f1c7..c804f64609ee 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string processId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId} + /// + /// + /// Operation Id + /// WebApps_GetInstanceProcessSlot + /// + /// + /// + /// PID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string processId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(processId, nameof(processId)); + + using var scope = _siteSlotInstanceProcessWebAppsClientDiagnostics.CreateScope("SiteSlotInstanceProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotInstanceProcessWebAppsRestClient.GetInstanceProcessSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, processId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotInstanceProcessResource(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.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId} + /// + /// + /// Operation Id + /// WebApps_GetInstanceProcessSlot + /// + /// + /// + /// PID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string processId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(processId, nameof(processId)); + + using var scope = _siteSlotInstanceProcessWebAppsClientDiagnostics.CreateScope("SiteSlotInstanceProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotInstanceProcessWebAppsRestClient.GetInstanceProcessSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, processId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotInstanceProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessModuleCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessModuleCollection.cs index 3ffe28bbf1d1..b9c8490911c4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessModuleCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessModuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string baseAddress, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress} + /// + /// + /// Operation Id + /// WebApps_GetInstanceProcessModuleSlot + /// + /// + /// + /// Module base address. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string baseAddress, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(baseAddress, nameof(baseAddress)); + + using var scope = _siteSlotInstanceProcessModuleWebAppsClientDiagnostics.CreateScope("SiteSlotInstanceProcessModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotInstanceProcessModuleWebAppsRestClient.GetInstanceProcessModuleSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, baseAddress, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotInstanceProcessModuleResource(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.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress} + /// + /// + /// Operation Id + /// WebApps_GetInstanceProcessModuleSlot + /// + /// + /// + /// Module base address. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string baseAddress, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(baseAddress, nameof(baseAddress)); + + using var scope = _siteSlotInstanceProcessModuleWebAppsClientDiagnostics.CreateScope("SiteSlotInstanceProcessModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotInstanceProcessModuleWebAppsRestClient.GetInstanceProcessModuleSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, baseAddress, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotInstanceProcessModuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateEndpointConnectionCollection.cs index b054b1208c93..2450eabfd3cd 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateEndpointConnectionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// WebApps_GetPrivateEndpointConnectionSlot + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _siteSlotPrivateEndpointConnectionWebAppsClientDiagnostics.CreateScope("SiteSlotPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotPrivateEndpointConnectionWebAppsRestClient.GetPrivateEndpointConnectionSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotPrivateEndpointConnectionResource(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.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// WebApps_GetPrivateEndpointConnectionSlot + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _siteSlotPrivateEndpointConnectionWebAppsClientDiagnostics.CreateScope("SiteSlotPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotPrivateEndpointConnectionWebAppsRestClient.GetPrivateEndpointConnectionSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessCollection.cs index cfadfb1ca033..1de2f1c2ca54 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string processId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId} + /// + /// + /// Operation Id + /// WebApps_GetProcessSlot + /// + /// + /// + /// PID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string processId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(processId, nameof(processId)); + + using var scope = _siteSlotProcessWebAppsClientDiagnostics.CreateScope("SiteSlotProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotProcessWebAppsRestClient.GetProcessSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, processId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotProcessResource(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.Web/sites/{name}/slots/{slot}/processes/{processId} + /// + /// + /// Operation Id + /// WebApps_GetProcessSlot + /// + /// + /// + /// PID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string processId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(processId, nameof(processId)); + + using var scope = _siteSlotProcessWebAppsClientDiagnostics.CreateScope("SiteSlotProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotProcessWebAppsRestClient.GetProcessSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, processId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessModuleCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessModuleCollection.cs index 39b9a4d27569..83f11e372a79 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessModuleCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessModuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string baseAddress, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress} + /// + /// + /// Operation Id + /// WebApps_GetProcessModuleSlot + /// + /// + /// + /// Module base address. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string baseAddress, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(baseAddress, nameof(baseAddress)); + + using var scope = _siteSlotProcessModuleWebAppsClientDiagnostics.CreateScope("SiteSlotProcessModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotProcessModuleWebAppsRestClient.GetProcessModuleSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, baseAddress, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotProcessModuleResource(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.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress} + /// + /// + /// Operation Id + /// WebApps_GetProcessModuleSlot + /// + /// + /// + /// Module base address. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string baseAddress, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(baseAddress, nameof(baseAddress)); + + using var scope = _siteSlotProcessModuleWebAppsClientDiagnostics.CreateScope("SiteSlotProcessModuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotProcessModuleWebAppsRestClient.GetProcessModuleSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, baseAddress, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotProcessModuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionCollection.cs index 7258c7492f11..6fe6c6b941a9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string vnetName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName} + /// + /// + /// Operation Id + /// WebApps_GetVnetConnectionSlot + /// + /// + /// + /// Name of the virtual network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vnetName, nameof(vnetName)); + + using var scope = _siteSlotVirtualNetworkConnectionWebAppsClientDiagnostics.CreateScope("SiteSlotVirtualNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotVirtualNetworkConnectionWebAppsRestClient.GetVnetConnectionSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vnetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotVirtualNetworkConnectionResource(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.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName} + /// + /// + /// Operation Id + /// WebApps_GetVnetConnectionSlot + /// + /// + /// + /// Name of the virtual network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vnetName, nameof(vnetName)); + + using var scope = _siteSlotVirtualNetworkConnectionWebAppsClientDiagnostics.CreateScope("SiteSlotVirtualNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotVirtualNetworkConnectionWebAppsRestClient.GetVnetConnectionSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vnetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotVirtualNetworkConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionGatewayCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionGatewayCollection.cs index 1a5053411fe5..8a7d80ad2cb4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionGatewayCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionGatewayCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string gatewayName, CancellationToken cance throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName} + /// + /// + /// Operation Id + /// WebApps_GetVnetConnectionGatewaySlot + /// + /// + /// + /// Name of the gateway. Currently, the only supported string is "primary". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _siteSlotVirtualNetworkConnectionGatewayWebAppsClientDiagnostics.CreateScope("SiteSlotVirtualNetworkConnectionGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteSlotVirtualNetworkConnectionGatewayWebAppsRestClient.GetVnetConnectionGatewaySlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, gatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotVirtualNetworkConnectionGatewayResource(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.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName} + /// + /// + /// Operation Id + /// WebApps_GetVnetConnectionGatewaySlot + /// + /// + /// + /// Name of the gateway. Currently, the only supported string is "primary". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _siteSlotVirtualNetworkConnectionGatewayWebAppsClientDiagnostics.CreateScope("SiteSlotVirtualNetworkConnectionGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteSlotVirtualNetworkConnectionGatewayWebAppsRestClient.GetVnetConnectionGatewaySlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, gatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteSlotVirtualNetworkConnectionGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionCollection.cs index 246f71a88eda..f88918244bec 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string vnetName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName} + /// + /// + /// Operation Id + /// WebApps_GetVnetConnection + /// + /// + /// + /// Name of the virtual network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vnetName, nameof(vnetName)); + + using var scope = _siteVirtualNetworkConnectionWebAppsClientDiagnostics.CreateScope("SiteVirtualNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteVirtualNetworkConnectionWebAppsRestClient.GetVnetConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vnetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteVirtualNetworkConnectionResource(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.Web/sites/{name}/virtualNetworkConnections/{vnetName} + /// + /// + /// Operation Id + /// WebApps_GetVnetConnection + /// + /// + /// + /// Name of the virtual network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vnetName, nameof(vnetName)); + + using var scope = _siteVirtualNetworkConnectionWebAppsClientDiagnostics.CreateScope("SiteVirtualNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteVirtualNetworkConnectionWebAppsRestClient.GetVnetConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vnetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteVirtualNetworkConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionGatewayCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionGatewayCollection.cs index 0283bad35723..691fdac7f383 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionGatewayCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionGatewayCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string gatewayName, CancellationToken cance throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName} + /// + /// + /// Operation Id + /// WebApps_GetVnetConnectionGateway + /// + /// + /// + /// Name of the gateway. Currently, the only supported string is "primary". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _siteVirtualNetworkConnectionGatewayWebAppsClientDiagnostics.CreateScope("SiteVirtualNetworkConnectionGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteVirtualNetworkConnectionGatewayWebAppsRestClient.GetVnetConnectionGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteVirtualNetworkConnectionGatewayResource(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.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName} + /// + /// + /// Operation Id + /// WebApps_GetVnetConnectionGateway + /// + /// + /// + /// Name of the gateway. Currently, the only supported string is "primary". + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _siteVirtualNetworkConnectionGatewayWebAppsClientDiagnostics.CreateScope("SiteVirtualNetworkConnectionGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteVirtualNetworkConnectionGatewayWebAppsRestClient.GetVnetConnectionGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteVirtualNetworkConnectionGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildCollection.cs index 32d2c2a21cd0..1b5d7da8d80e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string environmentName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName} + /// + /// + /// Operation Id + /// StaticSites_GetStaticSiteBuild + /// + /// + /// + /// The stage site identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string environmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); + + using var scope = _staticSiteBuildStaticSitesClientDiagnostics.CreateScope("StaticSiteBuildCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _staticSiteBuildStaticSitesRestClient.GetStaticSiteBuildAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, environmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteBuildResource(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.Web/staticSites/{name}/builds/{environmentName} + /// + /// + /// Operation Id + /// StaticSites_GetStaticSiteBuild + /// + /// + /// + /// The stage site identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string environmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); + + using var scope = _staticSiteBuildStaticSitesClientDiagnostics.CreateScope("StaticSiteBuildCollection.GetIfExists"); + scope.Start(); + try + { + var response = _staticSiteBuildStaticSitesRestClient.GetStaticSiteBuild(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, environmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteBuildResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildUserProvidedFunctionAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildUserProvidedFunctionAppCollection.cs index 2f10225e68bf..c94f7f601822 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildUserProvidedFunctionAppCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildUserProvidedFunctionAppCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string functionAppName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/userProvidedFunctionApps/{functionAppName} + /// + /// + /// Operation Id + /// StaticSites_GetUserProvidedFunctionAppForStaticSiteBuild + /// + /// + /// + /// Name of the function app registered with the static site build. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string functionAppName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionAppName, nameof(functionAppName)); + + using var scope = _staticSiteBuildUserProvidedFunctionAppStaticSitesClientDiagnostics.CreateScope("StaticSiteBuildUserProvidedFunctionAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _staticSiteBuildUserProvidedFunctionAppStaticSitesRestClient.GetUserProvidedFunctionAppForStaticSiteBuildAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, functionAppName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteBuildUserProvidedFunctionAppResource(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.Web/staticSites/{name}/builds/{environmentName}/userProvidedFunctionApps/{functionAppName} + /// + /// + /// Operation Id + /// StaticSites_GetUserProvidedFunctionAppForStaticSiteBuild + /// + /// + /// + /// Name of the function app registered with the static site build. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string functionAppName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionAppName, nameof(functionAppName)); + + using var scope = _staticSiteBuildUserProvidedFunctionAppStaticSitesClientDiagnostics.CreateScope("StaticSiteBuildUserProvidedFunctionAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = _staticSiteBuildUserProvidedFunctionAppStaticSitesRestClient.GetUserProvidedFunctionAppForStaticSiteBuild(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, functionAppName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteBuildUserProvidedFunctionAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCollection.cs index a6bf9eab7752..eafa7710e243 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name} + /// + /// + /// Operation Id + /// StaticSites_GetStaticSite + /// + /// + /// + /// Name of the static site. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _staticSiteClientDiagnostics.CreateScope("StaticSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _staticSiteRestClient.GetStaticSiteAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteResource(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.Web/staticSites/{name} + /// + /// + /// Operation Id + /// StaticSites_GetStaticSite + /// + /// + /// + /// Name of the static site. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _staticSiteClientDiagnostics.CreateScope("StaticSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _staticSiteRestClient.GetStaticSite(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCustomDomainOverviewCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCustomDomainOverviewCollection.cs index 33ba0a435883..7f37de2768c4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCustomDomainOverviewCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCustomDomainOverviewCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string domainName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName} + /// + /// + /// Operation Id + /// StaticSites_GetStaticSiteCustomDomain + /// + /// + /// + /// The custom domain name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _staticSiteCustomDomainOverviewStaticSitesClientDiagnostics.CreateScope("StaticSiteCustomDomainOverviewCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _staticSiteCustomDomainOverviewStaticSitesRestClient.GetStaticSiteCustomDomainAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, domainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteCustomDomainOverviewResource(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.Web/staticSites/{name}/customDomains/{domainName} + /// + /// + /// Operation Id + /// StaticSites_GetStaticSiteCustomDomain + /// + /// + /// + /// The custom domain name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _staticSiteCustomDomainOverviewStaticSitesClientDiagnostics.CreateScope("StaticSiteCustomDomainOverviewCollection.GetIfExists"); + scope.Start(); + try + { + var response = _staticSiteCustomDomainOverviewStaticSitesRestClient.GetStaticSiteCustomDomain(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, domainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteCustomDomainOverviewResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSitePrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSitePrivateEndpointConnectionCollection.cs index 7d637cd2cd6f..06334c8c4a9a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSitePrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSitePrivateEndpointConnectionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// StaticSites_GetPrivateEndpointConnection + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _staticSitePrivateEndpointConnectionStaticSitesClientDiagnostics.CreateScope("StaticSitePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _staticSitePrivateEndpointConnectionStaticSitesRestClient.GetPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSitePrivateEndpointConnectionResource(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.Web/staticSites/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// StaticSites_GetPrivateEndpointConnection + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _staticSitePrivateEndpointConnectionStaticSitesClientDiagnostics.CreateScope("StaticSitePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _staticSitePrivateEndpointConnectionStaticSitesRestClient.GetPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSitePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteUserProvidedFunctionAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteUserProvidedFunctionAppCollection.cs index bd80c1d6698d..615f546b24dc 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteUserProvidedFunctionAppCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteUserProvidedFunctionAppCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string functionAppName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/userProvidedFunctionApps/{functionAppName} + /// + /// + /// Operation Id + /// StaticSites_GetUserProvidedFunctionAppForStaticSite + /// + /// + /// + /// Name of the function app registered with the static site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string functionAppName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionAppName, nameof(functionAppName)); + + using var scope = _staticSiteUserProvidedFunctionAppStaticSitesClientDiagnostics.CreateScope("StaticSiteUserProvidedFunctionAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _staticSiteUserProvidedFunctionAppStaticSitesRestClient.GetUserProvidedFunctionAppForStaticSiteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, functionAppName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteUserProvidedFunctionAppResource(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.Web/staticSites/{name}/userProvidedFunctionApps/{functionAppName} + /// + /// + /// Operation Id + /// StaticSites_GetUserProvidedFunctionAppForStaticSite + /// + /// + /// + /// Name of the function app registered with the static site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string functionAppName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(functionAppName, nameof(functionAppName)); + + using var scope = _staticSiteUserProvidedFunctionAppStaticSitesClientDiagnostics.CreateScope("StaticSiteUserProvidedFunctionAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = _staticSiteUserProvidedFunctionAppStaticSitesRestClient.GetUserProvidedFunctionAppForStaticSite(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, functionAppName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StaticSiteUserProvidedFunctionAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/TopLevelDomainCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/TopLevelDomainCollection.cs index a6f0fe7495c9..6c658638afa5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/TopLevelDomainCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/TopLevelDomainCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name} + /// + /// + /// Operation Id + /// TopLevelDomains_Get + /// + /// + /// + /// Name of the top-level domain. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _topLevelDomainClientDiagnostics.CreateScope("TopLevelDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _topLevelDomainRestClient.GetAsync(Id.SubscriptionId, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TopLevelDomainResource(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}/providers/Microsoft.DomainRegistration/topLevelDomains/{name} + /// + /// + /// Operation Id + /// TopLevelDomains_Get + /// + /// + /// + /// Name of the top-level domain. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _topLevelDomainClientDiagnostics.CreateScope("TopLevelDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _topLevelDomainRestClient.Get(Id.SubscriptionId, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TopLevelDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteCollection.cs index d51074798116..79868d7843c5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// + /// + /// Operation Id + /// WebApps_Get + /// + /// + /// + /// Name of the app. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _webSiteWebAppsClientDiagnostics.CreateScope("WebSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteWebAppsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteResource(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.Web/sites/{name} + /// + /// + /// Operation Id + /// WebApps_Get + /// + /// + /// + /// Name of the app. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _webSiteWebAppsClientDiagnostics.CreateScope("WebSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteWebAppsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigConnectionStringCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigConnectionStringCollection.cs index 5db062ae0d1e..909e77bdb64b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigConnectionStringCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigConnectionStringCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string connectionStringKey, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey} + /// + /// + /// Operation Id + /// WebApps_GetSiteConnectionStringKeyVaultReference + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionStringKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionStringKey, nameof(connectionStringKey)); + + using var scope = _webSiteConfigConnectionStringWebAppsClientDiagnostics.CreateScope("WebSiteConfigConnectionStringCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteConfigConnectionStringWebAppsRestClient.GetSiteConnectionStringKeyVaultReferenceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionStringKey, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteConfigConnectionStringResource(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.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey} + /// + /// + /// Operation Id + /// WebApps_GetSiteConnectionStringKeyVaultReference + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionStringKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionStringKey, nameof(connectionStringKey)); + + using var scope = _webSiteConfigConnectionStringWebAppsClientDiagnostics.CreateScope("WebSiteConfigConnectionStringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteConfigConnectionStringWebAppsRestClient.GetSiteConnectionStringKeyVaultReference(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionStringKey, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteConfigConnectionStringResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteContinuousWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteContinuousWebJobCollection.cs index cfec0435ea2f..eb3805b35a0e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteContinuousWebJobCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteContinuousWebJobCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string webJobName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetContinuousWebJob + /// + /// + /// + /// Name of Web Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteContinuousWebJobWebAppsClientDiagnostics.CreateScope("WebSiteContinuousWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteContinuousWebJobWebAppsRestClient.GetContinuousWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteContinuousWebJobResource(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.Web/sites/{name}/continuouswebjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetContinuousWebJob + /// + /// + /// + /// Name of Web Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteContinuousWebJobWebAppsClientDiagnostics.CreateScope("WebSiteContinuousWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteContinuousWebJobWebAppsRestClient.GetContinuousWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteContinuousWebJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteExtensionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteExtensionCollection.cs index d827e92f2d19..3890ad1ba7b6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteExtensionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteExtensionCollection.cs @@ -319,6 +319,80 @@ public virtual Response Exists(string siteExtensionId, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId} + /// + /// + /// Operation Id + /// WebApps_GetSiteExtension + /// + /// + /// + /// Site extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string siteExtensionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteExtensionId, nameof(siteExtensionId)); + + using var scope = _webSiteExtensionWebAppsClientDiagnostics.CreateScope("WebSiteExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteExtensionWebAppsRestClient.GetSiteExtensionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteExtensionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteExtensionResource(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.Web/sites/{name}/siteextensions/{siteExtensionId} + /// + /// + /// Operation Id + /// WebApps_GetSiteExtension + /// + /// + /// + /// Site extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string siteExtensionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteExtensionId, nameof(siteExtensionId)); + + using var scope = _webSiteExtensionWebAppsClientDiagnostics.CreateScope("WebSiteExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteExtensionWebAppsRestClient.GetSiteExtension(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteExtensionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteHybridConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteHybridConnectionCollection.cs index 6fa21b906517..3919f2192a25 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteHybridConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteHybridConnectionCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string entityName, CancellationToken cancel throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// + /// + /// Operation Id + /// WebApps_GetRelayServiceConnection + /// + /// + /// + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string entityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(entityName, nameof(entityName)); + + using var scope = _webSiteHybridConnectionWebAppsClientDiagnostics.CreateScope("WebSiteHybridConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteHybridConnectionWebAppsRestClient.GetRelayServiceConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, entityName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteHybridConnectionResource(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.Web/sites/{name}/hybridconnection/{entityName} + /// + /// + /// Operation Id + /// WebApps_GetRelayServiceConnection + /// + /// + /// + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string entityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(entityName, nameof(entityName)); + + using var scope = _webSiteHybridConnectionWebAppsClientDiagnostics.CreateScope("WebSiteHybridConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteHybridConnectionWebAppsRestClient.GetRelayServiceConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, entityName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteHybridConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePremierAddonCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePremierAddonCollection.cs index 10dc78d1d2e7..f663d8ad62b4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePremierAddonCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePremierAddonCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string premierAddOnName, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// + /// + /// Operation Id + /// WebApps_GetPremierAddOn + /// + /// + /// + /// Add-on name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string premierAddOnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(premierAddOnName, nameof(premierAddOnName)); + + using var scope = _webSitePremierAddonWebAppsClientDiagnostics.CreateScope("WebSitePremierAddonCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSitePremierAddonWebAppsRestClient.GetPremierAddOnAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, premierAddOnName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSitePremierAddonResource(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.Web/sites/{name}/premieraddons/{premierAddOnName} + /// + /// + /// Operation Id + /// WebApps_GetPremierAddOn + /// + /// + /// + /// Add-on name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string premierAddOnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(premierAddOnName, nameof(premierAddOnName)); + + using var scope = _webSitePremierAddonWebAppsClientDiagnostics.CreateScope("WebSitePremierAddonCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSitePremierAddonWebAppsRestClient.GetPremierAddOn(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, premierAddOnName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSitePremierAddonResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotCollection.cs index 4d6686628618..4a3bc4ed8325 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string slot, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// + /// + /// Operation Id + /// WebApps_GetSlot + /// + /// + /// + /// Name of the deployment slot. By default, this API returns the production slot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string slot, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(slot, nameof(slot)); + + using var scope = _webSiteSlotWebAppsClientDiagnostics.CreateScope("WebSiteSlotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotWebAppsRestClient.GetSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, slot, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotResource(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.Web/sites/{name}/slots/{slot} + /// + /// + /// Operation Id + /// WebApps_GetSlot + /// + /// + /// + /// Name of the deployment slot. By default, this API returns the production slot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string slot, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(slot, nameof(slot)); + + using var scope = _webSiteSlotWebAppsClientDiagnostics.CreateScope("WebSiteSlotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotWebAppsRestClient.GetSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, slot, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigAppSettingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigAppSettingCollection.cs index 8fa39e933e02..63901327b3a9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigAppSettingCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigAppSettingCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string appSettingKey, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey} + /// + /// + /// Operation Id + /// WebApps_GetAppSettingKeyVaultReferenceSlot + /// + /// + /// + /// App Setting key name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string appSettingKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appSettingKey, nameof(appSettingKey)); + + using var scope = _webSiteSlotConfigAppSettingWebAppsClientDiagnostics.CreateScope("WebSiteSlotConfigAppSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotConfigAppSettingWebAppsRestClient.GetAppSettingKeyVaultReferenceSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, appSettingKey, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotConfigAppSettingResource(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.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey} + /// + /// + /// Operation Id + /// WebApps_GetAppSettingKeyVaultReferenceSlot + /// + /// + /// + /// App Setting key name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string appSettingKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appSettingKey, nameof(appSettingKey)); + + using var scope = _webSiteSlotConfigAppSettingWebAppsClientDiagnostics.CreateScope("WebSiteSlotConfigAppSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotConfigAppSettingWebAppsRestClient.GetAppSettingKeyVaultReferenceSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, appSettingKey, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotConfigAppSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigConnectionStringCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigConnectionStringCollection.cs index ce4cf7905f2e..107c701fed3a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigConnectionStringCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigConnectionStringCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string connectionStringKey, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey} + /// + /// + /// Operation Id + /// WebApps_GetSiteConnectionStringKeyVaultReferenceSlot + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionStringKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionStringKey, nameof(connectionStringKey)); + + using var scope = _webSiteSlotConfigConnectionStringWebAppsClientDiagnostics.CreateScope("WebSiteSlotConfigConnectionStringCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotConfigConnectionStringWebAppsRestClient.GetSiteConnectionStringKeyVaultReferenceSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionStringKey, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotConfigConnectionStringResource(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.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey} + /// + /// + /// Operation Id + /// WebApps_GetSiteConnectionStringKeyVaultReferenceSlot + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionStringKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionStringKey, nameof(connectionStringKey)); + + using var scope = _webSiteSlotConfigConnectionStringWebAppsClientDiagnostics.CreateScope("WebSiteSlotConfigConnectionStringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotConfigConnectionStringWebAppsRestClient.GetSiteConnectionStringKeyVaultReferenceSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionStringKey, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotConfigConnectionStringResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotContinuousWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotContinuousWebJobCollection.cs index e65e9c15975d..4b5fbeb84f79 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotContinuousWebJobCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotContinuousWebJobCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string webJobName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetContinuousWebJobSlot + /// + /// + /// + /// Name of Web Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteSlotContinuousWebJobWebAppsClientDiagnostics.CreateScope("WebSiteSlotContinuousWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotContinuousWebJobWebAppsRestClient.GetContinuousWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotContinuousWebJobResource(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.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetContinuousWebJobSlot + /// + /// + /// + /// Name of Web Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteSlotContinuousWebJobWebAppsClientDiagnostics.CreateScope("WebSiteSlotContinuousWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotContinuousWebJobWebAppsRestClient.GetContinuousWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotContinuousWebJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotExtensionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotExtensionCollection.cs index 1c73143167ee..a10c17895fe1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotExtensionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotExtensionCollection.cs @@ -319,6 +319,80 @@ public virtual Response Exists(string siteExtensionId, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId} + /// + /// + /// Operation Id + /// WebApps_GetSiteExtensionSlot + /// + /// + /// + /// Site extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string siteExtensionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteExtensionId, nameof(siteExtensionId)); + + using var scope = _webSiteSlotExtensionWebAppsClientDiagnostics.CreateScope("WebSiteSlotExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotExtensionWebAppsRestClient.GetSiteExtensionSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, siteExtensionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotExtensionResource(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.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId} + /// + /// + /// Operation Id + /// WebApps_GetSiteExtensionSlot + /// + /// + /// + /// Site extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string siteExtensionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteExtensionId, nameof(siteExtensionId)); + + using var scope = _webSiteSlotExtensionWebAppsClientDiagnostics.CreateScope("WebSiteSlotExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotExtensionWebAppsRestClient.GetSiteExtensionSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, siteExtensionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotHybridConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotHybridConnectionCollection.cs index d7c66f76cb14..fff5f836add1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotHybridConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotHybridConnectionCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string entityName, CancellationToken cancel throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName} + /// + /// + /// Operation Id + /// WebApps_GetRelayServiceConnectionSlot + /// + /// + /// + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string entityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(entityName, nameof(entityName)); + + using var scope = _webSiteSlotHybridConnectionWebAppsClientDiagnostics.CreateScope("WebSiteSlotHybridConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotHybridConnectionWebAppsRestClient.GetRelayServiceConnectionSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, entityName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotHybridConnectionResource(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.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName} + /// + /// + /// Operation Id + /// WebApps_GetRelayServiceConnectionSlot + /// + /// + /// + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string entityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(entityName, nameof(entityName)); + + using var scope = _webSiteSlotHybridConnectionWebAppsClientDiagnostics.CreateScope("WebSiteSlotHybridConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotHybridConnectionWebAppsRestClient.GetRelayServiceConnectionSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, entityName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotHybridConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPremierAddOnCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPremierAddOnCollection.cs index 0c3da77f5e60..d28bae69d9ec 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPremierAddOnCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPremierAddOnCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string premierAddOnName, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// + /// + /// Operation Id + /// WebApps_GetPremierAddOnSlot + /// + /// + /// + /// Add-on name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string premierAddOnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(premierAddOnName, nameof(premierAddOnName)); + + using var scope = _webSiteSlotPremierAddOnWebAppsClientDiagnostics.CreateScope("WebSiteSlotPremierAddOnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotPremierAddOnWebAppsRestClient.GetPremierAddOnSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOnName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotPremierAddOnResource(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.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// + /// + /// Operation Id + /// WebApps_GetPremierAddOnSlot + /// + /// + /// + /// Add-on name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string premierAddOnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(premierAddOnName, nameof(premierAddOnName)); + + using var scope = _webSiteSlotPremierAddOnWebAppsClientDiagnostics.CreateScope("WebSiteSlotPremierAddOnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotPremierAddOnWebAppsRestClient.GetPremierAddOnSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOnName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotPremierAddOnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPublicCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPublicCertificateCollection.cs index c6a97a2209ee..c320259d81b0 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPublicCertificateCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPublicCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string publicCertificateName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName} + /// + /// + /// Operation Id + /// WebApps_GetPublicCertificateSlot + /// + /// + /// + /// Public certificate name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publicCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCertificateName, nameof(publicCertificateName)); + + using var scope = _webSiteSlotPublicCertificateWebAppsClientDiagnostics.CreateScope("WebSiteSlotPublicCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotPublicCertificateWebAppsRestClient.GetPublicCertificateSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, publicCertificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotPublicCertificateResource(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.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName} + /// + /// + /// Operation Id + /// WebApps_GetPublicCertificateSlot + /// + /// + /// + /// Public certificate name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publicCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCertificateName, nameof(publicCertificateName)); + + using var scope = _webSiteSlotPublicCertificateWebAppsClientDiagnostics.CreateScope("WebSiteSlotPublicCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotPublicCertificateWebAppsRestClient.GetPublicCertificateSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, publicCertificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotPublicCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobCollection.cs index 630ae74fc6be..ffe86cd6b01b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string webJobName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetTriggeredWebJobSlot + /// + /// + /// + /// Name of Web Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteSlotTriggeredWebJobWebAppsClientDiagnostics.CreateScope("WebSiteSlotTriggeredWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotTriggeredWebJobWebAppsRestClient.GetTriggeredWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotTriggeredWebJobResource(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.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetTriggeredWebJobSlot + /// + /// + /// + /// Name of Web Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteSlotTriggeredWebJobWebAppsClientDiagnostics.CreateScope("WebSiteSlotTriggeredWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotTriggeredWebJobWebAppsRestClient.GetTriggeredWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotTriggeredWebJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobHistoryCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobHistoryCollection.cs index 15403ff87d97..4cc6c81fe273 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobHistoryCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobHistoryCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string id, CancellationToken cancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id} + /// + /// + /// Operation Id + /// WebApps_GetTriggeredWebJobHistorySlot + /// + /// + /// + /// History ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _webSiteSlotTriggeredWebJobHistoryWebAppsClientDiagnostics.CreateScope("WebSiteSlotTriggeredWebJobHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotTriggeredWebJobHistoryWebAppsRestClient.GetTriggeredWebJobHistorySlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotTriggeredWebJobHistoryResource(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.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id} + /// + /// + /// Operation Id + /// WebApps_GetTriggeredWebJobHistorySlot + /// + /// + /// + /// History ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _webSiteSlotTriggeredWebJobHistoryWebAppsClientDiagnostics.CreateScope("WebSiteSlotTriggeredWebJobHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotTriggeredWebJobHistoryWebAppsRestClient.GetTriggeredWebJobHistorySlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotTriggeredWebJobHistoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotWebJobCollection.cs index 6f0eea4e371e..220c9878a279 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotWebJobCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotWebJobCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string webJobName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetWebJobSlot + /// + /// + /// + /// Name of the web job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteSlotWebJobWebAppsClientDiagnostics.CreateScope("WebSiteSlotWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteSlotWebJobWebAppsRestClient.GetWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotWebJobResource(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.Web/sites/{name}/slots/{slot}/webjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetWebJobSlot + /// + /// + /// + /// Name of the web job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteSlotWebJobWebAppsClientDiagnostics.CreateScope("WebSiteSlotWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteSlotWebJobWebAppsRestClient.GetWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteSlotWebJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredWebJobHistoryCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredWebJobHistoryCollection.cs index b6a26157bef6..f5fd0008174d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredWebJobHistoryCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredWebJobHistoryCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string id, CancellationToken cancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id} + /// + /// + /// Operation Id + /// WebApps_GetTriggeredWebJobHistory + /// + /// + /// + /// History ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _webSiteTriggeredWebJobHistoryWebAppsClientDiagnostics.CreateScope("WebSiteTriggeredWebJobHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteTriggeredWebJobHistoryWebAppsRestClient.GetTriggeredWebJobHistoryAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteTriggeredWebJobHistoryResource(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.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id} + /// + /// + /// Operation Id + /// WebApps_GetTriggeredWebJobHistory + /// + /// + /// + /// History ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _webSiteTriggeredWebJobHistoryWebAppsClientDiagnostics.CreateScope("WebSiteTriggeredWebJobHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteTriggeredWebJobHistoryWebAppsRestClient.GetTriggeredWebJobHistory(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteTriggeredWebJobHistoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobCollection.cs index a77f5fe51be0..65036c8de90b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string webJobName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetTriggeredWebJob + /// + /// + /// + /// Name of Web Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteTriggeredwebJobWebAppsClientDiagnostics.CreateScope("WebSiteTriggeredwebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteTriggeredwebJobWebAppsRestClient.GetTriggeredWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteTriggeredwebJobResource(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.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetTriggeredWebJob + /// + /// + /// + /// Name of Web Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteTriggeredwebJobWebAppsClientDiagnostics.CreateScope("WebSiteTriggeredwebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteTriggeredwebJobWebAppsRestClient.GetTriggeredWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteTriggeredwebJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteWebJobCollection.cs index 53e096078588..ad4d994a6486 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteWebJobCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteWebJobCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string webJobName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetWebJob + /// + /// + /// + /// Name of the web job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteWebJobWebAppsClientDiagnostics.CreateScope("WebSiteWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webSiteWebJobWebAppsRestClient.GetWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteWebJobResource(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.Web/sites/{name}/webjobs/{webJobName} + /// + /// + /// Operation Id + /// WebApps_GetWebJob + /// + /// + /// + /// Name of the web job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webJobName, nameof(webJobName)); + + using var scope = _webSiteWebJobWebAppsClientDiagnostics.CreateScope("WebSiteWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webSiteWebJobWebAppsRestClient.GetWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebSiteWebJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/samples/Generated/Samples/Sample_HealthMonitorCollection.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/samples/Generated/Samples/Sample_HealthMonitorCollection.cs index f3e10b0e9bd5..2bd892f927f7 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/samples/Generated/Samples/Sample_HealthMonitorCollection.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/samples/Generated/Samples/Sample_HealthMonitorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -206,6 +207,51 @@ public async Task Exists_GetMonitorWithDefaultValues() Console.WriteLine($"Succeeded: {result}"); } + // Get monitor with default values + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMonitorWithDefaultValues() + { + // Generated from example definition: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/Monitor_GetDefault.json + // this example is just showing the usage of "HealthMonitors_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 = "bc27da3b-3ba2-4e00-a6ec-1fde64aa1e21"; + string resourceGroupName = "tugamidiAlerts"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HealthMonitorResource + string providerName = "Microsoft.Compute"; + string resourceCollectionName = "virtualMachines"; + string resourceName = "linuxEUS"; + HealthMonitorCollection collection = resourceGroupResource.GetHealthMonitors(providerName, resourceCollectionName, resourceName); + + // invoke the operation + string monitorId = "logical-disks|C@3A|free-space"; + NullableResponse response = await collection.GetIfExistsAsync(monitorId); + HealthMonitorResource 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 + HealthMonitorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get monitor with expanded values [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -277,5 +323,51 @@ public async Task Exists_GetMonitorWithExpandedValues() Console.WriteLine($"Succeeded: {result}"); } + + // Get monitor with expanded values + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMonitorWithExpandedValues() + { + // Generated from example definition: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/Monitor_GetExpanded.json + // this example is just showing the usage of "HealthMonitors_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 = "bc27da3b-3ba2-4e00-a6ec-1fde64aa1e21"; + string resourceGroupName = "tugamidiAlerts"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HealthMonitorResource + string providerName = "Microsoft.Compute"; + string resourceCollectionName = "virtualMachines"; + string resourceName = "linuxEUS"; + HealthMonitorCollection collection = resourceGroupResource.GetHealthMonitors(providerName, resourceCollectionName, resourceName); + + // invoke the operation + string monitorId = "logical-disks|C@3A|free-space"; + string expand = "evidence"; + NullableResponse response = await collection.GetIfExistsAsync(monitorId, expand: expand); + HealthMonitorResource 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 + HealthMonitorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/samples/Generated/Samples/Sample_HealthMonitorStateChangeCollection.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/samples/Generated/Samples/Sample_HealthMonitorStateChangeCollection.cs index 02d8e1eb6b17..521114de7bba 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/samples/Generated/Samples/Sample_HealthMonitorStateChangeCollection.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/samples/Generated/Samples/Sample_HealthMonitorStateChangeCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -216,6 +217,52 @@ public async Task Exists_GetMonitorStateChangeWithDefaultValues() Console.WriteLine($"Succeeded: {result}"); } + // Get monitor state change with default values + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMonitorStateChangeWithDefaultValues() + { + // Generated from example definition: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/MonitorStateChange_GetDefault.json + // this example is just showing the usage of "HealthMonitors_GetStateChange" 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 HealthMonitorResource created on azure + // for more information of creating HealthMonitorResource, please refer to the document of HealthMonitorResource + string subscriptionId = "bc27da3b-3ba2-4e00-a6ec-1fde64aa1e21"; + string resourceGroupName = "tugamidiAlerts"; + string providerName = "Microsoft.Compute"; + string resourceCollectionName = "virtualMachines"; + string resourceName = "linuxEUS"; + string monitorId = "logical-disks|C@3A"; + ResourceIdentifier healthMonitorResourceId = HealthMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, providerName, resourceCollectionName, resourceName, monitorId); + HealthMonitorResource healthMonitor = client.GetHealthMonitorResource(healthMonitorResourceId); + + // get the collection of this HealthMonitorStateChangeResource + HealthMonitorStateChangeCollection collection = healthMonitor.GetHealthMonitorStateChanges(); + + // invoke the operation + string timestampUnix = "1584316800"; + NullableResponse response = await collection.GetIfExistsAsync(timestampUnix); + HealthMonitorStateChangeResource 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 + HealthMonitorStateChangeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get monitor state change with expanded values [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -289,5 +336,52 @@ public async Task Exists_GetMonitorStateChangeWithExpandedValues() Console.WriteLine($"Succeeded: {result}"); } + + // Get monitor state change with expanded values + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMonitorStateChangeWithExpandedValues() + { + // Generated from example definition: specification/workloadmonitor/resource-manager/Microsoft.WorkloadMonitor/preview/2020-01-13-preview/examples/MonitorStateChange_GetExpanded.json + // this example is just showing the usage of "HealthMonitors_GetStateChange" 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 HealthMonitorResource created on azure + // for more information of creating HealthMonitorResource, please refer to the document of HealthMonitorResource + string subscriptionId = "bc27da3b-3ba2-4e00-a6ec-1fde64aa1e21"; + string resourceGroupName = "tugamidiAlerts"; + string providerName = "Microsoft.Compute"; + string resourceCollectionName = "virtualMachines"; + string resourceName = "linuxEUS"; + string monitorId = "logical-disks|C@3A"; + ResourceIdentifier healthMonitorResourceId = HealthMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, providerName, resourceCollectionName, resourceName, monitorId); + HealthMonitorResource healthMonitor = client.GetHealthMonitorResource(healthMonitorResourceId); + + // get the collection of this HealthMonitorStateChangeResource + HealthMonitorStateChangeCollection collection = healthMonitor.GetHealthMonitorStateChanges(); + + // invoke the operation + string timestampUnix = "1584316800"; + string expand = "evidence"; + NullableResponse response = await collection.GetIfExistsAsync(timestampUnix, expand: expand); + HealthMonitorStateChangeResource 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 + HealthMonitorStateChangeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorCollection.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorCollection.cs index f8fa9f91598c..abdfd57c43a6 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorCollection.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorCollection.cs @@ -261,6 +261,82 @@ public virtual Response Exists(string monitorId, string expand = null, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId} + /// + /// + /// Operation Id + /// HealthMonitors_Get + /// + /// + /// + /// The monitor Id of the virtual machine. + /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string monitorId, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorId, nameof(monitorId)); + + using var scope = _healthMonitorClientDiagnostics.CreateScope("HealthMonitorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthMonitorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceCollectionName, _resourceName, monitorId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthMonitorResource(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/{providerName}/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId} + /// + /// + /// Operation Id + /// HealthMonitors_Get + /// + /// + /// + /// The monitor Id of the virtual machine. + /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string monitorId, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorId, nameof(monitorId)); + + using var scope = _healthMonitorClientDiagnostics.CreateScope("HealthMonitorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthMonitorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceCollectionName, _resourceName, monitorId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthMonitorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorStateChangeCollection.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorStateChangeCollection.cs index 8281b793d9a1..b833f2cc5a33 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorStateChangeCollection.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorStateChangeCollection.cs @@ -254,6 +254,82 @@ public virtual Response Exists(string timestampUnix, string expand = null, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}/history/{timestampUnix} + /// + /// + /// Operation Id + /// HealthMonitors_GetStateChange + /// + /// + /// + /// The timestamp of the state change (unix format). + /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string timestampUnix, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(timestampUnix, nameof(timestampUnix)); + + using var scope = _healthMonitorStateChangeHealthMonitorsClientDiagnostics.CreateScope("HealthMonitorStateChangeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthMonitorStateChangeHealthMonitorsRestClient.GetStateChangeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, timestampUnix, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthMonitorStateChangeResource(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/{providerName}/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}/history/{timestampUnix} + /// + /// + /// Operation Id + /// HealthMonitors_GetStateChange + /// + /// + /// + /// The timestamp of the state change (unix format). + /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string timestampUnix, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(timestampUnix, nameof(timestampUnix)); + + using var scope = _healthMonitorStateChangeHealthMonitorsClientDiagnostics.CreateScope("HealthMonitorStateChangeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthMonitorStateChangeHealthMonitorsRestClient.GetStateChange(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, timestampUnix, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthMonitorStateChangeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapApplicationServerInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapApplicationServerInstanceCollection.cs index 14ed6202b968..af0d5eb572c5 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapApplicationServerInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapApplicationServerInstanceCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_SAPApplicationServerInstancesGet() Console.WriteLine($"Succeeded: {result}"); } + // SAPApplicationServerInstances_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SAPApplicationServerInstancesGet() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_Get.json + // this example is just showing the usage of "SAPApplicationServerInstances_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 SapVirtualInstanceResource created on azure + // for more information of creating SapVirtualInstanceResource, please refer to the document of SapVirtualInstanceResource + string subscriptionId = "6d875e77-e412-4d7d-9af4-8895278b4443"; + string resourceGroupName = "test-rg"; + string sapVirtualInstanceName = "X00"; + ResourceIdentifier sapVirtualInstanceResourceId = SapVirtualInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, sapVirtualInstanceName); + SapVirtualInstanceResource sapVirtualInstance = client.GetSapVirtualInstanceResource(sapVirtualInstanceResourceId); + + // get the collection of this SapApplicationServerInstanceResource + SapApplicationServerInstanceCollection collection = sapVirtualInstance.GetSapApplicationServerInstances(); + + // invoke the operation + string applicationInstanceName = "app01"; + NullableResponse response = await collection.GetIfExistsAsync(applicationInstanceName); + SapApplicationServerInstanceResource 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 + SapApplicationServerInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create SAP Application Server Instances for HA System with Availability Set [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapCentralServerInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapCentralServerInstanceCollection.cs index 3989c11db855..f231049a5dfc 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapCentralServerInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapCentralServerInstanceCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_SAPCentralInstancesGet() Console.WriteLine($"Succeeded: {result}"); } + // SAPCentralInstances_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SAPCentralInstancesGet() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_Get.json + // this example is just showing the usage of "SAPCentralInstances_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 SapVirtualInstanceResource created on azure + // for more information of creating SapVirtualInstanceResource, please refer to the document of SapVirtualInstanceResource + string subscriptionId = "6d875e77-e412-4d7d-9af4-8895278b4443"; + string resourceGroupName = "test-rg"; + string sapVirtualInstanceName = "X00"; + ResourceIdentifier sapVirtualInstanceResourceId = SapVirtualInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, sapVirtualInstanceName); + SapVirtualInstanceResource sapVirtualInstance = client.GetSapVirtualInstanceResource(sapVirtualInstanceResourceId); + + // get the collection of this SapCentralServerInstanceResource + SapCentralServerInstanceCollection collection = sapVirtualInstance.GetSapCentralServerInstances(); + + // invoke the operation + string centralInstanceName = "centralServer"; + NullableResponse response = await collection.GetIfExistsAsync(centralInstanceName); + SapCentralServerInstanceResource 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 + SapCentralServerInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create SAP Central Instances for HA System with Availability Set [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapDatabaseInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapDatabaseInstanceCollection.cs index 17b2da2d1f70..d4dedb8e726b 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapDatabaseInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapDatabaseInstanceCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_SAPDatabaseInstancesGet() Console.WriteLine($"Succeeded: {result}"); } + // SAPDatabaseInstances_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SAPDatabaseInstancesGet() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_Get.json + // this example is just showing the usage of "SAPDatabaseInstances_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 SapVirtualInstanceResource created on azure + // for more information of creating SapVirtualInstanceResource, please refer to the document of SapVirtualInstanceResource + string subscriptionId = "6d875e77-e412-4d7d-9af4-8895278b4443"; + string resourceGroupName = "test-rg"; + string sapVirtualInstanceName = "X00"; + ResourceIdentifier sapVirtualInstanceResourceId = SapVirtualInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, sapVirtualInstanceName); + SapVirtualInstanceResource sapVirtualInstance = client.GetSapVirtualInstanceResource(sapVirtualInstanceResourceId); + + // get the collection of this SapDatabaseInstanceResource + SapDatabaseInstanceCollection collection = sapVirtualInstance.GetSapDatabaseInstances(); + + // invoke the operation + string databaseInstanceName = "databaseServer"; + NullableResponse response = await collection.GetIfExistsAsync(databaseInstanceName); + SapDatabaseInstanceResource 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 + SapDatabaseInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create SAP Database Instances for HA System with Availability Set [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapMonitorCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapMonitorCollection.cs index b389094a76d5..e2da1ee86b3c 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapMonitorCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapMonitorCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetPropertiesOfASAPMonitor() Console.WriteLine($"Succeeded: {result}"); } + // Get properties of a SAP monitor + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPropertiesOfASAPMonitor() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/monitors_Get.json + // this example is just showing the usage of "monitors_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SapMonitorResource + SapMonitorCollection collection = resourceGroupResource.GetSapMonitors(); + + // invoke the operation + string monitorName = "mySapMonitor"; + NullableResponse response = await collection.GetIfExistsAsync(monitorName); + SapMonitorResource 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 + SapMonitorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a SAP monitor [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapProviderInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapProviderInstanceCollection.cs index 0b77354d309d..1cd44a1552fe 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapProviderInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapProviderInstanceCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetPropertiesOfADb2Provider() Console.WriteLine($"Succeeded: {result}"); } + // Get properties of a Db2 provider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPropertiesOfADb2Provider() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/Db2ProviderInstances_Get.json + // this example is just showing the usage of "ProviderInstances_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 SapMonitorResource created on azure + // for more information of creating SapMonitorResource, please refer to the document of SapMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "mySapMonitor"; + ResourceIdentifier sapMonitorResourceId = SapMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + SapMonitorResource sapMonitor = client.GetSapMonitorResource(sapMonitorResourceId); + + // get the collection of this SapProviderInstanceResource + SapProviderInstanceCollection collection = sapMonitor.GetSapProviderInstances(); + + // invoke the operation + string providerInstanceName = "myProviderInstance"; + NullableResponse response = await collection.GetIfExistsAsync(providerInstanceName); + SapProviderInstanceResource 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 + SapProviderInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get properties of a MsSqlServer provider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_GetPropertiesOfAMsSqlServerProvider() Console.WriteLine($"Succeeded: {result}"); } + // Get properties of a MsSqlServer provider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPropertiesOfAMsSqlServerProvider() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/MsSqlServerProviderInstance_Get.json + // this example is just showing the usage of "ProviderInstances_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 SapMonitorResource created on azure + // for more information of creating SapMonitorResource, please refer to the document of SapMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "mySapMonitor"; + ResourceIdentifier sapMonitorResourceId = SapMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + SapMonitorResource sapMonitor = client.GetSapMonitorResource(sapMonitorResourceId); + + // get the collection of this SapProviderInstanceResource + SapProviderInstanceCollection collection = sapMonitor.GetSapProviderInstances(); + + // invoke the operation + string providerInstanceName = "myProviderInstance"; + NullableResponse response = await collection.GetIfExistsAsync(providerInstanceName); + SapProviderInstanceResource 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 + SapProviderInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get properties of a OS provider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -253,6 +339,49 @@ public async Task Exists_GetPropertiesOfAOSProvider() Console.WriteLine($"Succeeded: {result}"); } + // Get properties of a OS provider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPropertiesOfAOSProvider() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/PrometheusOSProviderInstances_Get.json + // this example is just showing the usage of "ProviderInstances_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 SapMonitorResource created on azure + // for more information of creating SapMonitorResource, please refer to the document of SapMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "mySapMonitor"; + ResourceIdentifier sapMonitorResourceId = SapMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + SapMonitorResource sapMonitor = client.GetSapMonitorResource(sapMonitorResourceId); + + // get the collection of this SapProviderInstanceResource + SapProviderInstanceCollection collection = sapMonitor.GetSapProviderInstances(); + + // invoke the operation + string providerInstanceName = "myProviderInstance"; + NullableResponse response = await collection.GetIfExistsAsync(providerInstanceName); + SapProviderInstanceResource 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 + SapProviderInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get properties of a PrometheusHaCluster provider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -319,6 +448,49 @@ public async Task Exists_GetPropertiesOfAPrometheusHaClusterProvider() Console.WriteLine($"Succeeded: {result}"); } + // Get properties of a PrometheusHaCluster provider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPropertiesOfAPrometheusHaClusterProvider() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Get.json + // this example is just showing the usage of "ProviderInstances_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 SapMonitorResource created on azure + // for more information of creating SapMonitorResource, please refer to the document of SapMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "mySapMonitor"; + ResourceIdentifier sapMonitorResourceId = SapMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + SapMonitorResource sapMonitor = client.GetSapMonitorResource(sapMonitorResourceId); + + // get the collection of this SapProviderInstanceResource + SapProviderInstanceCollection collection = sapMonitor.GetSapProviderInstances(); + + // invoke the operation + string providerInstanceName = "myProviderInstance"; + NullableResponse response = await collection.GetIfExistsAsync(providerInstanceName); + SapProviderInstanceResource 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 + SapProviderInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get properties of a SAP monitor Hana provider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -385,6 +557,49 @@ public async Task Exists_GetPropertiesOfASAPMonitorHanaProvider() Console.WriteLine($"Succeeded: {result}"); } + // Get properties of a SAP monitor Hana provider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPropertiesOfASAPMonitorHanaProvider() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/ProviderInstances_Get.json + // this example is just showing the usage of "ProviderInstances_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 SapMonitorResource created on azure + // for more information of creating SapMonitorResource, please refer to the document of SapMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "mySapMonitor"; + ResourceIdentifier sapMonitorResourceId = SapMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + SapMonitorResource sapMonitor = client.GetSapMonitorResource(sapMonitorResourceId); + + // get the collection of this SapProviderInstanceResource + SapProviderInstanceCollection collection = sapMonitor.GetSapProviderInstances(); + + // invoke the operation + string providerInstanceName = "myProviderInstance"; + NullableResponse response = await collection.GetIfExistsAsync(providerInstanceName); + SapProviderInstanceResource 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 + SapProviderInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get properties of a SAP monitor NetWeaver provider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -451,6 +666,49 @@ public async Task Exists_GetPropertiesOfASAPMonitorNetWeaverProvider() Console.WriteLine($"Succeeded: {result}"); } + // Get properties of a SAP monitor NetWeaver provider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPropertiesOfASAPMonitorNetWeaverProvider() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/NetWeaverProviderInstances_Get.json + // this example is just showing the usage of "ProviderInstances_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 SapMonitorResource created on azure + // for more information of creating SapMonitorResource, please refer to the document of SapMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "mySapMonitor"; + ResourceIdentifier sapMonitorResourceId = SapMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + SapMonitorResource sapMonitor = client.GetSapMonitorResource(sapMonitorResourceId); + + // get the collection of this SapProviderInstanceResource + SapProviderInstanceCollection collection = sapMonitor.GetSapProviderInstances(); + + // invoke the operation + string providerInstanceName = "myProviderInstance"; + NullableResponse response = await collection.GetIfExistsAsync(providerInstanceName); + SapProviderInstanceResource 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 + SapProviderInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a Db2 provider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapVirtualInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapVirtualInstanceCollection.cs index f5dc5f4fa9ae..e0f0146006be 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapVirtualInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/samples/Generated/Samples/Sample_SapVirtualInstanceCollection.cs @@ -3328,6 +3328,48 @@ public async Task Exists_SAPVirtualInstancesGet() Console.WriteLine($"Succeeded: {result}"); } + // SAPVirtualInstances_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SAPVirtualInstancesGet() + { + // Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Get.json + // this example is just showing the usage of "SAPVirtualInstances_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 = "8e17e36c-42e9-4cd5-a078-7b44883414e0"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SapVirtualInstanceResource + SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances(); + + // invoke the operation + string sapVirtualInstanceName = "X00"; + NullableResponse response = await collection.GetIfExistsAsync(sapVirtualInstanceName); + SapVirtualInstanceResource 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 + SapVirtualInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SAPVirtualInstances_ListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapApplicationServerInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapApplicationServerInstanceCollection.cs index 0a262c143ab9..b7b3a51ea9a2 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapApplicationServerInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapApplicationServerInstanceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string applicationInstanceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName} + /// + /// + /// Operation Id + /// SAPApplicationServerInstances_Get + /// + /// + /// + /// The name of SAP Application Server instance 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 applicationInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationInstanceName, nameof(applicationInstanceName)); + + using var scope = _sapApplicationServerInstanceSapApplicationServerInstancesClientDiagnostics.CreateScope("SapApplicationServerInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sapApplicationServerInstanceSapApplicationServerInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapApplicationServerInstanceResource(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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName} + /// + /// + /// Operation Id + /// SAPApplicationServerInstances_Get + /// + /// + /// + /// The name of SAP Application Server instance resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationInstanceName, nameof(applicationInstanceName)); + + using var scope = _sapApplicationServerInstanceSapApplicationServerInstancesClientDiagnostics.CreateScope("SapApplicationServerInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sapApplicationServerInstanceSapApplicationServerInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapApplicationServerInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapCentralServerInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapCentralServerInstanceCollection.cs index 12255adf8e3a..cc524fde3181 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapCentralServerInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapCentralServerInstanceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string centralInstanceName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName} + /// + /// + /// Operation Id + /// SAPCentralInstances_Get + /// + /// + /// + /// Central Services Instance resource name string modeled as parameter for auto generation to work correctly. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string centralInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(centralInstanceName, nameof(centralInstanceName)); + + using var scope = _sapCentralServerInstanceSapCentralInstancesClientDiagnostics.CreateScope("SapCentralServerInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sapCentralServerInstanceSapCentralInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, centralInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapCentralServerInstanceResource(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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName} + /// + /// + /// Operation Id + /// SAPCentralInstances_Get + /// + /// + /// + /// Central Services Instance resource name string modeled as parameter for auto generation to work correctly. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string centralInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(centralInstanceName, nameof(centralInstanceName)); + + using var scope = _sapCentralServerInstanceSapCentralInstancesClientDiagnostics.CreateScope("SapCentralServerInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sapCentralServerInstanceSapCentralInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, centralInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapCentralServerInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapDatabaseInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapDatabaseInstanceCollection.cs index ce3f501f5919..687e59f5639c 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapDatabaseInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapDatabaseInstanceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string databaseInstanceName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName} + /// + /// + /// Operation Id + /// SAPDatabaseInstances_Get + /// + /// + /// + /// Database resource name string modeled as parameter for auto generation to work correctly. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseInstanceName, nameof(databaseInstanceName)); + + using var scope = _sapDatabaseInstanceSapDatabaseInstancesClientDiagnostics.CreateScope("SapDatabaseInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sapDatabaseInstanceSapDatabaseInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapDatabaseInstanceResource(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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName} + /// + /// + /// Operation Id + /// SAPDatabaseInstances_Get + /// + /// + /// + /// Database resource name string modeled as parameter for auto generation to work correctly. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseInstanceName, nameof(databaseInstanceName)); + + using var scope = _sapDatabaseInstanceSapDatabaseInstancesClientDiagnostics.CreateScope("SapDatabaseInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sapDatabaseInstanceSapDatabaseInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapDatabaseInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorCollection.cs index 0f3893327a7c..cb01c48e6773 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string monitorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName} + /// + /// + /// Operation Id + /// monitors_Get + /// + /// + /// + /// Name of the SAP monitor 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 monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _sapMonitormonitorsClientDiagnostics.CreateScope("SapMonitorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sapMonitormonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapMonitorResource(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.Workloads/monitors/{monitorName} + /// + /// + /// Operation Id + /// monitors_Get + /// + /// + /// + /// Name of the SAP monitor resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _sapMonitormonitorsClientDiagnostics.CreateScope("SapMonitorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sapMonitormonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapMonitorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapProviderInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapProviderInstanceCollection.cs index a1fde0e9a3e7..a7c0fb674494 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapProviderInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapProviderInstanceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string providerInstanceName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName} + /// + /// + /// Operation Id + /// ProviderInstances_Get + /// + /// + /// + /// Name of the provider 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 providerInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerInstanceName, nameof(providerInstanceName)); + + using var scope = _sapProviderInstanceProviderInstancesClientDiagnostics.CreateScope("SapProviderInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sapProviderInstanceProviderInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, providerInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapProviderInstanceResource(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.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName} + /// + /// + /// Operation Id + /// ProviderInstances_Get + /// + /// + /// + /// Name of the provider instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string providerInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerInstanceName, nameof(providerInstanceName)); + + using var scope = _sapProviderInstanceProviderInstancesClientDiagnostics.CreateScope("SapProviderInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sapProviderInstanceProviderInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, providerInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapProviderInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceCollection.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceCollection.cs index 0216803095ac..b2ebd8268a1d 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceCollection.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string sapVirtualInstanceName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName} + /// + /// + /// Operation Id + /// SAPVirtualInstances_Get + /// + /// + /// + /// The name of the Virtual Instances for SAP solutions 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 sapVirtualInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sapVirtualInstanceName, nameof(sapVirtualInstanceName)); + + using var scope = _sapVirtualInstanceSapVirtualInstancesClientDiagnostics.CreateScope("SapVirtualInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sapVirtualInstanceSapVirtualInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, sapVirtualInstanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapVirtualInstanceResource(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.Workloads/sapVirtualInstances/{sapVirtualInstanceName} + /// + /// + /// Operation Id + /// SAPVirtualInstances_Get + /// + /// + /// + /// The name of the Virtual Instances for SAP solutions resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sapVirtualInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sapVirtualInstanceName, nameof(sapVirtualInstanceName)); + + using var scope = _sapVirtualInstanceSapVirtualInstancesClientDiagnostics.CreateScope("SapVirtualInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sapVirtualInstanceSapVirtualInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, sapVirtualInstanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SapVirtualInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); From a660319791820246c09fdba2408c5da9e952f207 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 21 Sep 2023 08:46:45 +0000 Subject: [PATCH 6/8] Update SDK codes --- ...Sample_RemoteRenderingAccountCollection.cs | 42 +++ .../Sample_SpatialAnchorsAccountCollection.cs | 42 +++ .../RemoteRenderingAccountCollection.cs | 74 +++++ .../SpatialAnchorsAccountCollection.cs | 74 +++++ .../MobileAttachedDataNetworkCollection.cs | 74 +++++ .../Generated/MobileDataNetworkCollection.cs | 74 +++++ .../src/Generated/MobileNetworkCollection.cs | 74 +++++ ...bileNetworkDiagnosticsPackageCollection.cs | 74 +++++ .../MobileNetworkPacketCaptureCollection.cs | 74 +++++ .../MobileNetworkServiceCollection.cs | 74 +++++ .../Generated/MobileNetworkSimCollection.cs | 74 +++++ .../MobileNetworkSimGroupCollection.cs | 74 +++++ .../MobileNetworkSimPolicyCollection.cs | 74 +++++ .../Generated/MobileNetworkSiteCollection.cs | 74 +++++ .../Generated/MobileNetworkSliceCollection.cs | 74 +++++ .../PacketCoreControlPlaneCollection.cs | 74 +++++ .../PacketCoreDataPlaneCollection.cs | 74 +++++ ...PacketCoreControlPlaneVersionCollection.cs | 74 +++++ ...PacketCoreControlPlaneVersionCollection.cs | 74 +++++ .../Samples/Sample_ActionGroupCollection.cs | 42 +++ .../Sample_ActivityLogAlertCollection.cs | 42 +++ .../Samples/Sample_AlertRuleCollection.cs | 42 +++ .../Sample_AutoscaleSettingCollection.cs | 42 +++ ...Sample_DataCollectionEndpointCollection.cs | 42 +++ ...DataCollectionRuleAssociationCollection.cs | 40 +++ .../Sample_DataCollectionRuleCollection.cs | 42 +++ .../Sample_DiagnosticSettingCollection.cs | 80 +++++ ...le_DiagnosticSettingsCategoryCollection.cs | 41 +++ .../Samples/Sample_LogProfileCollection.cs | 41 +++ .../Samples/Sample_MetricAlertCollection.cs | 294 ++++++++++++++++++ ...itorPrivateEndpointConnectionCollection.cs | 43 +++ ...le_MonitorPrivateLinkResourceCollection.cs | 44 +++ ...ample_MonitorPrivateLinkScopeCollection.cs | 42 +++ ...itorPrivateLinkScopedResourceCollection.cs | 43 +++ ...mple_MonitorWorkspaceResourceCollection.cs | 42 +++ .../Sample_ScheduledQueryRuleCollection.cs | 42 +++ .../src/Generated/ActionGroupCollection.cs | 74 +++++ .../Generated/ActivityLogAlertCollection.cs | 74 +++++ .../src/Generated/AlertRuleCollection.cs | 74 +++++ .../Generated/AutoscaleSettingCollection.cs | 74 +++++ .../DataCollectionEndpointCollection.cs | 74 +++++ ...DataCollectionRuleAssociationCollection.cs | 74 +++++ .../Generated/DataCollectionRuleCollection.cs | 74 +++++ .../Generated/DiagnosticSettingCollection.cs | 74 +++++ .../DiagnosticSettingsCategoryCollection.cs | 74 +++++ .../src/Generated/LogProfileCollection.cs | 74 +++++ .../src/Generated/MetricAlertCollection.cs | 74 +++++ ...itorPrivateEndpointConnectionCollection.cs | 74 +++++ .../MonitorPrivateLinkResourceCollection.cs | 74 +++++ .../MonitorPrivateLinkScopeCollection.cs | 74 +++++ ...itorPrivateLinkScopedResourceCollection.cs | 74 +++++ .../MonitorWorkspaceResourceCollection.cs | 74 +++++ .../Generated/ScheduledQueryRuleCollection.cs | 74 +++++ .../Samples/Sample_MySqlAdvisorCollection.cs | 44 +++ .../Sample_MySqlConfigurationCollection.cs | 43 +++ .../Samples/Sample_MySqlDatabaseCollection.cs | 43 +++ .../Sample_MySqlFirewallRuleCollection.cs | 43 +++ ...lexibleServerAadAdministratorCollection.cs | 43 +++ ...ple_MySqlFlexibleServerBackupCollection.cs | 43 +++ .../Sample_MySqlFlexibleServerCollection.cs | 84 +++++ ...qlFlexibleServerConfigurationCollection.cs | 43 +++ ...e_MySqlFlexibleServerDatabaseCollection.cs | 43 +++ ...SqlFlexibleServerFirewallRuleCollection.cs | 43 +++ ...ySqlPrivateEndpointConnectionCollection.cs | 43 +++ ...mple_MySqlPrivateLinkResourceCollection.cs | 44 +++ .../Sample_MySqlQueryStatisticCollection.cs | 44 +++ .../Sample_MySqlQueryTextCollection.cs | 44 +++ ...ple_MySqlRecommendationActionCollection.cs | 45 +++ .../Samples/Sample_MySqlServerCollection.cs | 42 +++ .../Sample_MySqlServerKeyCollection.cs | 43 +++ ...ySqlServerSecurityAlertPolicyCollection.cs | 43 +++ ...ample_MySqlVirtualNetworkRuleCollection.cs | 43 +++ .../Sample_MySqlWaitStatisticCollection.cs | 44 +++ .../MySql/Generated/MySqlAdvisorCollection.cs | 74 +++++ .../Generated/MySqlConfigurationCollection.cs | 74 +++++ .../Generated/MySqlDatabaseCollection.cs | 74 +++++ .../Generated/MySqlFirewallRuleCollection.cs | 74 +++++ ...ySqlPrivateEndpointConnectionCollection.cs | 74 +++++ .../MySqlPrivateLinkResourceCollection.cs | 74 +++++ .../MySqlQueryStatisticCollection.cs | 74 +++++ .../Generated/MySqlQueryTextCollection.cs | 74 +++++ .../MySqlRecommendationActionCollection.cs | 74 +++++ .../MySql/Generated/MySqlServerCollection.cs | 74 +++++ .../Generated/MySqlServerKeyCollection.cs | 74 +++++ ...ySqlServerSecurityAlertPolicyCollection.cs | 66 ++++ .../MySqlVirtualNetworkRuleCollection.cs | 74 +++++ .../Generated/MySqlWaitStatisticCollection.cs | 74 +++++ ...lexibleServerAadAdministratorCollection.cs | 66 ++++ .../MySqlFlexibleServerBackupCollection.cs | 74 +++++ .../MySqlFlexibleServerCollection.cs | 74 +++++ ...qlFlexibleServerConfigurationCollection.cs | 74 +++++ .../MySqlFlexibleServerDatabaseCollection.cs | 74 +++++ ...SqlFlexibleServerFirewallRuleCollection.cs | 74 +++++ .../Samples/Sample_CapacityPoolCollection.cs | 43 +++ .../Sample_NetAppAccountBackupCollection.cs | 44 +++ .../Samples/Sample_NetAppAccountCollection.cs | 42 +++ .../Sample_NetAppBackupPolicyCollection.cs | 43 +++ .../Sample_NetAppSubvolumeInfoCollection.cs | 45 +++ .../Sample_NetAppVolumeBackupCollection.cs | 45 +++ .../Samples/Sample_NetAppVolumeCollection.cs | 44 +++ .../Sample_NetAppVolumeGroupCollection.cs | 43 +++ .../Sample_NetAppVolumeQuotaRuleCollection.cs | 45 +++ .../Sample_NetAppVolumeSnapshotCollection.cs | 45 +++ .../Sample_SnapshotPolicyCollection.cs | 43 +++ .../src/Generated/CapacityPoolCollection.cs | 74 +++++ .../NetAppAccountBackupCollection.cs | 74 +++++ .../src/Generated/NetAppAccountCollection.cs | 74 +++++ .../Generated/NetAppBackupPolicyCollection.cs | 74 +++++ .../NetAppSubvolumeInfoCollection.cs | 74 +++++ .../Generated/NetAppVolumeBackupCollection.cs | 74 +++++ .../src/Generated/NetAppVolumeCollection.cs | 74 +++++ .../Generated/NetAppVolumeGroupCollection.cs | 74 +++++ .../NetAppVolumeQuotaRuleCollection.cs | 74 +++++ .../NetAppVolumeSnapshotCollection.cs | 74 +++++ .../src/Generated/SnapshotPolicyCollection.cs | 74 +++++ .../Sample_AdminRuleGroupCollection.cs | 44 +++ .../Sample_ApplicationGatewayCollection.cs | 42 +++ ...ewayPrivateEndpointConnectionCollection.cs | 43 +++ ...tionGatewayWafDynamicManifestCollection.cs | 42 +++ ...mple_ApplicationSecurityGroupCollection.cs | 42 +++ .../Samples/Sample_AzureFirewallCollection.cs | 210 +++++++++++++ .../Sample_AzureWebCategoryCollection.cs | 42 +++ .../Sample_BackendAddressPoolCollection.cs | 86 +++++ .../Samples/Sample_BaseAdminRuleCollection.cs | 90 ++++++ .../Samples/Sample_BastionHostCollection.cs | 84 +++++ .../Samples/Sample_BgpConnectionCollection.cs | 43 +++ .../Sample_CloudServiceSwapCollection.cs | 42 +++ .../Sample_ConnectionMonitorCollection.cs | 43 +++ ...ple_ConnectivityConfigurationCollection.cs | 43 +++ .../Sample_CustomIPPrefixCollection.cs | 42 +++ .../Sample_DdosCustomPolicyCollection.cs | 42 +++ .../Sample_DdosProtectionPlanCollection.cs | 42 +++ .../Sample_DefaultSecurityRuleCollection.cs | 44 +++ .../Sample_DscpConfigurationCollection.cs | 42 +++ ...ressRouteCircuitAuthorizationCollection.cs | 43 +++ .../Sample_ExpressRouteCircuitCollection.cs | 42 +++ ...ExpressRouteCircuitConnectionCollection.cs | 44 +++ ...le_ExpressRouteCircuitPeeringCollection.cs | 43 +++ ...Sample_ExpressRouteConnectionCollection.cs | 43 +++ ...e_ExpressRouteCrossConnectionCollection.cs | 42 +++ ...ssRouteCrossConnectionPeeringCollection.cs | 43 +++ .../Sample_ExpressRouteGatewayCollection.cs | 42 +++ .../Sample_ExpressRouteLinkCollection.cs | 44 +++ ...ExpressRoutePortAuthorizationCollection.cs | 43 +++ .../Sample_ExpressRoutePortCollection.cs | 42 +++ ...ple_ExpressRoutePortsLocationCollection.cs | 42 +++ ...mple_ExpressRouteProviderPortCollection.cs | 42 +++ .../Sample_FirewallPolicyCollection.cs | 42 +++ ...wallPolicyRuleCollectionGroupCollection.cs | 172 ++++++++++ .../Samples/Sample_FlowLogCollection.cs | 43 +++ ...ample_FrontendIPConfigurationCollection.cs | 44 +++ .../Sample_HubIPConfigurationCollection.cs | 43 +++ .../Samples/Sample_HubRouteTableCollection.cs | 43 +++ ...e_HubVirtualNetworkConnectionCollection.cs | 43 +++ .../Samples/Sample_IPAllocationCollection.cs | 42 +++ .../Samples/Sample_IPGroupCollection.cs | 42 +++ .../Sample_InboundNatRuleCollection.cs | 43 +++ .../Samples/Sample_LoadBalancerCollection.cs | 84 +++++ .../Sample_LoadBalancingRuleCollection.cs | 44 +++ .../Sample_LocalNetworkGatewayCollection.cs | 42 +++ ...GroupNetworkManagerConnectionCollection.cs | 41 +++ .../Samples/Sample_NatGatewayCollection.cs | 42 +++ .../Samples/Sample_NetworkGroupCollection.cs | 43 +++ ...mple_NetworkGroupStaticMemberCollection.cs | 44 +++ .../Sample_NetworkInterfaceCollection.cs | 42 +++ ...tworkInterfaceIPConfigurationCollection.cs | 44 +++ ...workInterfaceTapConfigurationCollection.cs | 43 +++ .../Sample_NetworkManagerCollection.cs | 42 +++ ...workPrivateEndpointConnectionCollection.cs | 43 +++ .../Sample_NetworkProfileCollection.cs | 84 +++++ .../Sample_NetworkSecurityGroupCollection.cs | 42 +++ ...ample_NetworkVirtualApplianceCollection.cs | 42 +++ ...orkVirtualApplianceConnectionCollection.cs | 43 +++ ...le_NetworkVirtualApplianceSkuCollection.cs | 42 +++ .../Sample_NetworkWatcherCollection.cs | 42 +++ .../Samples/Sample_OutboundRuleCollection.cs | 44 +++ .../Samples/Sample_P2SVpnGatewayCollection.cs | 42 +++ .../Samples/Sample_PacketCaptureCollection.cs | 43 +++ ...ExpressRouteCircuitConnectionCollection.cs | 45 +++ .../Sample_PrivateDnsZoneGroupCollection.cs | 43 +++ .../Sample_PrivateEndpointCollection.cs | 126 ++++++++ .../Sample_PrivateLinkServiceCollection.cs | 42 +++ .../Samples/Sample_ProbeCollection.cs | 44 +++ .../Sample_PublicIPAddressCollection.cs | 42 +++ .../Sample_PublicIPPrefixCollection.cs | 42 +++ .../Samples/Sample_RouteCollection.cs | 43 +++ .../Samples/Sample_RouteFilterCollection.cs | 42 +++ .../Sample_RouteFilterRuleCollection.cs | 43 +++ .../Samples/Sample_RouteMapCollection.cs | 43 +++ .../Samples/Sample_RouteTableCollection.cs | 42 +++ .../Samples/Sample_RoutingIntentCollection.cs | 43 +++ .../Sample_ScopeConnectionCollection.cs | 43 +++ ...le_SecurityAdminConfigurationCollection.cs | 43 +++ ...ample_SecurityPartnerProviderCollection.cs | 42 +++ .../Samples/Sample_SecurityRuleCollection.cs | 43 +++ .../Sample_ServiceEndpointPolicyCollection.cs | 42 +++ ...rviceEndpointPolicyDefinitionCollection.cs | 43 +++ .../Samples/Sample_SubnetCollection.cs | 86 +++++ ...ptionNetworkManagerConnectionCollection.cs | 41 +++ .../Sample_VirtualApplianceSiteCollection.cs | 43 +++ .../Samples/Sample_VirtualHubCollection.cs | 42 +++ ...Sample_VirtualHubRouteTableV2Collection.cs | 43 +++ .../Sample_VirtualNetworkCollection.cs | 126 ++++++++ .../Sample_VirtualNetworkGatewayCollection.cs | 84 +++++ ...rtualNetworkGatewayConnectionCollection.cs | 42 +++ ..._VirtualNetworkGatewayNatRuleCollection.cs | 43 +++ .../Sample_VirtualNetworkPeeringCollection.cs | 86 +++++ .../Sample_VirtualNetworkTapCollection.cs | 42 +++ .../Samples/Sample_VirtualRouterCollection.cs | 42 +++ .../Sample_VirtualRouterPeeringCollection.cs | 43 +++ .../Samples/Sample_VirtualWanCollection.cs | 42 +++ .../Samples/Sample_VpnConnectionCollection.cs | 43 +++ .../Samples/Sample_VpnGatewayCollection.cs | 42 +++ .../Sample_VpnGatewayNatRuleCollection.cs | 43 +++ ...Sample_VpnServerConfigurationCollection.cs | 42 +++ ...erverConfigurationPolicyGroupCollection.cs | 43 +++ .../Samples/Sample_VpnSiteCollection.cs | 42 +++ .../Samples/Sample_VpnSiteLinkCollection.cs | 44 +++ .../Sample_VpnSiteLinkConnectionCollection.cs | 45 +++ ..._WebApplicationFirewallPolicyCollection.cs | 42 +++ .../src/Generated/AdminRuleGroupCollection.cs | 74 +++++ .../Generated/ApplicationGatewayCollection.cs | 74 +++++ ...ewayPrivateEndpointConnectionCollection.cs | 74 +++++ ...tionGatewayWafDynamicManifestCollection.cs | 64 ++++ .../ApplicationSecurityGroupCollection.cs | 74 +++++ .../src/Generated/AzureFirewallCollection.cs | 74 +++++ .../Generated/AzureWebCategoryCollection.cs | 76 +++++ .../Generated/BackendAddressPoolCollection.cs | 74 +++++ .../src/Generated/BaseAdminRuleCollection.cs | 74 +++++ .../src/Generated/BastionHostCollection.cs | 74 +++++ .../src/Generated/BgpConnectionCollection.cs | 74 +++++ .../Generated/CloudServiceSwapCollection.cs | 64 ++++ .../Generated/ConnectionMonitorCollection.cs | 74 +++++ .../ConnectivityConfigurationCollection.cs | 74 +++++ .../src/Generated/CustomIPPrefixCollection.cs | 76 +++++ .../Generated/DdosCustomPolicyCollection.cs | 74 +++++ .../Generated/DdosProtectionPlanCollection.cs | 74 +++++ .../DefaultSecurityRuleCollection.cs | 74 +++++ .../Generated/DscpConfigurationCollection.cs | 74 +++++ ...ressRouteCircuitAuthorizationCollection.cs | 74 +++++ .../ExpressRouteCircuitCollection.cs | 74 +++++ ...ExpressRouteCircuitConnectionCollection.cs | 74 +++++ .../ExpressRouteCircuitPeeringCollection.cs | 74 +++++ .../ExpressRouteConnectionCollection.cs | 74 +++++ .../ExpressRouteCrossConnectionCollection.cs | 74 +++++ ...ssRouteCrossConnectionPeeringCollection.cs | 74 +++++ .../ExpressRouteGatewayCollection.cs | 74 +++++ .../Generated/ExpressRouteLinkCollection.cs | 74 +++++ ...ExpressRoutePortAuthorizationCollection.cs | 74 +++++ .../Generated/ExpressRoutePortCollection.cs | 74 +++++ .../ExpressRoutePortsLocationCollection.cs | 74 +++++ .../ExpressRouteProviderPortCollection.cs | 74 +++++ .../src/Generated/FirewallPolicyCollection.cs | 76 +++++ ...wallPolicyRuleCollectionGroupCollection.cs | 74 +++++ .../src/Generated/FlowLogCollection.cs | 74 +++++ .../FrontendIPConfigurationCollection.cs | 74 +++++ .../Generated/HubIPConfigurationCollection.cs | 74 +++++ .../src/Generated/HubRouteTableCollection.cs | 74 +++++ .../HubVirtualNetworkConnectionCollection.cs | 74 +++++ .../src/Generated/IPAllocationCollection.cs | 76 +++++ .../src/Generated/IPGroupCollection.cs | 76 +++++ .../src/Generated/InboundNatRuleCollection.cs | 76 +++++ .../src/Generated/LoadBalancerCollection.cs | 76 +++++ .../Generated/LoadBalancingRuleCollection.cs | 74 +++++ .../LocalNetworkGatewayCollection.cs | 74 +++++ ...GroupNetworkManagerConnectionCollection.cs | 74 +++++ .../src/Generated/NatGatewayCollection.cs | 76 +++++ .../src/Generated/NetworkGroupCollection.cs | 74 +++++ .../NetworkGroupStaticMemberCollection.cs | 74 +++++ .../Generated/NetworkInterfaceCollection.cs | 76 +++++ ...tworkInterfaceIPConfigurationCollection.cs | 74 +++++ ...workInterfaceTapConfigurationCollection.cs | 74 +++++ .../src/Generated/NetworkManagerCollection.cs | 74 +++++ ...workPrivateEndpointConnectionCollection.cs | 76 +++++ .../src/Generated/NetworkProfileCollection.cs | 76 +++++ .../NetworkSecurityGroupCollection.cs | 76 +++++ .../NetworkVirtualApplianceCollection.cs | 76 +++++ ...orkVirtualApplianceConnectionCollection.cs | 74 +++++ .../NetworkVirtualApplianceSkuCollection.cs | 74 +++++ .../src/Generated/NetworkWatcherCollection.cs | 74 +++++ .../src/Generated/OutboundRuleCollection.cs | 74 +++++ .../src/Generated/P2SVpnGatewayCollection.cs | 74 +++++ .../src/Generated/PacketCaptureCollection.cs | 74 +++++ ...ExpressRouteCircuitConnectionCollection.cs | 74 +++++ .../PrivateDnsZoneGroupCollection.cs | 74 +++++ .../Generated/PrivateEndpointCollection.cs | 76 +++++ .../Generated/PrivateLinkServiceCollection.cs | 76 +++++ .../src/Generated/ProbeCollection.cs | 74 +++++ .../Generated/PublicIPAddressCollection.cs | 76 +++++ .../src/Generated/PublicIPPrefixCollection.cs | 76 +++++ .../src/Generated/RouteCollection.cs | 74 +++++ .../src/Generated/RouteFilterCollection.cs | 76 +++++ .../Generated/RouteFilterRuleCollection.cs | 74 +++++ .../src/Generated/RouteMapCollection.cs | 74 +++++ .../src/Generated/RouteTableCollection.cs | 76 +++++ .../src/Generated/RoutingIntentCollection.cs | 74 +++++ .../Generated/ScopeConnectionCollection.cs | 74 +++++ .../SecurityAdminConfigurationCollection.cs | 74 +++++ .../SecurityPartnerProviderCollection.cs | 74 +++++ .../src/Generated/SecurityRuleCollection.cs | 74 +++++ .../ServiceEndpointPolicyCollection.cs | 76 +++++ ...rviceEndpointPolicyDefinitionCollection.cs | 74 +++++ .../src/Generated/SubnetCollection.cs | 76 +++++ ...ptionNetworkManagerConnectionCollection.cs | 74 +++++ .../VirtualApplianceSiteCollection.cs | 74 +++++ .../src/Generated/VirtualHubCollection.cs | 74 +++++ .../VirtualHubRouteTableV2Collection.cs | 74 +++++ .../src/Generated/VirtualNetworkCollection.cs | 76 +++++ .../VirtualNetworkGatewayCollection.cs | 74 +++++ ...rtualNetworkGatewayConnectionCollection.cs | 74 +++++ .../VirtualNetworkGatewayNatRuleCollection.cs | 74 +++++ .../VirtualNetworkPeeringCollection.cs | 74 +++++ .../Generated/VirtualNetworkTapCollection.cs | 74 +++++ .../src/Generated/VirtualRouterCollection.cs | 76 +++++ .../VirtualRouterPeeringCollection.cs | 74 +++++ .../src/Generated/VirtualWanCollection.cs | 74 +++++ .../src/Generated/VpnConnectionCollection.cs | 74 +++++ .../src/Generated/VpnGatewayCollection.cs | 74 +++++ .../Generated/VpnGatewayNatRuleCollection.cs | 74 +++++ .../VpnServerConfigurationCollection.cs | 74 +++++ ...erverConfigurationPolicyGroupCollection.cs | 74 +++++ .../src/Generated/VpnSiteCollection.cs | 74 +++++ .../src/Generated/VpnSiteLinkCollection.cs | 74 +++++ .../VpnSiteLinkConnectionCollection.cs | 74 +++++ .../WebApplicationFirewallPolicyCollection.cs | 74 +++++ .../Sample_NetworkCloudAgentPoolCollection.cs | 43 +++ ..._NetworkCloudBareMetalMachineCollection.cs | 43 +++ ...rkCloudBareMetalMachineKeySetCollection.cs | 43 +++ .../Sample_NetworkCloudBmcKeySetCollection.cs | 43 +++ ...workCloudCloudServicesNetworkCollection.cs | 42 +++ .../Sample_NetworkCloudClusterCollection.cs | 42 +++ ...le_NetworkCloudClusterManagerCollection.cs | 42 +++ ...udClusterMetricsConfigurationCollection.cs | 43 +++ ...NetworkCloudKubernetesClusterCollection.cs | 42 +++ .../Sample_NetworkCloudL2NetworkCollection.cs | 42 +++ .../Sample_NetworkCloudL3NetworkCollection.cs | 42 +++ .../Sample_NetworkCloudRackCollection.cs | 43 +++ .../Sample_NetworkCloudRackSkuCollection.cs | 42 +++ ..._NetworkCloudStorageApplianceCollection.cs | 43 +++ ...le_NetworkCloudTrunkedNetworkCollection.cs | 42 +++ ...le_NetworkCloudVirtualMachineCollection.cs | 42 +++ ...orkCloudVirtualMachineConsoleCollection.cs | 43 +++ .../Sample_NetworkCloudVolumeCollection.cs | 42 +++ .../NetworkCloudAgentPoolCollection.cs | 74 +++++ .../NetworkCloudBareMetalMachineCollection.cs | 74 +++++ ...rkCloudBareMetalMachineKeySetCollection.cs | 74 +++++ .../NetworkCloudBmcKeySetCollection.cs | 74 +++++ ...workCloudCloudServicesNetworkCollection.cs | 74 +++++ .../NetworkCloudClusterCollection.cs | 74 +++++ .../NetworkCloudClusterManagerCollection.cs | 74 +++++ ...udClusterMetricsConfigurationCollection.cs | 74 +++++ ...NetworkCloudKubernetesClusterCollection.cs | 74 +++++ .../NetworkCloudL2NetworkCollection.cs | 74 +++++ .../NetworkCloudL3NetworkCollection.cs | 74 +++++ .../Generated/NetworkCloudRackCollection.cs | 74 +++++ .../NetworkCloudRackSkuCollection.cs | 74 +++++ .../NetworkCloudStorageApplianceCollection.cs | 74 +++++ .../NetworkCloudTrunkedNetworkCollection.cs | 74 +++++ .../NetworkCloudVirtualMachineCollection.cs | 74 +++++ ...orkCloudVirtualMachineConsoleCollection.cs | 74 +++++ .../Generated/NetworkCloudVolumeCollection.cs | 74 +++++ .../Sample_AzureTrafficCollectorCollection.cs | 42 +++ .../Sample_CollectorPolicyCollection.cs | 43 +++ .../AzureTrafficCollectorCollection.cs | 74 +++++ .../Generated/CollectorPolicyCollection.cs | 74 +++++ ...ample_NewRelicMonitorResourceCollection.cs | 42 +++ ..._NewRelicObservabilityTagRuleCollection.cs | 86 +++++ .../NewRelicMonitorResourceCollection.cs | 74 +++++ .../NewRelicObservabilityTagRuleCollection.cs | 74 +++++ .../Sample_NginxCertificateCollection.cs | 43 +++ .../Sample_NginxConfigurationCollection.cs | 43 +++ .../Sample_NginxDeploymentCollection.cs | 42 +++ .../Generated/NginxCertificateCollection.cs | 74 +++++ .../Generated/NginxConfigurationCollection.cs | 74 +++++ .../Generated/NginxDeploymentCollection.cs | 74 +++++ ...ificationHubAuthorizationRuleCollection.cs | 44 +++ .../Sample_NotificationHubCollection.cs | 43 +++ ...HubNamespaceAuthorizationRuleCollection.cs | 43 +++ ...mple_NotificationHubNamespaceCollection.cs | 42 +++ ...ificationHubAuthorizationRuleCollection.cs | 74 +++++ .../Generated/NotificationHubCollection.cs | 74 +++++ ...HubNamespaceAuthorizationRuleCollection.cs | 74 +++++ .../NotificationHubNamespaceCollection.cs | 74 +++++ .../src/Generated/EnergyServiceCollection.cs | 74 +++++ .../Sample_LogAnalyticsQueryCollection.cs | 43 +++ .../Sample_LogAnalyticsQueryPackCollection.cs | 42 +++ ...le_OperationalInsightsClusterCollection.cs | 42 +++ ...OperationalInsightsDataExportCollection.cs | 43 +++ ...OperationalInsightsDataSourceCollection.cs | 43 +++ ...rationalInsightsLinkedServiceCollection.cs | 43 +++ ...InsightsLinkedStorageAccountsCollection.cs | 43 +++ ...perationalInsightsSavedSearchCollection.cs | 43 +++ ...mple_OperationalInsightsTableCollection.cs | 43 +++ ..._OperationalInsightsWorkspaceCollection.cs | 42 +++ .../Sample_StorageInsightCollection.cs | 43 +++ .../Generated/LogAnalyticsQueryCollection.cs | 74 +++++ .../LogAnalyticsQueryPackCollection.cs | 74 +++++ .../OperationalInsightsClusterCollection.cs | 74 +++++ ...OperationalInsightsDataExportCollection.cs | 74 +++++ ...OperationalInsightsDataSourceCollection.cs | 74 +++++ ...rationalInsightsLinkedServiceCollection.cs | 74 +++++ ...InsightsLinkedStorageAccountsCollection.cs | 66 ++++ ...perationalInsightsSavedSearchCollection.cs | 74 +++++ .../OperationalInsightsTableCollection.cs | 74 +++++ .../OperationalInsightsWorkspaceCollection.cs | 74 +++++ .../src/Generated/StorageInsightCollection.cs | 74 +++++ ...Sample_AvailableGroundStationCollection.cs | 42 +++ .../Sample_OrbitalContactCollection.cs | 43 +++ .../Sample_OrbitalContactProfileCollection.cs | 42 +++ .../Sample_OrbitalSpacecraftCollection.cs | 42 +++ .../AvailableGroundStationCollection.cs | 74 +++++ .../src/Generated/OrbitalContactCollection.cs | 74 +++++ .../OrbitalContactProfileCollection.cs | 74 +++++ .../Generated/OrbitalSpacecraftCollection.cs | 74 +++++ ...balRulestackCertificateObjectCollection.cs | 82 +++++ .../Sample_GlobalRulestackCollection.cs | 78 +++++ .../Sample_GlobalRulestackFqdnCollection.cs | 82 +++++ .../Sample_GlobalRulestackPrefixCollection.cs | 82 +++++ ...calRulestackCertificateObjectCollection.cs | 86 +++++ .../Sample_LocalRulestackCollection.cs | 84 +++++ .../Sample_LocalRulestackFqdnCollection.cs | 86 +++++ .../Sample_LocalRulestackPrefixCollection.cs | 86 +++++ .../Sample_LocalRulestackRuleCollection.cs | 86 +++++ ...mple_PaloAltoNetworksFirewallCollection.cs | 84 +++++ .../Sample_PostRulestackRuleCollection.cs | 82 +++++ .../Sample_PreRulestackRuleCollection.cs | 82 +++++ ...balRulestackCertificateObjectCollection.cs | 74 +++++ .../Generated/GlobalRulestackCollection.cs | 74 +++++ .../GlobalRulestackFqdnCollection.cs | 74 +++++ .../GlobalRulestackPrefixCollection.cs | 74 +++++ ...calRulestackCertificateObjectCollection.cs | 74 +++++ .../src/Generated/LocalRulestackCollection.cs | 74 +++++ .../Generated/LocalRulestackFqdnCollection.cs | 74 +++++ .../LocalRulestackPrefixCollection.cs | 74 +++++ .../Generated/LocalRulestackRuleCollection.cs | 74 +++++ .../PaloAltoNetworksFirewallCollection.cs | 74 +++++ .../Generated/PostRulestackRuleCollection.cs | 74 +++++ .../Generated/PreRulestackRuleCollection.cs | 74 +++++ .../Sample_ConnectionMonitorTestCollection.cs | 43 +++ .../Samples/Sample_PeerAsnCollection.cs | 41 +++ .../Samples/Sample_PeeringCollection.cs | 42 +++ .../Sample_PeeringRegisteredAsnCollection.cs | 43 +++ ...ample_PeeringRegisteredPrefixCollection.cs | 43 +++ .../Sample_PeeringServiceCollection.cs | 42 +++ .../Sample_PeeringServicePrefixCollection.cs | 43 +++ .../ConnectionMonitorTestCollection.cs | 74 +++++ .../src/Generated/PeerAsnCollection.cs | 74 +++++ .../src/Generated/PeeringCollection.cs | 74 +++++ .../PeeringRegisteredAsnCollection.cs | 74 +++++ .../PeeringRegisteredPrefixCollection.cs | 74 +++++ .../src/Generated/PeeringServiceCollection.cs | 74 +++++ .../PeeringServicePrefixCollection.cs | 76 +++++ .../Sample_PolicyAttestationCollection.cs | 40 +++ .../Sample_PolicyMetadataCollection.cs | 40 +++ .../Sample_PolicyRemediationCollection.cs | 40 +++ .../Generated/PolicyAttestationCollection.cs | 74 +++++ .../src/Generated/PolicyMetadataCollection.cs | 72 +++++ .../Generated/PolicyRemediationCollection.cs | 74 +++++ ...ample_PostgreSqlConfigurationCollection.cs | 43 +++ .../Sample_PostgreSqlDatabaseCollection.cs | 43 +++ ...Sample_PostgreSqlFirewallRuleCollection.cs | 43 +++ ...rActiveDirectoryAdministratorCollection.cs | 43 +++ ...ostgreSqlFlexibleServerBackupCollection.cs | 44 +++ ...mple_PostgreSqlFlexibleServerCollection.cs | 84 +++++ ...qlFlexibleServerConfigurationCollection.cs | 43 +++ ...tgreSqlFlexibleServerDatabaseCollection.cs | 43 +++ ...SqlFlexibleServerFirewallRuleCollection.cs | 43 +++ ...reSqlLtrServerBackupOperationCollection.cs | 44 +++ .../Sample_PostgreSqlMigrationCollection.cs | 43 +++ ...eSqlPrivateEndpointConnectionCollection.cs | 43 +++ ...PostgreSqlPrivateLinkResourceCollection.cs | 44 +++ .../Sample_PostgreSqlServerCollection.cs | 42 +++ .../Sample_PostgreSqlServerKeyCollection.cs | 43 +++ ...eSqlServerSecurityAlertPolicyCollection.cs | 43 +++ ..._PostgreSqlVirtualNetworkRuleCollection.cs | 43 +++ .../PostgreSqlConfigurationCollection.cs | 74 +++++ .../Generated/PostgreSqlDatabaseCollection.cs | 74 +++++ .../PostgreSqlFirewallRuleCollection.cs | 74 +++++ ...eSqlPrivateEndpointConnectionCollection.cs | 74 +++++ ...PostgreSqlPrivateLinkResourceCollection.cs | 74 +++++ .../Generated/PostgreSqlServerCollection.cs | 74 +++++ .../PostgreSqlServerKeyCollection.cs | 74 +++++ ...eSqlServerSecurityAlertPolicyCollection.cs | 66 ++++ .../PostgreSqlVirtualNetworkRuleCollection.cs | 74 +++++ ...rActiveDirectoryAdministratorCollection.cs | 74 +++++ ...ostgreSqlFlexibleServerBackupCollection.cs | 74 +++++ .../PostgreSqlFlexibleServerCollection.cs | 74 +++++ ...qlFlexibleServerConfigurationCollection.cs | 74 +++++ ...tgreSqlFlexibleServerDatabaseCollection.cs | 74 +++++ ...SqlFlexibleServerFirewallRuleCollection.cs | 74 +++++ ...reSqlLtrServerBackupOperationCollection.cs | 74 +++++ .../PostgreSqlMigrationCollection.cs | 74 +++++ .../Sample_AutoScaleVCoreCollection.cs | 42 +++ .../Sample_DedicatedCapacityCollection.cs | 42 +++ .../src/Generated/AutoScaleVCoreCollection.cs | 74 +++++ .../Generated/DedicatedCapacityCollection.cs | 74 +++++ .../src/Generated/PrivateDnsZoneCollection.cs | 74 +++++ .../Generated/VirtualNetworkLinkCollection.cs | 74 +++++ .../Samples/Sample_CustomRolloutCollection.cs | 42 +++ .../Sample_DefaultRolloutCollection.cs | 42 +++ ...le_NestedResourceTypeFirstSkuCollection.cs | 44 +++ ...e_NestedResourceTypeSecondSkuCollection.cs | 45 +++ ...le_NestedResourceTypeThirdSkuCollection.cs | 46 +++ ...mple_NotificationRegistrationCollection.cs | 42 +++ .../Sample_ProviderRegistrationCollection.cs | 41 +++ ...mple_ResourceTypeRegistrationCollection.cs | 42 +++ .../Sample_ResourceTypeSkuCollection.cs | 43 +++ .../src/Generated/CustomRolloutCollection.cs | 74 +++++ .../src/Generated/DefaultRolloutCollection.cs | 74 +++++ .../NestedResourceTypeFirstSkuCollection.cs | 74 +++++ .../NestedResourceTypeSecondSkuCollection.cs | 74 +++++ .../NestedResourceTypeThirdSkuCollection.cs | 74 +++++ .../NotificationRegistrationCollection.cs | 74 +++++ .../ProviderRegistrationCollection.cs | 74 +++++ .../ResourceTypeRegistrationCollection.cs | 74 +++++ .../Generated/ResourceTypeSkuCollection.cs | 74 +++++ .../Sample_PurviewAccountCollection.cs | 42 +++ ...viewPrivateEndpointConnectionCollection.cs | 43 +++ ...le_PurviewPrivateLinkResourceCollection.cs | 44 +++ .../src/Generated/PurviewAccountCollection.cs | 74 +++++ ...viewPrivateEndpointConnectionCollection.cs | 74 +++++ .../PurviewPrivateLinkResourceCollection.cs | 74 +++++ 522 files changed, 32443 insertions(+) diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/samples/Generated/Samples/Sample_RemoteRenderingAccountCollection.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/samples/Generated/Samples/Sample_RemoteRenderingAccountCollection.cs index a2317de4cf9e..739612687286 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/samples/Generated/Samples/Sample_RemoteRenderingAccountCollection.cs +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/samples/Generated/Samples/Sample_RemoteRenderingAccountCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetRemoteRenderingAccount() Console.WriteLine($"Succeeded: {result}"); } + // Get remote rendering account + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRemoteRenderingAccount() + { + // Generated from example definition: specification/mixedreality/resource-manager/Microsoft.MixedReality/stable/2021-01-01/examples/remote-rendering/Get.json + // this example is just showing the usage of "RemoteRenderingAccounts_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 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; + string resourceGroupName = "MyResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RemoteRenderingAccountResource + RemoteRenderingAccountCollection collection = resourceGroupResource.GetRemoteRenderingAccounts(); + + // invoke the operation + string accountName = "MyAccount"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + RemoteRenderingAccountResource 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 + RemoteRenderingAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create remote rendering account [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/samples/Generated/Samples/Sample_SpatialAnchorsAccountCollection.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/samples/Generated/Samples/Sample_SpatialAnchorsAccountCollection.cs index 9dd00fe15761..b7ea3edf9a11 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/samples/Generated/Samples/Sample_SpatialAnchorsAccountCollection.cs +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/samples/Generated/Samples/Sample_SpatialAnchorsAccountCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetSpatialAnchorsAccount() Console.WriteLine($"Succeeded: {result}"); } + // Get spatial anchors account + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSpatialAnchorsAccount() + { + // Generated from example definition: specification/mixedreality/resource-manager/Microsoft.MixedReality/stable/2021-01-01/examples/spatial-anchors/Get.json + // this example is just showing the usage of "SpatialAnchorsAccounts_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 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; + string resourceGroupName = "MyResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SpatialAnchorsAccountResource + SpatialAnchorsAccountCollection collection = resourceGroupResource.GetSpatialAnchorsAccounts(); + + // invoke the operation + string accountName = "MyAccount"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + SpatialAnchorsAccountResource 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 + SpatialAnchorsAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create spatial anchor account [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/RemoteRenderingAccountCollection.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/RemoteRenderingAccountCollection.cs index 910619737d51..55e9264b9e77 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/RemoteRenderingAccountCollection.cs +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/RemoteRenderingAccountCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName} + /// + /// + /// Operation Id + /// RemoteRenderingAccounts_Get + /// + /// + /// + /// Name of an Mixed Reality 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _remoteRenderingAccountClientDiagnostics.CreateScope("RemoteRenderingAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _remoteRenderingAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RemoteRenderingAccountResource(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.MixedReality/remoteRenderingAccounts/{accountName} + /// + /// + /// Operation Id + /// RemoteRenderingAccounts_Get + /// + /// + /// + /// Name of an Mixed Reality Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _remoteRenderingAccountClientDiagnostics.CreateScope("RemoteRenderingAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _remoteRenderingAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RemoteRenderingAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/SpatialAnchorsAccountCollection.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/SpatialAnchorsAccountCollection.cs index 3659fc703478..086008af17a7 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/SpatialAnchorsAccountCollection.cs +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/SpatialAnchorsAccountCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName} + /// + /// + /// Operation Id + /// SpatialAnchorsAccounts_Get + /// + /// + /// + /// Name of an Mixed Reality 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _spatialAnchorsAccountClientDiagnostics.CreateScope("SpatialAnchorsAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _spatialAnchorsAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SpatialAnchorsAccountResource(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.MixedReality/spatialAnchorsAccounts/{accountName} + /// + /// + /// Operation Id + /// SpatialAnchorsAccounts_Get + /// + /// + /// + /// Name of an Mixed Reality Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _spatialAnchorsAccountClientDiagnostics.CreateScope("SpatialAnchorsAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _spatialAnchorsAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SpatialAnchorsAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileAttachedDataNetworkCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileAttachedDataNetworkCollection.cs index 12ad7fb4ca02..6aa63fe396e2 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileAttachedDataNetworkCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileAttachedDataNetworkCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string attachedDataNetworkName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName} + /// + /// + /// Operation Id + /// AttachedDataNetworks_Get + /// + /// + /// + /// The name of the attached data network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string attachedDataNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedDataNetworkName, nameof(attachedDataNetworkName)); + + using var scope = _mobileAttachedDataNetworkAttachedDataNetworksClientDiagnostics.CreateScope("MobileAttachedDataNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileAttachedDataNetworkAttachedDataNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, attachedDataNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileAttachedDataNetworkResource(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.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName} + /// + /// + /// Operation Id + /// AttachedDataNetworks_Get + /// + /// + /// + /// The name of the attached data network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string attachedDataNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attachedDataNetworkName, nameof(attachedDataNetworkName)); + + using var scope = _mobileAttachedDataNetworkAttachedDataNetworksClientDiagnostics.CreateScope("MobileAttachedDataNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileAttachedDataNetworkAttachedDataNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, attachedDataNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileAttachedDataNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileDataNetworkCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileDataNetworkCollection.cs index b9e1ec23074f..b2b501089daf 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileDataNetworkCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileDataNetworkCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string dataNetworkName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName} + /// + /// + /// Operation Id + /// DataNetworks_Get + /// + /// + /// + /// The name of the data network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataNetworkName, nameof(dataNetworkName)); + + using var scope = _mobileDataNetworkDataNetworksClientDiagnostics.CreateScope("MobileDataNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileDataNetworkDataNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileDataNetworkResource(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.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName} + /// + /// + /// Operation Id + /// DataNetworks_Get + /// + /// + /// + /// The name of the data network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataNetworkName, nameof(dataNetworkName)); + + using var scope = _mobileDataNetworkDataNetworksClientDiagnostics.CreateScope("MobileDataNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileDataNetworkDataNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileDataNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkCollection.cs index 40e61c6b36c0..dc6dcb3db27b 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string mobileNetworkName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName} + /// + /// + /// Operation Id + /// MobileNetworks_Get + /// + /// + /// + /// The name of the mobile network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string mobileNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mobileNetworkName, nameof(mobileNetworkName)); + + using var scope = _mobileNetworkClientDiagnostics.CreateScope("MobileNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, mobileNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkResource(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.MobileNetwork/mobileNetworks/{mobileNetworkName} + /// + /// + /// Operation Id + /// MobileNetworks_Get + /// + /// + /// + /// The name of the mobile network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string mobileNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mobileNetworkName, nameof(mobileNetworkName)); + + using var scope = _mobileNetworkClientDiagnostics.CreateScope("MobileNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, mobileNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkDiagnosticsPackageCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkDiagnosticsPackageCollection.cs index 5d1a6f549008..2f9801e4174b 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkDiagnosticsPackageCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkDiagnosticsPackageCollection.cs @@ -319,6 +319,80 @@ public virtual Response Exists(string diagnosticsPackageName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName} + /// + /// + /// Operation Id + /// DiagnosticsPackages_Get + /// + /// + /// + /// The name of the diagnostics package. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diagnosticsPackageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticsPackageName, nameof(diagnosticsPackageName)); + + using var scope = _mobileNetworkDiagnosticsPackageDiagnosticsPackagesClientDiagnostics.CreateScope("MobileNetworkDiagnosticsPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkDiagnosticsPackageDiagnosticsPackagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, diagnosticsPackageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkDiagnosticsPackageResource(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.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName} + /// + /// + /// Operation Id + /// DiagnosticsPackages_Get + /// + /// + /// + /// The name of the diagnostics package. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diagnosticsPackageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticsPackageName, nameof(diagnosticsPackageName)); + + using var scope = _mobileNetworkDiagnosticsPackageDiagnosticsPackagesClientDiagnostics.CreateScope("MobileNetworkDiagnosticsPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkDiagnosticsPackageDiagnosticsPackagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, diagnosticsPackageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkDiagnosticsPackageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureCollection.cs index bf52ee114e32..b49f19d9ef81 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string packetCaptureName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName} + /// + /// + /// Operation Id + /// PacketCaptures_Get + /// + /// + /// + /// The name of the packet capture session. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string packetCaptureName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packetCaptureName, nameof(packetCaptureName)); + + using var scope = _mobileNetworkPacketCapturePacketCapturesClientDiagnostics.CreateScope("MobileNetworkPacketCaptureCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkPacketCapturePacketCapturesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, packetCaptureName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkPacketCaptureResource(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.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName} + /// + /// + /// Operation Id + /// PacketCaptures_Get + /// + /// + /// + /// The name of the packet capture session. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string packetCaptureName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packetCaptureName, nameof(packetCaptureName)); + + using var scope = _mobileNetworkPacketCapturePacketCapturesClientDiagnostics.CreateScope("MobileNetworkPacketCaptureCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkPacketCapturePacketCapturesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, packetCaptureName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkPacketCaptureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkServiceCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkServiceCollection.cs index ab4b3c615142..2a370c86f571 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkServiceCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkServiceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service. You must not use any of the following reserved strings - `default`, `requested` or `service`. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _mobileNetworkServiceServicesClientDiagnostics.CreateScope("MobileNetworkServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkServiceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkServiceResource(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.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service. You must not use any of the following reserved strings - `default`, `requested` or `service`. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _mobileNetworkServiceServicesClientDiagnostics.CreateScope("MobileNetworkServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkServiceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimCollection.cs index cbdf4fe4d781..1cbeb67b0ffa 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string simName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName} + /// + /// + /// Operation Id + /// Sims_Get + /// + /// + /// + /// The name of the SIM. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string simName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(simName, nameof(simName)); + + using var scope = _mobileNetworkSimSimsClientDiagnostics.CreateScope("MobileNetworkSimCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkSimSimsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, simName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSimResource(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.MobileNetwork/simGroups/{simGroupName}/sims/{simName} + /// + /// + /// Operation Id + /// Sims_Get + /// + /// + /// + /// The name of the SIM. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string simName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(simName, nameof(simName)); + + using var scope = _mobileNetworkSimSimsClientDiagnostics.CreateScope("MobileNetworkSimCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkSimSimsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, simName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSimResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupCollection.cs index 77c73a2c1d1c..a1e397ebdd32 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string simGroupName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName} + /// + /// + /// Operation Id + /// SimGroups_Get + /// + /// + /// + /// The name of the SIM Group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string simGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(simGroupName, nameof(simGroupName)); + + using var scope = _mobileNetworkSimGroupSimGroupsClientDiagnostics.CreateScope("MobileNetworkSimGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkSimGroupSimGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, simGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSimGroupResource(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.MobileNetwork/simGroups/{simGroupName} + /// + /// + /// Operation Id + /// SimGroups_Get + /// + /// + /// + /// The name of the SIM Group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string simGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(simGroupName, nameof(simGroupName)); + + using var scope = _mobileNetworkSimGroupSimGroupsClientDiagnostics.CreateScope("MobileNetworkSimGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkSimGroupSimGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, simGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSimGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimPolicyCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimPolicyCollection.cs index 3500446312c4..93b5304e9564 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimPolicyCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimPolicyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string simPolicyName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName} + /// + /// + /// Operation Id + /// SimPolicies_Get + /// + /// + /// + /// The name of the SIM policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string simPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(simPolicyName, nameof(simPolicyName)); + + using var scope = _mobileNetworkSimPolicySimPoliciesClientDiagnostics.CreateScope("MobileNetworkSimPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkSimPolicySimPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, simPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSimPolicyResource(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.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName} + /// + /// + /// Operation Id + /// SimPolicies_Get + /// + /// + /// + /// The name of the SIM policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string simPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(simPolicyName, nameof(simPolicyName)); + + using var scope = _mobileNetworkSimPolicySimPoliciesClientDiagnostics.CreateScope("MobileNetworkSimPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkSimPolicySimPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, simPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSimPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSiteCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSiteCollection.cs index 4367784094af..da6403dba005 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSiteCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSiteCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string siteName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the mobile network site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _mobileNetworkSiteSitesClientDiagnostics.CreateScope("MobileNetworkSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkSiteSitesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSiteResource(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.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the mobile network site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _mobileNetworkSiteSitesClientDiagnostics.CreateScope("MobileNetworkSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkSiteSitesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSliceCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSliceCollection.cs index 9b94c207f91b..73a29af8ba3b 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSliceCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSliceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string sliceName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName} + /// + /// + /// Operation Id + /// Slices_Get + /// + /// + /// + /// The name of the network slice. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sliceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sliceName, nameof(sliceName)); + + using var scope = _mobileNetworkSliceSlicesClientDiagnostics.CreateScope("MobileNetworkSliceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mobileNetworkSliceSlicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sliceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSliceResource(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.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName} + /// + /// + /// Operation Id + /// Slices_Get + /// + /// + /// + /// The name of the network slice. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sliceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sliceName, nameof(sliceName)); + + using var scope = _mobileNetworkSliceSlicesClientDiagnostics.CreateScope("MobileNetworkSliceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mobileNetworkSliceSlicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sliceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MobileNetworkSliceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneCollection.cs index 9070fb32db33..b5cb8e655f4e 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string packetCoreControlPlaneName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName} + /// + /// + /// Operation Id + /// PacketCoreControlPlanes_Get + /// + /// + /// + /// The name of the packet core control plane. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string packetCoreControlPlaneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packetCoreControlPlaneName, nameof(packetCoreControlPlaneName)); + + using var scope = _packetCoreControlPlaneClientDiagnostics.CreateScope("PacketCoreControlPlaneCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _packetCoreControlPlaneRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, packetCoreControlPlaneName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PacketCoreControlPlaneResource(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.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName} + /// + /// + /// Operation Id + /// PacketCoreControlPlanes_Get + /// + /// + /// + /// The name of the packet core control plane. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string packetCoreControlPlaneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packetCoreControlPlaneName, nameof(packetCoreControlPlaneName)); + + using var scope = _packetCoreControlPlaneClientDiagnostics.CreateScope("PacketCoreControlPlaneCollection.GetIfExists"); + scope.Start(); + try + { + var response = _packetCoreControlPlaneRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, packetCoreControlPlaneName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PacketCoreControlPlaneResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneCollection.cs index 9b31fb10ee7a..955861ea8bf7 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string packetCoreDataPlaneName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName} + /// + /// + /// Operation Id + /// PacketCoreDataPlanes_Get + /// + /// + /// + /// The name of the packet core data plane. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string packetCoreDataPlaneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packetCoreDataPlaneName, nameof(packetCoreDataPlaneName)); + + using var scope = _packetCoreDataPlaneClientDiagnostics.CreateScope("PacketCoreDataPlaneCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _packetCoreDataPlaneRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, packetCoreDataPlaneName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PacketCoreDataPlaneResource(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.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName} + /// + /// + /// Operation Id + /// PacketCoreDataPlanes_Get + /// + /// + /// + /// The name of the packet core data plane. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string packetCoreDataPlaneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packetCoreDataPlaneName, nameof(packetCoreDataPlaneName)); + + using var scope = _packetCoreDataPlaneClientDiagnostics.CreateScope("PacketCoreDataPlaneCollection.GetIfExists"); + scope.Start(); + try + { + var response = _packetCoreDataPlaneRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, packetCoreDataPlaneName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PacketCoreDataPlaneResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/SubscriptionPacketCoreControlPlaneVersionCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/SubscriptionPacketCoreControlPlaneVersionCollection.cs index 7a8c226bcbf3..e75c610bade1 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/SubscriptionPacketCoreControlPlaneVersionCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/SubscriptionPacketCoreControlPlaneVersionCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string versionName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName} + /// + /// + /// Operation Id + /// PacketCoreControlPlaneVersions_GetBySubscription + /// + /// + /// + /// The name of the packet core control plane version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _subscriptionPacketCoreControlPlaneVersionPacketCoreControlPlaneVersionsClientDiagnostics.CreateScope("SubscriptionPacketCoreControlPlaneVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionPacketCoreControlPlaneVersionPacketCoreControlPlaneVersionsRestClient.GetBySubscriptionAsync(Id.SubscriptionId, versionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionPacketCoreControlPlaneVersionResource(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}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName} + /// + /// + /// Operation Id + /// PacketCoreControlPlaneVersions_GetBySubscription + /// + /// + /// + /// The name of the packet core control plane version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _subscriptionPacketCoreControlPlaneVersionPacketCoreControlPlaneVersionsClientDiagnostics.CreateScope("SubscriptionPacketCoreControlPlaneVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionPacketCoreControlPlaneVersionPacketCoreControlPlaneVersionsRestClient.GetBySubscription(Id.SubscriptionId, versionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionPacketCoreControlPlaneVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/TenantPacketCoreControlPlaneVersionCollection.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/TenantPacketCoreControlPlaneVersionCollection.cs index d5358b81bd05..77b96543f064 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/TenantPacketCoreControlPlaneVersionCollection.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/TenantPacketCoreControlPlaneVersionCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string versionName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName} + /// + /// + /// Operation Id + /// PacketCoreControlPlaneVersions_Get + /// + /// + /// + /// The name of the packet core control plane version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _tenantPacketCoreControlPlaneVersionPacketCoreControlPlaneVersionsClientDiagnostics.CreateScope("TenantPacketCoreControlPlaneVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantPacketCoreControlPlaneVersionPacketCoreControlPlaneVersionsRestClient.GetAsync(versionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantPacketCoreControlPlaneVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName} + /// + /// + /// Operation Id + /// PacketCoreControlPlaneVersions_Get + /// + /// + /// + /// The name of the packet core control plane version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionName, nameof(versionName)); + + using var scope = _tenantPacketCoreControlPlaneVersionPacketCoreControlPlaneVersionsClientDiagnostics.CreateScope("TenantPacketCoreControlPlaneVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantPacketCoreControlPlaneVersionPacketCoreControlPlaneVersionsRestClient.Get(versionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantPacketCoreControlPlaneVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ActionGroupCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ActionGroupCollection.cs index 1894a788b081..e62b3f71151a 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ActionGroupCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ActionGroupCollection.cs @@ -203,6 +203,48 @@ public async Task Exists_GetAnActionGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get an action group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnActionGroup() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getActionGroup.json + // this example is just showing the usage of "ActionGroups_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 = "187f412d-1758-44d9-b052-169e2564721d"; + string resourceGroupName = "Default-NotificationRules"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ActionGroupResource + ActionGroupCollection collection = resourceGroupResource.GetActionGroups(); + + // invoke the operation + string actionGroupName = "SampleActionGroup"; + NullableResponse response = await collection.GetIfExistsAsync(actionGroupName); + ActionGroupResource 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 + ActionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List action groups at resource group level [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ActivityLogAlertCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ActivityLogAlertCollection.cs index b114700c638b..516a51f1ddc9 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ActivityLogAlertCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ActivityLogAlertCollection.cs @@ -303,6 +303,48 @@ public async Task Exists_GetAnActivityLogAlertRule() Console.WriteLine($"Succeeded: {result}"); } + // Get an Activity Log Alert rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnActivityLogAlertRule() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Get.json + // this example is just showing the usage of "ActivityLogAlerts_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 = "187f412d-1758-44d9-b052-169e2564721d"; + string resourceGroupName = "MyResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ActivityLogAlertResource + ActivityLogAlertCollection collection = resourceGroupResource.GetActivityLogAlerts(); + + // invoke the operation + string activityLogAlertName = "SampleActivityLogAlertRule"; + NullableResponse response = await collection.GetIfExistsAsync(activityLogAlertName); + ActivityLogAlertResource 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 + ActivityLogAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List activity log alerts [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_AlertRuleCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_AlertRuleCollection.cs index f145f33f5ee5..d77381ba0815 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_AlertRuleCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_AlertRuleCollection.cs @@ -138,6 +138,48 @@ public async Task Exists_GetAnAlertRule() Console.WriteLine($"Succeeded: {result}"); } + // Get an alert rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAlertRule() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRule.json + // this example is just showing the usage of "AlertRules_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 = "b67f7fec-69fc-4974-9099-a26bd6ffeda3"; + string resourceGroupName = "Rac46PostSwapRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AlertRuleResource + AlertRuleCollection collection = resourceGroupResource.GetAlertRules(); + + // invoke the operation + string ruleName = "chiricutin"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + AlertRuleResource 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 + AlertRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List alert rules [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_AutoscaleSettingCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_AutoscaleSettingCollection.cs index 303da536c73b..0a320221d616 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_AutoscaleSettingCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_AutoscaleSettingCollection.cs @@ -241,5 +241,47 @@ public async Task Exists_GetAnAutoscaleSetting() Console.WriteLine($"Succeeded: {result}"); } + + // Get an autoscale setting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAutoscaleSetting() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json + // this example is just showing the usage of "AutoscaleSettings_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 = "b67f7fec-69fc-4974-9099-a26bd6ffeda3"; + string resourceGroupName = "TestingMetricsScaleSet"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AutoscaleSettingResource + AutoscaleSettingCollection collection = resourceGroupResource.GetAutoscaleSettings(); + + // invoke the operation + string autoscaleSettingName = "MySetting"; + NullableResponse response = await collection.GetIfExistsAsync(autoscaleSettingName); + AutoscaleSettingResource 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 + AutoscaleSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionEndpointCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionEndpointCollection.cs index ea950ef5dc96..abb55a8b9d67 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionEndpointCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionEndpointCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetDataCollectionEndpoint() Console.WriteLine($"Succeeded: {result}"); } + // Get data collection endpoint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDataCollectionEndpoint() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsGet.json + // this example is just showing the usage of "DataCollectionEndpoints_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 = "703362b3-f278-4e4b-9179-c76eaf41ffc2"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataCollectionEndpointResource + DataCollectionEndpointCollection collection = resourceGroupResource.GetDataCollectionEndpoints(); + + // invoke the operation + string dataCollectionEndpointName = "myCollectionEndpoint"; + NullableResponse response = await collection.GetIfExistsAsync(dataCollectionEndpointName); + DataCollectionEndpointResource 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 + DataCollectionEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update data collection endpoint [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionRuleAssociationCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionRuleAssociationCollection.cs index f0eb3199aeb7..63a3dda3bfa8 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionRuleAssociationCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionRuleAssociationCollection.cs @@ -111,6 +111,46 @@ public async Task Exists_GetAssociation() Console.WriteLine($"Succeeded: {result}"); } + // Get association + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAssociation() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsGet.json + // this example is just showing the usage of "DataCollectionRuleAssociations_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DataCollectionRuleAssociationResource + string resourceUri = "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DataCollectionRuleAssociationCollection collection = client.GetDataCollectionRuleAssociations(scopeId); + + // invoke the operation + string associationName = "myAssociation"; + NullableResponse response = await collection.GetIfExistsAsync(associationName); + DataCollectionRuleAssociationResource 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 + DataCollectionRuleAssociationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update association [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionRuleCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionRuleCollection.cs index b3a83ee879ba..f803e7d574e5 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionRuleCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DataCollectionRuleCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetDataCollectionRule() Console.WriteLine($"Succeeded: {result}"); } + // Get data collection rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDataCollectionRule() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesGet.json + // this example is just showing the usage of "DataCollectionRules_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 = "703362b3-f278-4e4b-9179-c76eaf41ffc2"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataCollectionRuleResource + DataCollectionRuleCollection collection = resourceGroupResource.GetDataCollectionRules(); + + // invoke the operation + string dataCollectionRuleName = "myCollectionRule"; + NullableResponse response = await collection.GetIfExistsAsync(dataCollectionRuleName); + DataCollectionRuleResource 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 + DataCollectionRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update data collection rule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DiagnosticSettingCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DiagnosticSettingCollection.cs index c1702115f52a..608186a8613a 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DiagnosticSettingCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DiagnosticSettingCollection.cs @@ -78,6 +78,46 @@ public async Task Exists_GetsTheDiagnosticSetting() Console.WriteLine($"Succeeded: {result}"); } + // Gets the diagnostic setting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDiagnosticSetting() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json + // this example is just showing the usage of "DiagnosticSettings_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DiagnosticSettingResource + string resourceUri = "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DiagnosticSettingCollection collection = client.GetDiagnosticSettings(scopeId); + + // invoke the operation + string name = "mysetting"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DiagnosticSettingResource 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 + DiagnosticSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets the diagnostic setting for category [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -138,6 +178,46 @@ public async Task Exists_GetsTheDiagnosticSettingForCategory() Console.WriteLine($"Succeeded: {result}"); } + // Gets the diagnostic setting for category + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDiagnosticSettingForCategory() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json + // this example is just showing the usage of "DiagnosticSettings_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DiagnosticSettingResource + string resourceUri = "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DiagnosticSettingCollection collection = client.GetDiagnosticSettings(scopeId); + + // invoke the operation + string name = "mysetting"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DiagnosticSettingResource 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 + DiagnosticSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or Updates the diagnostic setting [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DiagnosticSettingsCategoryCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DiagnosticSettingsCategoryCollection.cs index 5c680919e8e9..9922deda9ef5 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DiagnosticSettingsCategoryCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_DiagnosticSettingsCategoryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -76,6 +77,46 @@ public async Task Exists_GetsTheDiagnosticSetting() Console.WriteLine($"Succeeded: {result}"); } + // Gets the diagnostic setting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDiagnosticSetting() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingsCategory.json + // this example is just showing the usage of "DiagnosticSettingsCategory_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DiagnosticSettingsCategoryResource + string resourceUri = "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DiagnosticSettingsCategoryCollection collection = client.GetDiagnosticSettingsCategories(scopeId); + + // invoke the operation + string name = "WorkflowRuntime"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DiagnosticSettingsCategoryResource 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 + DiagnosticSettingsCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets the diagnostic setting [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_LogProfileCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_LogProfileCollection.cs index cd935da30539..1347594a76ba 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_LogProfileCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_LogProfileCollection.cs @@ -81,6 +81,47 @@ public async Task Exists_GetLogProfile() Console.WriteLine($"Succeeded: {result}"); } + // Get log profile + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLogProfile() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json + // this example is just showing the usage of "LogProfiles_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "df602c9c-7aa0-407d-a6fb-eb20c8bd1192"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this LogProfileResource + LogProfileCollection collection = subscriptionResource.GetLogProfiles(); + + // invoke the operation + string logProfileName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(logProfileName); + LogProfileResource 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 + LogProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a log profile [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MetricAlertCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MetricAlertCollection.cs index 3121bc40ff20..3ac4af8bc4f8 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MetricAlertCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MetricAlertCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetADynamicAlertRuleForMultipleResources() Console.WriteLine($"Succeeded: {result}"); } + // Get a dynamic alert rule for multiple resources + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADynamicAlertRuleForMultipleResources() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertMultipleResource.json + // this example is just showing the usage of "MetricAlerts_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 = "gigtest"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MetricAlertResource + MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts(); + + // invoke the operation + string ruleName = "MetricAlertOnMultipleResources"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + MetricAlertResource 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 + MetricAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a dynamic alert rule for single resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -184,6 +226,48 @@ public async Task Exists_GetADynamicAlertRuleForSingleResource() Console.WriteLine($"Succeeded: {result}"); } + // Get a dynamic alert rule for single resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADynamicAlertRuleForSingleResource() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertSingleResource.json + // this example is just showing the usage of "MetricAlerts_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 = "gigtest"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MetricAlertResource + MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts(); + + // invoke the operation + string ruleName = "chiricutin"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + MetricAlertResource 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 + MetricAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a web test alert rule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -248,6 +332,48 @@ public async Task Exists_GetAWebTestAlertRule() Console.WriteLine($"Succeeded: {result}"); } + // Get a web test alert rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWebTestAlertRule() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getWebTestMetricAlert.json + // this example is just showing the usage of "MetricAlerts_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 = "12345678-1234-1234-1234-123456789101"; + string resourceGroupName = "rg-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MetricAlertResource + MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts(); + + // invoke the operation + string ruleName = "webtest-name-example"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + MetricAlertResource 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 + MetricAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an alert rule for multiple resources [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -312,6 +438,48 @@ public async Task Exists_GetAnAlertRuleForMultipleResources() Console.WriteLine($"Succeeded: {result}"); } + // Get an alert rule for multiple resources + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAlertRuleForMultipleResources() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertMultipleResource.json + // this example is just showing the usage of "MetricAlerts_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 = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"; + string resourceGroupName = "gigtest"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MetricAlertResource + MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts(); + + // invoke the operation + string ruleName = "MetricAlertOnMultipleResources"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + MetricAlertResource 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 + MetricAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an alert rule for single resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -376,6 +544,48 @@ public async Task Exists_GetAnAlertRuleForSingleResource() Console.WriteLine($"Succeeded: {result}"); } + // Get an alert rule for single resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAlertRuleForSingleResource() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSingleResource.json + // this example is just showing the usage of "MetricAlerts_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 = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"; + string resourceGroupName = "gigtest"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MetricAlertResource + MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts(); + + // invoke the operation + string ruleName = "chiricutin"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + MetricAlertResource 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 + MetricAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an alert rule on resource group(s) [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -440,6 +650,48 @@ public async Task Exists_GetAnAlertRuleOnResourceGroupS() Console.WriteLine($"Succeeded: {result}"); } + // Get an alert rule on resource group(s) + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAlertRuleOnResourceGroupS() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertResourceGroup.json + // this example is just showing the usage of "MetricAlerts_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 = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"; + string resourceGroupName = "gigtest1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MetricAlertResource + MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts(); + + // invoke the operation + string ruleName = "MetricAlertAtResourceGroupLevel"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + MetricAlertResource 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 + MetricAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an alert rule on subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -504,6 +756,48 @@ public async Task Exists_GetAnAlertRuleOnSubscription() Console.WriteLine($"Succeeded: {result}"); } + // Get an alert rule on subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAlertRuleOnSubscription() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSubscription.json + // this example is just showing the usage of "MetricAlerts_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 = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"; + string resourceGroupName = "gigtest"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MetricAlertResource + MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts(); + + // invoke the operation + string ruleName = "MetricAlertAtSubscriptionLevel"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + MetricAlertResource 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 + MetricAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a dynamic alert rule for Multiple Resources [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateEndpointConnectionCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateEndpointConnectionCollection.cs index 42ae0cbadc89..25a5f0b90524 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateEndpointConnectionCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 MonitorPrivateLinkScopeResource created on azure + // for more information of creating MonitorPrivateLinkScopeResource, please refer to the document of MonitorPrivateLinkScopeResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "MyResourceGroup"; + string scopeName = "MyPrivateLinkScope"; + ResourceIdentifier monitorPrivateLinkScopeResourceId = MonitorPrivateLinkScopeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, scopeName); + MonitorPrivateLinkScopeResource monitorPrivateLinkScope = client.GetMonitorPrivateLinkScopeResource(monitorPrivateLinkScopeResourceId); + + // get the collection of this MonitorPrivateEndpointConnectionResource + MonitorPrivateEndpointConnectionCollection collection = monitorPrivateLinkScope.GetMonitorPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "private-endpoint-connection-name"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + MonitorPrivateEndpointConnectionResource 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 + MonitorPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a private endpoint connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkResourceCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkResourceCollection.cs index 50ecf6b3cf1d..ac4364f9d1eb 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkResourceCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_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 MonitorPrivateLinkScopeResource created on azure + // for more information of creating MonitorPrivateLinkScopeResource, please refer to the document of MonitorPrivateLinkScopeResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "MyResourceGroup"; + string scopeName = "MyPrivateLinkScope"; + ResourceIdentifier monitorPrivateLinkScopeResourceId = MonitorPrivateLinkScopeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, scopeName); + MonitorPrivateLinkScopeResource monitorPrivateLinkScope = client.GetMonitorPrivateLinkScopeResource(monitorPrivateLinkScopeResourceId); + + // get the collection of this MonitorPrivateLinkResource + MonitorPrivateLinkResourceCollection collection = monitorPrivateLinkScope.GetMonitorPrivateLinkResources(); + + // invoke the operation + string groupName = "azuremonitor"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + MonitorPrivateLinkResource 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 + MonitorPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkScopeCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkScopeCollection.cs index 00bc1835539d..0087b9d6ae14 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkScopeCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkScopeCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_PrivateLinkScopeGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateLinkScopeGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkScopeGet() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesGet.json + // this example is just showing the usage of "PrivateLinkScopes_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 = "86dc51d3-92ed-4d7e-947a-775ea79b4919"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MonitorPrivateLinkScopeResource + MonitorPrivateLinkScopeCollection collection = resourceGroupResource.GetMonitorPrivateLinkScopes(); + + // invoke the operation + string scopeName = "my-privatelinkscope"; + NullableResponse response = await collection.GetIfExistsAsync(scopeName); + MonitorPrivateLinkScopeResource 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 + MonitorPrivateLinkScopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateLinkScopeCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkScopedResourceCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkScopedResourceCollection.cs index b01e4250b689..f2b6b7e9c6b7 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkScopedResourceCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorPrivateLinkScopedResourceCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetsPrivateLinkScopedResource() Console.WriteLine($"Succeeded: {result}"); } + // Gets private link scoped resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateLinkScopedResource() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceGet.json + // this example is just showing the usage of "PrivateLinkScopedResources_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 MonitorPrivateLinkScopeResource created on azure + // for more information of creating MonitorPrivateLinkScopeResource, please refer to the document of MonitorPrivateLinkScopeResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "MyResourceGroup"; + string scopeName = "MyPrivateLinkScope"; + ResourceIdentifier monitorPrivateLinkScopeResourceId = MonitorPrivateLinkScopeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, scopeName); + MonitorPrivateLinkScopeResource monitorPrivateLinkScope = client.GetMonitorPrivateLinkScopeResource(monitorPrivateLinkScopeResourceId); + + // get the collection of this MonitorPrivateLinkScopedResource + MonitorPrivateLinkScopedResourceCollection collection = monitorPrivateLinkScope.GetMonitorPrivateLinkScopedResources(); + + // invoke the operation + string name = "scoped-resource-name"; + NullableResponse response = await collection.GetIfExistsAsync(name); + MonitorPrivateLinkScopedResource 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 + MonitorPrivateLinkScopedResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a scoped resource in a private link scope. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorWorkspaceResourceCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorWorkspaceResourceCollection.cs index 2e28c4d54a52..fe944f7eb8b2 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorWorkspaceResourceCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_MonitorWorkspaceResourceCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetWorkspace() Console.WriteLine($"Succeeded: {result}"); } + // Get workspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWorkspace() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Monitor/stable/2023-04-03/examples/AzureMonitorWorkspacesGet.json + // this example is just showing the usage of "AzureMonitorWorkspaces_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 = "703362b3-f278-4e4b-9179-c76eaf41ffc2"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MonitorWorkspaceResource + MonitorWorkspaceResourceCollection collection = resourceGroupResource.GetMonitorWorkspaceResources(); + + // invoke the operation + string azureMonitorWorkspaceName = "myAzureMonitorWorkspace"; + NullableResponse response = await collection.GetIfExistsAsync(azureMonitorWorkspaceName); + MonitorWorkspaceResource 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 + MonitorWorkspaceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update workspace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ScheduledQueryRuleCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ScheduledQueryRuleCollection.cs index 5ec6c780731d..dd8be43485bd 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ScheduledQueryRuleCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/samples/Generated/Samples/Sample_ScheduledQueryRuleCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetAScheduledQueryRuleForSingleResource() Console.WriteLine($"Succeeded: {result}"); } + // Get a scheduled query rule for single resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAScheduledQueryRuleForSingleResource() + { + // Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/getScheduledQueryRule.json + // this example is just showing the usage of "ScheduledQueryRules_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 = "dd4bfc94-a096-412b-9c43-4bd13e35afbc"; + string resourceGroupName = "QueryResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ScheduledQueryRuleResource + ScheduledQueryRuleCollection collection = resourceGroupResource.GetScheduledQueryRules(); + + // invoke the operation + string ruleName = "perf"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + ScheduledQueryRuleResource 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 + ScheduledQueryRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a scheduled query rule for Single Resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActionGroupCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActionGroupCollection.cs index 4547a09860ab..25163076b905 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActionGroupCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActionGroupCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string actionGroupName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName} + /// + /// + /// Operation Id + /// ActionGroups_Get + /// + /// + /// + /// The name of the action group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string actionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(actionGroupName, nameof(actionGroupName)); + + using var scope = _actionGroupClientDiagnostics.CreateScope("ActionGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _actionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, actionGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ActionGroupResource(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.Insights/actionGroups/{actionGroupName} + /// + /// + /// Operation Id + /// ActionGroups_Get + /// + /// + /// + /// The name of the action group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string actionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(actionGroupName, nameof(actionGroupName)); + + using var scope = _actionGroupClientDiagnostics.CreateScope("ActionGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _actionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, actionGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ActionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActivityLogAlertCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActivityLogAlertCollection.cs index 34287f3d1e00..65b1a8fe600d 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActivityLogAlertCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActivityLogAlertCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string activityLogAlertName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName} + /// + /// + /// Operation Id + /// ActivityLogAlerts_Get + /// + /// + /// + /// The name of the Activity Log Alert rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string activityLogAlertName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activityLogAlertName, nameof(activityLogAlertName)); + + using var scope = _activityLogAlertClientDiagnostics.CreateScope("ActivityLogAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _activityLogAlertRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, activityLogAlertName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ActivityLogAlertResource(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.Insights/activityLogAlerts/{activityLogAlertName} + /// + /// + /// Operation Id + /// ActivityLogAlerts_Get + /// + /// + /// + /// The name of the Activity Log Alert rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string activityLogAlertName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activityLogAlertName, nameof(activityLogAlertName)); + + using var scope = _activityLogAlertClientDiagnostics.CreateScope("ActivityLogAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _activityLogAlertRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, activityLogAlertName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ActivityLogAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AlertRuleCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AlertRuleCollection.cs index 53b1d7b869ac..93998444af23 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AlertRuleCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AlertRuleCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName} + /// + /// + /// Operation Id + /// AlertRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _alertRuleClientDiagnostics.CreateScope("AlertRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _alertRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AlertRuleResource(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.Insights/alertrules/{ruleName} + /// + /// + /// Operation Id + /// AlertRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _alertRuleClientDiagnostics.CreateScope("AlertRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _alertRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AlertRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AutoscaleSettingCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AutoscaleSettingCollection.cs index 10b91e6e76ea..a99d7e4aa8e4 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AutoscaleSettingCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AutoscaleSettingCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string autoscaleSettingName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName} + /// + /// + /// Operation Id + /// AutoscaleSettings_Get + /// + /// + /// + /// The autoscale setting name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string autoscaleSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoscaleSettingName, nameof(autoscaleSettingName)); + + using var scope = _autoscaleSettingClientDiagnostics.CreateScope("AutoscaleSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _autoscaleSettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, autoscaleSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutoscaleSettingResource(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.Insights/autoscalesettings/{autoscaleSettingName} + /// + /// + /// Operation Id + /// AutoscaleSettings_Get + /// + /// + /// + /// The autoscale setting name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string autoscaleSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoscaleSettingName, nameof(autoscaleSettingName)); + + using var scope = _autoscaleSettingClientDiagnostics.CreateScope("AutoscaleSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _autoscaleSettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, autoscaleSettingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutoscaleSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionEndpointCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionEndpointCollection.cs index 4d1a8951ec0b..fbb3d2a408b9 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionEndpointCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionEndpointCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string dataCollectionEndpointName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName} + /// + /// + /// Operation Id + /// DataCollectionEndpoints_Get + /// + /// + /// + /// The name of the data collection endpoint. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataCollectionEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataCollectionEndpointName, nameof(dataCollectionEndpointName)); + + using var scope = _dataCollectionEndpointClientDiagnostics.CreateScope("DataCollectionEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataCollectionEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dataCollectionEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataCollectionEndpointResource(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.Insights/dataCollectionEndpoints/{dataCollectionEndpointName} + /// + /// + /// Operation Id + /// DataCollectionEndpoints_Get + /// + /// + /// + /// The name of the data collection endpoint. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataCollectionEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataCollectionEndpointName, nameof(dataCollectionEndpointName)); + + using var scope = _dataCollectionEndpointClientDiagnostics.CreateScope("DataCollectionEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataCollectionEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dataCollectionEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataCollectionEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleAssociationCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleAssociationCollection.cs index 3ce5c0d100e7..2a1cbb4f4498 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleAssociationCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleAssociationCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string associationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName} + /// + /// + /// Operation Id + /// DataCollectionRuleAssociations_Get + /// + /// + /// + /// The name of the association. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string associationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(associationName, nameof(associationName)); + + using var scope = _dataCollectionRuleAssociationClientDiagnostics.CreateScope("DataCollectionRuleAssociationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataCollectionRuleAssociationRestClient.GetAsync(Id, associationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataCollectionRuleAssociationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName} + /// + /// + /// Operation Id + /// DataCollectionRuleAssociations_Get + /// + /// + /// + /// The name of the association. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string associationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(associationName, nameof(associationName)); + + using var scope = _dataCollectionRuleAssociationClientDiagnostics.CreateScope("DataCollectionRuleAssociationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataCollectionRuleAssociationRestClient.Get(Id, associationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataCollectionRuleAssociationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleCollection.cs index e22754cc0a80..d1ba9e11f26e 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string dataCollectionRuleName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName} + /// + /// + /// Operation Id + /// DataCollectionRules_Get + /// + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataCollectionRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataCollectionRuleName, nameof(dataCollectionRuleName)); + + using var scope = _dataCollectionRuleClientDiagnostics.CreateScope("DataCollectionRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataCollectionRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dataCollectionRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataCollectionRuleResource(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.Insights/dataCollectionRules/{dataCollectionRuleName} + /// + /// + /// Operation Id + /// DataCollectionRules_Get + /// + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataCollectionRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataCollectionRuleName, nameof(dataCollectionRuleName)); + + using var scope = _dataCollectionRuleClientDiagnostics.CreateScope("DataCollectionRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataCollectionRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dataCollectionRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataCollectionRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingCollection.cs index ad4a913b1ddb..79c66858e160 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingCollection.cs @@ -311,6 +311,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name} + /// + /// + /// Operation Id + /// DiagnosticSettings_Get + /// + /// + /// + /// The name of the diagnostic setting. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _diagnosticSettingClientDiagnostics.CreateScope("DiagnosticSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _diagnosticSettingRestClient.GetAsync(Id, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiagnosticSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name} + /// + /// + /// Operation Id + /// DiagnosticSettings_Get + /// + /// + /// + /// The name of the diagnostic setting. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _diagnosticSettingClientDiagnostics.CreateScope("DiagnosticSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _diagnosticSettingRestClient.Get(Id, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiagnosticSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingsCategoryCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingsCategoryCollection.cs index 728f768a8334..5dfc9552b6a4 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingsCategoryCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingsCategoryCollection.cs @@ -229,6 +229,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name} + /// + /// + /// Operation Id + /// DiagnosticSettingsCategory_Get + /// + /// + /// + /// The name of the diagnostic setting. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _diagnosticSettingsCategoryClientDiagnostics.CreateScope("DiagnosticSettingsCategoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _diagnosticSettingsCategoryRestClient.GetAsync(Id, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiagnosticSettingsCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name} + /// + /// + /// Operation Id + /// DiagnosticSettingsCategory_Get + /// + /// + /// + /// The name of the diagnostic setting. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _diagnosticSettingsCategoryClientDiagnostics.CreateScope("DiagnosticSettingsCategoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _diagnosticSettingsCategoryRestClient.Get(Id, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiagnosticSettingsCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogProfileCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogProfileCollection.cs index 229b8cecb3ed..06f3fb41b84b 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogProfileCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogProfileCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string logProfileName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName} + /// + /// + /// Operation Id + /// LogProfiles_Get + /// + /// + /// + /// The name of the log profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string logProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(logProfileName, nameof(logProfileName)); + + using var scope = _logProfileClientDiagnostics.CreateScope("LogProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logProfileRestClient.GetAsync(Id.SubscriptionId, logProfileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogProfileResource(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}/providers/Microsoft.Insights/logprofiles/{logProfileName} + /// + /// + /// Operation Id + /// LogProfiles_Get + /// + /// + /// + /// The name of the log profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string logProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(logProfileName, nameof(logProfileName)); + + using var scope = _logProfileClientDiagnostics.CreateScope("LogProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logProfileRestClient.Get(Id.SubscriptionId, logProfileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MetricAlertCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MetricAlertCollection.cs index cdf207c930a6..b09906dc1760 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MetricAlertCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MetricAlertCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName} + /// + /// + /// Operation Id + /// MetricAlerts_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _metricAlertClientDiagnostics.CreateScope("MetricAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _metricAlertRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MetricAlertResource(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.Insights/metricAlerts/{ruleName} + /// + /// + /// Operation Id + /// MetricAlerts_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _metricAlertClientDiagnostics.CreateScope("MetricAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _metricAlertRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MetricAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateEndpointConnectionCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateEndpointConnectionCollection.cs index 6b4942290062..01dca07fbc8a 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateEndpointConnectionCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _monitorPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("MonitorPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _monitorPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorPrivateEndpointConnectionResource(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.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _monitorPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("MonitorPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _monitorPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkResourceCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkResourceCollection.cs index 68dd477706ac..a421515cc822 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkResourceCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _monitorPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("MonitorPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _monitorPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorPrivateLinkResource(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.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _monitorPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("MonitorPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _monitorPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeCollection.cs index bfacd75989dc..36e1c73d1799 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string scopeName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName} + /// + /// + /// Operation Id + /// PrivateLinkScopes_Get + /// + /// + /// + /// The name of the Azure Monitor PrivateLinkScope 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 scopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeName, nameof(scopeName)); + + using var scope = _monitorPrivateLinkScopePrivateLinkScopesClientDiagnostics.CreateScope("MonitorPrivateLinkScopeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _monitorPrivateLinkScopePrivateLinkScopesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, scopeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorPrivateLinkScopeResource(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.insights/privateLinkScopes/{scopeName} + /// + /// + /// Operation Id + /// PrivateLinkScopes_Get + /// + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeName, nameof(scopeName)); + + using var scope = _monitorPrivateLinkScopePrivateLinkScopesClientDiagnostics.CreateScope("MonitorPrivateLinkScopeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _monitorPrivateLinkScopePrivateLinkScopesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, scopeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorPrivateLinkScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopedResourceCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopedResourceCollection.cs index b88fa237d06e..24216b944deb 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopedResourceCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopedResourceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name} + /// + /// + /// Operation Id + /// PrivateLinkScopedResources_Get + /// + /// + /// + /// The name of the scoped resource object. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _monitorPrivateLinkScopedResourcePrivateLinkScopedResourcesClientDiagnostics.CreateScope("MonitorPrivateLinkScopedResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _monitorPrivateLinkScopedResourcePrivateLinkScopedResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorPrivateLinkScopedResource(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.Insights/privateLinkScopes/{scopeName}/scopedResources/{name} + /// + /// + /// Operation Id + /// PrivateLinkScopedResources_Get + /// + /// + /// + /// The name of the scoped resource object. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _monitorPrivateLinkScopedResourcePrivateLinkScopedResourcesClientDiagnostics.CreateScope("MonitorPrivateLinkScopedResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _monitorPrivateLinkScopedResourcePrivateLinkScopedResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorPrivateLinkScopedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorWorkspaceResourceCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorWorkspaceResourceCollection.cs index effd77cd1f21..70b655770a28 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorWorkspaceResourceCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorWorkspaceResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string azureMonitorWorkspaceName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName} + /// + /// + /// Operation Id + /// AzureMonitorWorkspaces_Get + /// + /// + /// + /// The name of the Azure Monitor workspace. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureMonitorWorkspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureMonitorWorkspaceName, nameof(azureMonitorWorkspaceName)); + + using var scope = _monitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics.CreateScope("MonitorWorkspaceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _monitorWorkspaceResourceAzureMonitorWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureMonitorWorkspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorWorkspaceResource(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.Monitor/accounts/{azureMonitorWorkspaceName} + /// + /// + /// Operation Id + /// AzureMonitorWorkspaces_Get + /// + /// + /// + /// The name of the Azure Monitor workspace. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureMonitorWorkspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureMonitorWorkspaceName, nameof(azureMonitorWorkspaceName)); + + using var scope = _monitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics.CreateScope("MonitorWorkspaceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _monitorWorkspaceResourceAzureMonitorWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureMonitorWorkspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitorWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleCollection.cs index b010366a6b1b..8c7eb04cbc43 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// + /// + /// Operation Id + /// ScheduledQueryRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _scheduledQueryRuleClientDiagnostics.CreateScope("ScheduledQueryRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scheduledQueryRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScheduledQueryRuleResource(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.Insights/scheduledQueryRules/{ruleName} + /// + /// + /// Operation Id + /// ScheduledQueryRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _scheduledQueryRuleClientDiagnostics.CreateScope("ScheduledQueryRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scheduledQueryRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScheduledQueryRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlAdvisorCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlAdvisorCollection.cs index 0527475bb9c0..7d80123539ac 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlAdvisorCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlAdvisorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_AdvisorsGet() Console.WriteLine($"Succeeded: {result}"); } + // AdvisorsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AdvisorsGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/AdvisorsGet.json + // this example is just showing the usage of "Advisors_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testResourceGroupName"; + string serverName = "testServerName"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlAdvisorResource + MySqlAdvisorCollection collection = mySqlServer.GetMySqlAdvisors(); + + // invoke the operation + string advisorName = "Index"; + NullableResponse response = await collection.GetIfExistsAsync(advisorName); + MySqlAdvisorResource 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 + MySqlAdvisorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AdvisorsListByServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlConfigurationCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlConfigurationCollection.cs index c51c6320da75..7fc068970d36 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlConfigurationCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlConfigurationCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_ConfigurationGet() Console.WriteLine($"Succeeded: {result}"); } + // ConfigurationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConfigurationGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/examples/ConfigurationGet.json + // this example is just showing the usage of "Configurations_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlConfigurationResource + MySqlConfigurationCollection collection = mySqlServer.GetMySqlConfigurations(); + + // invoke the operation + string configurationName = "event_scheduler"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + MySqlConfigurationResource 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 + MySqlConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConfigurationList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlDatabaseCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlDatabaseCollection.cs index bf8ab5037ceb..47f2e20ade1c 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlDatabaseCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlDatabaseCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_DatabaseGet() Console.WriteLine($"Succeeded: {result}"); } + // DatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DatabaseGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/examples/DatabaseGet.json + // this example is just showing the usage of "Databases_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlDatabaseResource + MySqlDatabaseCollection collection = mySqlServer.GetMySqlDatabases(); + + // invoke the operation + string databaseName = "db1"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + MySqlDatabaseResource 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 + MySqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DatabaseList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFirewallRuleCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFirewallRuleCollection.cs index 8c2e46a29a73..57f4083f94eb 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFirewallRuleCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFirewallRuleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_FirewallRuleGet() Console.WriteLine($"Succeeded: {result}"); } + // FirewallRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FirewallRuleGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/examples/FirewallRuleGet.json + // this example is just showing the usage of "FirewallRules_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlFirewallRuleResource + MySqlFirewallRuleCollection collection = mySqlServer.GetMySqlFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + MySqlFirewallRuleResource 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 + MySqlFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FirewallRuleList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorCollection.cs index e827533a60f5..0e33b3473acf 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorCollection.cs @@ -128,6 +128,49 @@ public async Task Exists_GetAnAzureAdAdministrator() Console.WriteLine($"Succeeded: {result}"); } + // Get an azure ad administrator + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAzureAdAdministrator() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorGet.json + // this example is just showing the usage of "AzureADAdministrators_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 MySqlFlexibleServerResource created on azure + // for more information of creating MySqlFlexibleServerResource, please refer to the document of MySqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + string serverName = "mysqltestsvc4"; + ResourceIdentifier mySqlFlexibleServerResourceId = MySqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlFlexibleServerResource mySqlFlexibleServer = client.GetMySqlFlexibleServerResource(mySqlFlexibleServerResourceId); + + // get the collection of this MySqlFlexibleServerAadAdministratorResource + MySqlFlexibleServerAadAdministratorCollection collection = mySqlFlexibleServer.GetMySqlFlexibleServerAadAdministrators(); + + // invoke the operation + MySqlFlexibleServerAdministratorName administratorName = MySqlFlexibleServerAdministratorName.ActiveDirectory; + NullableResponse response = await collection.GetIfExistsAsync(administratorName); + MySqlFlexibleServerAadAdministratorResource 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 + MySqlFlexibleServerAadAdministratorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Azure AD administrators in a server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupCollection.cs index a7e311ee372f..1620be0cfdf7 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupCollection.cs @@ -119,6 +119,49 @@ public async Task Exists_GetABackupForAServer() Console.WriteLine($"Succeeded: {result}"); } + // Get a backup for a server + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetABackupForAServer() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupGet.json + // this example is just showing the usage of "Backups_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 MySqlFlexibleServerResource created on azure + // for more information of creating MySqlFlexibleServerResource, please refer to the document of MySqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "mysqltestserver"; + ResourceIdentifier mySqlFlexibleServerResourceId = MySqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlFlexibleServerResource mySqlFlexibleServer = client.GetMySqlFlexibleServerResource(mySqlFlexibleServerResourceId); + + // get the collection of this MySqlFlexibleServerBackupResource + MySqlFlexibleServerBackupCollection collection = mySqlFlexibleServer.GetMySqlFlexibleServerBackups(); + + // invoke the operation + string backupName = "daily_20210615T160516"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + MySqlFlexibleServerBackupResource 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 + MySqlFlexibleServerBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List backups for a server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerCollection.cs index cca6ee1bb8a6..12382964233f 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerCollection.cs @@ -313,6 +313,48 @@ public async Task Exists_GetAServer() Console.WriteLine($"Succeeded: {result}"); } + // Get a server + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServer() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGet.json + // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MySqlFlexibleServerResource + MySqlFlexibleServerCollection collection = resourceGroupResource.GetMySqlFlexibleServers(); + + // invoke the operation + string serverName = "mysqltestserver"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + MySqlFlexibleServerResource 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 + MySqlFlexibleServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a server with vnet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -377,6 +419,48 @@ public async Task Exists_GetAServerWithVnet() Console.WriteLine($"Succeeded: {result}"); } + // Get a server with vnet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerWithVnet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGetWithVnet.json + // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MySqlFlexibleServerResource + MySqlFlexibleServerCollection collection = resourceGroupResource.GetMySqlFlexibleServers(); + + // invoke the operation + string serverName = "mysqltestserver"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + MySqlFlexibleServerResource 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 + MySqlFlexibleServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List servers in a resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationCollection.cs index 6541a13fd051..65483dece9dd 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationCollection.cs @@ -125,6 +125,49 @@ public async Task Exists_GetAConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get a configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAConfiguration() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationGet.json + // this example is just showing the usage of "Configurations_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 MySqlFlexibleServerResource created on azure + // for more information of creating MySqlFlexibleServerResource, please refer to the document of MySqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier mySqlFlexibleServerResourceId = MySqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlFlexibleServerResource mySqlFlexibleServer = client.GetMySqlFlexibleServerResource(mySqlFlexibleServerResourceId); + + // get the collection of this MySqlFlexibleServerConfigurationResource + MySqlFlexibleServerConfigurationCollection collection = mySqlFlexibleServer.GetMySqlFlexibleServerConfigurations(); + + // invoke the operation + string configurationName = "event_scheduler"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + MySqlFlexibleServerConfigurationResource 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 + MySqlFlexibleServerConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all configurations for a server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseCollection.cs index 6d70c08e1040..e47d07ab5623 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_GetADatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get a database + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabase() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseGet.json + // this example is just showing the usage of "Databases_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 MySqlFlexibleServerResource created on azure + // for more information of creating MySqlFlexibleServerResource, please refer to the document of MySqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier mySqlFlexibleServerResourceId = MySqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlFlexibleServerResource mySqlFlexibleServer = client.GetMySqlFlexibleServerResource(mySqlFlexibleServerResourceId); + + // get the collection of this MySqlFlexibleServerDatabaseResource + MySqlFlexibleServerDatabaseCollection collection = mySqlFlexibleServer.GetMySqlFlexibleServerDatabases(); + + // invoke the operation + string databaseName = "db1"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + MySqlFlexibleServerDatabaseResource 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 + MySqlFlexibleServerDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List databases in a server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleCollection.cs index 1e557eb310ab..ab0d6b9c34c0 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAFirewallRule() Console.WriteLine($"Succeeded: {result}"); } + // Get a firewall rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAFirewallRule() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleGet.json + // this example is just showing the usage of "FirewallRules_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 MySqlFlexibleServerResource created on azure + // for more information of creating MySqlFlexibleServerResource, please refer to the document of MySqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier mySqlFlexibleServerResourceId = MySqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlFlexibleServerResource mySqlFlexibleServer = client.GetMySqlFlexibleServerResource(mySqlFlexibleServerResourceId); + + // get the collection of this MySqlFlexibleServerFirewallRuleResource + MySqlFlexibleServerFirewallRuleCollection collection = mySqlFlexibleServer.GetMySqlFlexibleServerFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + MySqlFlexibleServerFirewallRuleResource 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 + MySqlFlexibleServerFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all firewall rules in a server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlPrivateEndpointConnectionCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlPrivateEndpointConnectionCollection.cs index c011c13e1a1b..57ec2923c8c7 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlPrivateEndpointConnectionCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "test-svr"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlPrivateEndpointConnectionResource + MySqlPrivateEndpointConnectionCollection collection = mySqlServer.GetMySqlPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "private-endpoint-connection-name"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + MySqlPrivateEndpointConnectionResource 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 + MySqlPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a private endpoint connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlPrivateLinkResourceCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlPrivateLinkResourceCollection.cs index bbdd824cbd0a..16fdd47d49fa 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlPrivateLinkResourceCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsAPrivateLinkResourceForMySQL() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a private link resource for MySQL. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAPrivateLinkResourceForMySQL() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/PrivateLinkResourcesGet.json + // this example is just showing the usage of "PrivateLinkResources_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "test-svr"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlPrivateLinkResource + MySqlPrivateLinkResourceCollection collection = mySqlServer.GetMySqlPrivateLinkResources(); + + // invoke the operation + string groupName = "plr"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + MySqlPrivateLinkResource 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 + MySqlPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlQueryStatisticCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlQueryStatisticCollection.cs index 17bebd243642..0cdc5e1da42f 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlQueryStatisticCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlQueryStatisticCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -83,6 +84,49 @@ public async Task Exists_TopQueryStatisticsGet() Console.WriteLine($"Succeeded: {result}"); } + // TopQueryStatisticsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TopQueryStatisticsGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/TopQueryStatisticsGet.json + // this example is just showing the usage of "TopQueryStatistics_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testResourceGroupName"; + string serverName = "testServerName"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlQueryStatisticResource + MySqlQueryStatisticCollection collection = mySqlServer.GetMySqlQueryStatistics(); + + // invoke the operation + string queryStatisticId = "66-636923268000000000-636923277000000000-avg-duration"; + NullableResponse response = await collection.GetIfExistsAsync(queryStatisticId); + MySqlQueryStatisticResource 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 + MySqlQueryStatisticData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TopQueryStatisticsListByServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlQueryTextCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlQueryTextCollection.cs index 1bdd895b86f7..1c75cc41b8a2 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlQueryTextCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlQueryTextCollection.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -83,6 +84,49 @@ public async Task Exists_QueryTextsGet() Console.WriteLine($"Succeeded: {result}"); } + // QueryTextsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QueryTextsGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/QueryTextsGet.json + // this example is just showing the usage of "QueryTexts_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testResourceGroupName"; + string serverName = "testServerName"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlQueryTextResource + MySqlQueryTextCollection collection = mySqlServer.GetMySqlQueryTexts(); + + // invoke the operation + string queryId = "1"; + NullableResponse response = await collection.GetIfExistsAsync(queryId); + MySqlQueryTextResource 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 + MySqlQueryTextData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QueryTextsListByServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlRecommendationActionCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlRecommendationActionCollection.cs index a7bb7e37bc6f..d1ec1f85e824 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlRecommendationActionCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlRecommendationActionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_RecommendedActionsGet() Console.WriteLine($"Succeeded: {result}"); } + // RecommendedActionsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RecommendedActionsGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/RecommendedActionsGet.json + // this example is just showing the usage of "RecommendedActions_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 MySqlAdvisorResource created on azure + // for more information of creating MySqlAdvisorResource, please refer to the document of MySqlAdvisorResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testResourceGroupName"; + string serverName = "testServerName"; + string advisorName = "Index"; + ResourceIdentifier mySqlAdvisorResourceId = MySqlAdvisorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, advisorName); + MySqlAdvisorResource mySqlAdvisor = client.GetMySqlAdvisorResource(mySqlAdvisorResourceId); + + // get the collection of this MySqlRecommendationActionResource + MySqlRecommendationActionCollection collection = mySqlAdvisor.GetMySqlRecommendationActions(); + + // invoke the operation + string recommendedActionName = "Index-1"; + NullableResponse response = await collection.GetIfExistsAsync(recommendedActionName); + MySqlRecommendationActionResource 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 + MySqlRecommendationActionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RecommendedActionsListByServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerCollection.cs index 05b88c58331e..b526d478d15c 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerCollection.cs @@ -272,6 +272,48 @@ public async Task Exists_ServerGet() Console.WriteLine($"Succeeded: {result}"); } + // ServerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServerGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/examples/ServerGet.json + // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MySqlServerResource + MySqlServerCollection collection = resourceGroupResource.GetMySqlServers(); + + // invoke the operation + string serverName = "mysqltestsvc4"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + MySqlServerResource 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 + MySqlServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ServerListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerKeyCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerKeyCollection.cs index ff42153922f0..b336e89d89cf 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerKeyCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerKeyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetTheMySQLServerKey() Console.WriteLine($"Succeeded: {result}"); } + // Get the MySQL Server key + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheMySQLServerKey() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2020-01-01/examples/ServerKeyGet.json + // this example is just showing the usage of "ServerKeys_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + string serverName = "testserver"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlServerKeyResource + MySqlServerKeyCollection collection = mySqlServer.GetMySqlServerKeys(); + + // invoke the operation + string keyName = "someVault_someKey_01234567890123456789012345678901"; + NullableResponse response = await collection.GetIfExistsAsync(keyName); + MySqlServerKeyResource 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 + MySqlServerKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a MySQL Server key [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerSecurityAlertPolicyCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerSecurityAlertPolicyCollection.cs index 9bead3888056..c5cb8ad6d351 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerSecurityAlertPolicyCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlServerSecurityAlertPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAServerSThreatDetectionPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a server's threat detection policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerSThreatDetectionPolicy() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/examples/ServerSecurityAlertsGet.json + // this example is just showing the usage of "ServerSecurityAlertPolicies_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "securityalert-4799"; + string serverName = "securityalert-6440"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlServerSecurityAlertPolicyResource + MySqlServerSecurityAlertPolicyCollection collection = mySqlServer.GetMySqlServerSecurityAlertPolicies(); + + // invoke the operation + MySqlSecurityAlertPolicyName securityAlertPolicyName = MySqlSecurityAlertPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(securityAlertPolicyName); + MySqlServerSecurityAlertPolicyResource 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 + MySqlServerSecurityAlertPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a server's threat detection policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlVirtualNetworkRuleCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlVirtualNetworkRuleCollection.cs index 6a9dd82080ce..9a7b1ec88d34 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlVirtualNetworkRuleCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlVirtualNetworkRuleCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetsAVirtualNetworkRule() Console.WriteLine($"Succeeded: {result}"); } + // Gets a virtual network rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAVirtualNetworkRule() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/examples/VirtualNetworkRulesGet.json + // this example is just showing the usage of "VirtualNetworkRules_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "vnet-test-svr"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlVirtualNetworkRuleResource + MySqlVirtualNetworkRuleCollection collection = mySqlServer.GetMySqlVirtualNetworkRules(); + + // invoke the operation + string virtualNetworkRuleName = "vnet-firewall-rule"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkRuleName); + MySqlVirtualNetworkRuleResource 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 + MySqlVirtualNetworkRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a virtual network rule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlWaitStatisticCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlWaitStatisticCollection.cs index 4afbe8750042..bd21d5006dea 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlWaitStatisticCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlWaitStatisticCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -83,6 +84,49 @@ public async Task Exists_WaitStatisticsGet() Console.WriteLine($"Succeeded: {result}"); } + // WaitStatisticsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WaitStatisticsGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2018-06-01/examples/WaitStatisticsGet.json + // this example is just showing the usage of "WaitStatistics_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 MySqlServerResource created on azure + // for more information of creating MySqlServerResource, please refer to the document of MySqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testResourceGroupName"; + string serverName = "testServerName"; + ResourceIdentifier mySqlServerResourceId = MySqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlServerResource mySqlServer = client.GetMySqlServerResource(mySqlServerResourceId); + + // get the collection of this MySqlWaitStatisticResource + MySqlWaitStatisticCollection collection = mySqlServer.GetMySqlWaitStatistics(); + + // invoke the operation + string waitStatisticsId = "636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0"; + NullableResponse response = await collection.GetIfExistsAsync(waitStatisticsId); + MySqlWaitStatisticResource 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 + MySqlWaitStatisticData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WaitStatisticsListByServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorCollection.cs index 58b5e9b8b2dd..dfd110d59bed 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string advisorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName} + /// + /// + /// Operation Id + /// Advisors_Get + /// + /// + /// + /// The advisor name for recommendation action. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string advisorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName)); + + using var scope = _mySqlAdvisorAdvisorsClientDiagnostics.CreateScope("MySqlAdvisorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlAdvisorAdvisorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, advisorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlAdvisorResource(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.DBforMySQL/servers/{serverName}/advisors/{advisorName} + /// + /// + /// Operation Id + /// Advisors_Get + /// + /// + /// + /// The advisor name for recommendation action. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string advisorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName)); + + using var scope = _mySqlAdvisorAdvisorsClientDiagnostics.CreateScope("MySqlAdvisorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlAdvisorAdvisorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, advisorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlAdvisorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationCollection.cs index 83371abc5f22..7e7d25ffa717 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the server configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _mySqlConfigurationConfigurationsClientDiagnostics.CreateScope("MySqlConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlConfigurationConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlConfigurationResource(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.DBforMySQL/servers/{serverName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the server configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _mySqlConfigurationConfigurationsClientDiagnostics.CreateScope("MySqlConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlConfigurationConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseCollection.cs index 61d943f80ccd..07cb6b6b679f 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _mySqlDatabaseDatabasesClientDiagnostics.CreateScope("MySqlDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlDatabaseDatabasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlDatabaseResource(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.DBforMySQL/servers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _mySqlDatabaseDatabasesClientDiagnostics.CreateScope("MySqlDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlDatabaseDatabasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleCollection.cs index 01960bcfaa3b..65aeaee4384f 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the server firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _mySqlFirewallRuleFirewallRulesClientDiagnostics.CreateScope("MySqlFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFirewallRuleResource(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.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the server firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _mySqlFirewallRuleFirewallRulesClientDiagnostics.CreateScope("MySqlFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionCollection.cs index 43dae042572b..8ece6b28d1e2 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _mySqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("MySqlPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlPrivateEndpointConnectionResource(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.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _mySqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("MySqlPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceCollection.cs index 4c93f2a8efb1..c628908e9d70 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _mySqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("MySqlPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlPrivateLinkResource(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.DBforMySQL/servers/{serverName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _mySqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("MySqlPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticCollection.cs index d32caae8e1e4..7205ed6fbc15 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticCollection.cs @@ -247,5 +247,79 @@ public virtual Response Exists(string queryStatisticId, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/topQueryStatistics/{queryStatisticId} + /// + /// + /// Operation Id + /// TopQueryStatistics_Get + /// + /// + /// + /// The Query Statistic identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string queryStatisticId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queryStatisticId, nameof(queryStatisticId)); + + using var scope = _mySqlQueryStatisticTopQueryStatisticsClientDiagnostics.CreateScope("MySqlQueryStatisticCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlQueryStatisticTopQueryStatisticsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, queryStatisticId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlQueryStatisticResource(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.DBforMySQL/servers/{serverName}/topQueryStatistics/{queryStatisticId} + /// + /// + /// Operation Id + /// TopQueryStatistics_Get + /// + /// + /// + /// The Query Statistic identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string queryStatisticId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queryStatisticId, nameof(queryStatisticId)); + + using var scope = _mySqlQueryStatisticTopQueryStatisticsClientDiagnostics.CreateScope("MySqlQueryStatisticCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlQueryStatisticTopQueryStatisticsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, queryStatisticId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlQueryStatisticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextCollection.cs index e63a82999f30..4d5c330e5df7 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextCollection.cs @@ -247,5 +247,79 @@ public virtual Response Exists(string queryId, CancellationToken cancellat throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/queryTexts/{queryId} + /// + /// + /// Operation Id + /// QueryTexts_Get + /// + /// + /// + /// The Query-Store query identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string queryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queryId, nameof(queryId)); + + using var scope = _mySqlQueryTextQueryTextsClientDiagnostics.CreateScope("MySqlQueryTextCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlQueryTextQueryTextsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, queryId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlQueryTextResource(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.DBforMySQL/servers/{serverName}/queryTexts/{queryId} + /// + /// + /// Operation Id + /// QueryTexts_Get + /// + /// + /// + /// The Query-Store query identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string queryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queryId, nameof(queryId)); + + using var scope = _mySqlQueryTextQueryTextsClientDiagnostics.CreateScope("MySqlQueryTextCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlQueryTextQueryTextsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, queryId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlQueryTextResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionCollection.cs index 76b8e3321b7a..6fc85fa5f4b1 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string recommendedActionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName} + /// + /// + /// Operation Id + /// RecommendedActions_Get + /// + /// + /// + /// The recommended action name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recommendedActionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recommendedActionName, nameof(recommendedActionName)); + + using var scope = _mySqlRecommendationActionRecommendedActionsClientDiagnostics.CreateScope("MySqlRecommendationActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlRecommendationActionRecommendedActionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recommendedActionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlRecommendationActionResource(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.DBforMySQL/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName} + /// + /// + /// Operation Id + /// RecommendedActions_Get + /// + /// + /// + /// The recommended action name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recommendedActionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recommendedActionName, nameof(recommendedActionName)); + + using var scope = _mySqlRecommendationActionRecommendedActionsClientDiagnostics.CreateScope("MySqlRecommendationActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlRecommendationActionRecommendedActionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recommendedActionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlRecommendationActionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerCollection.cs index f0d3cd23b5fd..0c0683bb1de2 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerCollection.cs @@ -379,6 +379,80 @@ public virtual Response Exists(string serverName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _mySqlServerServersClientDiagnostics.CreateScope("MySqlServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlServerServersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlServerResource(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.DBforMySQL/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _mySqlServerServersClientDiagnostics.CreateScope("MySqlServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlServerServersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyCollection.cs index b7dab0c9a9fc..54cd2b58a198 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string keyName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys/{keyName} + /// + /// + /// Operation Id + /// ServerKeys_Get + /// + /// + /// + /// The name of the MySQL Server key to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _mySqlServerKeyServerKeysClientDiagnostics.CreateScope("MySqlServerKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlServerKeyServerKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlServerKeyResource(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.DBforMySQL/servers/{serverName}/keys/{keyName} + /// + /// + /// Operation Id + /// ServerKeys_Get + /// + /// + /// + /// The name of the MySQL Server key to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _mySqlServerKeyServerKeysClientDiagnostics.CreateScope("MySqlServerKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlServerKeyServerKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlServerKeyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyCollection.cs index 62bf5b72c064..250f3c20fe2e 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(MySqlSecurityAlertPolicyName securityAlertP } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ServerSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(MySqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _mySqlServerSecurityAlertPolicyServerSecurityAlertPoliciesClientDiagnostics.CreateScope("MySqlServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlServerSecurityAlertPolicyServerSecurityAlertPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlServerSecurityAlertPolicyResource(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.DBforMySQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ServerSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(MySqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _mySqlServerSecurityAlertPolicyServerSecurityAlertPoliciesClientDiagnostics.CreateScope("MySqlServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlServerSecurityAlertPolicyServerSecurityAlertPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlServerSecurityAlertPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleCollection.cs index 0bd196d986e4..52202f0df645 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string virtualNetworkRuleName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkRules_Get + /// + /// + /// + /// The name of the virtual network rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkRuleName, nameof(virtualNetworkRuleName)); + + using var scope = _mySqlVirtualNetworkRuleVirtualNetworkRulesClientDiagnostics.CreateScope("MySqlVirtualNetworkRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlVirtualNetworkRuleVirtualNetworkRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlVirtualNetworkRuleResource(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.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkRules_Get + /// + /// + /// + /// The name of the virtual network rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkRuleName, nameof(virtualNetworkRuleName)); + + using var scope = _mySqlVirtualNetworkRuleVirtualNetworkRulesClientDiagnostics.CreateScope("MySqlVirtualNetworkRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlVirtualNetworkRuleVirtualNetworkRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlVirtualNetworkRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticCollection.cs index 1b73dfd6d5f2..90e2e22167f8 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticCollection.cs @@ -247,5 +247,79 @@ public virtual Response Exists(string waitStatisticsId, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/waitStatistics/{waitStatisticsId} + /// + /// + /// Operation Id + /// WaitStatistics_Get + /// + /// + /// + /// The Wait Statistic identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string waitStatisticsId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(waitStatisticsId, nameof(waitStatisticsId)); + + using var scope = _mySqlWaitStatisticWaitStatisticsClientDiagnostics.CreateScope("MySqlWaitStatisticCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlWaitStatisticWaitStatisticsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, waitStatisticsId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlWaitStatisticResource(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.DBforMySQL/servers/{serverName}/waitStatistics/{waitStatisticsId} + /// + /// + /// Operation Id + /// WaitStatistics_Get + /// + /// + /// + /// The Wait Statistic identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string waitStatisticsId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(waitStatisticsId, nameof(waitStatisticsId)); + + using var scope = _mySqlWaitStatisticWaitStatisticsClientDiagnostics.CreateScope("MySqlWaitStatisticCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlWaitStatisticWaitStatisticsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, waitStatisticsId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlWaitStatisticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerAadAdministratorCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerAadAdministratorCollection.cs index a9e1c28352bb..05a797157128 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerAadAdministratorCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerAadAdministratorCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(MySqlFlexibleServerAdministratorName admini } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName} + /// + /// + /// Operation Id + /// AzureADAdministrators_Get + /// + /// + /// + /// The name of the Azure AD Administrator. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(MySqlFlexibleServerAdministratorName administratorName, CancellationToken cancellationToken = default) + { + using var scope = _mySqlFlexibleServerAadAdministratorAzureADAdministratorsClientDiagnostics.CreateScope("MySqlFlexibleServerAadAdministratorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServerAadAdministratorAzureADAdministratorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, administratorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerAadAdministratorResource(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.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName} + /// + /// + /// Operation Id + /// AzureADAdministrators_Get + /// + /// + /// + /// The name of the Azure AD Administrator. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(MySqlFlexibleServerAdministratorName administratorName, CancellationToken cancellationToken = default) + { + using var scope = _mySqlFlexibleServerAadAdministratorAzureADAdministratorsClientDiagnostics.CreateScope("MySqlFlexibleServerAadAdministratorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlFlexibleServerAadAdministratorAzureADAdministratorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, administratorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerAadAdministratorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerBackupCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerBackupCollection.cs index 10fb0d6ccf48..bb680db1d62d 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerBackupCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerBackupCollection.cs @@ -319,6 +319,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backups/{backupName} + /// + /// + /// Operation Id + /// Backups_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _mySqlFlexibleServerBackupBackupsClientDiagnostics.CreateScope("MySqlFlexibleServerBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServerBackupBackupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerBackupResource(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.DBforMySQL/flexibleServers/{serverName}/backups/{backupName} + /// + /// + /// Operation Id + /// Backups_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _mySqlFlexibleServerBackupBackupsClientDiagnostics.CreateScope("MySqlFlexibleServerBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlFlexibleServerBackupBackupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerCollection.cs index fb4feeb1d613..d207a8a44684 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerCollection.cs @@ -382,6 +382,80 @@ public virtual Response Exists(string serverName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _mySqlFlexibleServerServersClientDiagnostics.CreateScope("MySqlFlexibleServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServerServersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerResource(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.DBforMySQL/flexibleServers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _mySqlFlexibleServerServersClientDiagnostics.CreateScope("MySqlFlexibleServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlFlexibleServerServersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerConfigurationCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerConfigurationCollection.cs index d85d077e04ac..7c887e6c047d 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerConfigurationCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerConfigurationCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the server configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _mySqlFlexibleServerConfigurationConfigurationsClientDiagnostics.CreateScope("MySqlFlexibleServerConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServerConfigurationConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerConfigurationResource(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.DBforMySQL/flexibleServers/{serverName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the server configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _mySqlFlexibleServerConfigurationConfigurationsClientDiagnostics.CreateScope("MySqlFlexibleServerConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlFlexibleServerConfigurationConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerDatabaseCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerDatabaseCollection.cs index 02aff0e005b2..d4d0e6e2565b 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerDatabaseCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerDatabaseCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _mySqlFlexibleServerDatabaseDatabasesClientDiagnostics.CreateScope("MySqlFlexibleServerDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServerDatabaseDatabasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerDatabaseResource(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.DBforMySQL/flexibleServers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _mySqlFlexibleServerDatabaseDatabasesClientDiagnostics.CreateScope("MySqlFlexibleServerDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlFlexibleServerDatabaseDatabasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerFirewallRuleCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerFirewallRuleCollection.cs index 142f370b1eb8..bfa644ebc7bd 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerFirewallRuleCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerFirewallRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the server firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _mySqlFlexibleServerFirewallRuleFirewallRulesClientDiagnostics.CreateScope("MySqlFlexibleServerFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServerFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerFirewallRuleResource(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.DBforMySQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the server firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _mySqlFlexibleServerFirewallRuleFirewallRulesClientDiagnostics.CreateScope("MySqlFlexibleServerFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlFlexibleServerFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServerFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_CapacityPoolCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_CapacityPoolCollection.cs index ae5e3a07b506..af3b71ba0fbc 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_CapacityPoolCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_CapacityPoolCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PoolsGet() Console.WriteLine($"Succeeded: {result}"); } + // Pools_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PoolsGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/Pools_Get.json + // this example is just showing the usage of "Pools_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 NetAppAccountResource created on azure + // for more information of creating NetAppAccountResource, please refer to the document of NetAppAccountResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + ResourceIdentifier netAppAccountResourceId = NetAppAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + NetAppAccountResource netAppAccount = client.GetNetAppAccountResource(netAppAccountResourceId); + + // get the collection of this CapacityPoolResource + CapacityPoolCollection collection = netAppAccount.GetCapacityPools(); + + // invoke the operation + string poolName = "pool1"; + NullableResponse response = await collection.GetIfExistsAsync(poolName); + CapacityPoolResource 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 + CapacityPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Pools_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppAccountBackupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppAccountBackupCollection.cs index 296757f50d5b..f8afe25c92ab 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppAccountBackupCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppAccountBackupCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_AccountBackupsGet() Console.WriteLine($"Succeeded: {result}"); } + + // AccountBackups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AccountBackupsGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/Backups_Account_Get.json + // this example is just showing the usage of "AccountBackups_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 NetAppAccountResource created on azure + // for more information of creating NetAppAccountResource, please refer to the document of NetAppAccountResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + ResourceIdentifier netAppAccountResourceId = NetAppAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + NetAppAccountResource netAppAccount = client.GetNetAppAccountResource(netAppAccountResourceId); + + // get the collection of this NetAppAccountBackupResource + NetAppAccountBackupCollection collection = netAppAccount.GetNetAppAccountBackups(); + + // invoke the operation + string backupName = "backup1"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + NetAppAccountBackupResource 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 + NetAppBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppAccountCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppAccountCollection.cs index 65c69fc87b23..bef93705392a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppAccountCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppAccountCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_AccountsGet() Console.WriteLine($"Succeeded: {result}"); } + // Accounts_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AccountsGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/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 = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetAppAccountResource + NetAppAccountCollection collection = resourceGroupResource.GetNetAppAccounts(); + + // invoke the operation + string accountName = "account1"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + NetAppAccountResource 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 + NetAppAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Accounts_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppBackupPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppBackupPolicyCollection.cs index 6299a3000874..c4a67092ea3d 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppBackupPolicyCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppBackupPolicyCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_BackupsGet() Console.WriteLine($"Succeeded: {result}"); } + // Backups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_BackupsGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/BackupPolicies_Get.json + // this example is just showing the usage of "BackupPolicies_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 NetAppAccountResource created on azure + // for more information of creating NetAppAccountResource, please refer to the document of NetAppAccountResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + ResourceIdentifier netAppAccountResourceId = NetAppAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + NetAppAccountResource netAppAccount = client.GetNetAppAccountResource(netAppAccountResourceId); + + // get the collection of this NetAppBackupPolicyResource + NetAppBackupPolicyCollection collection = netAppAccount.GetNetAppBackupPolicies(); + + // invoke the operation + string backupPolicyName = "backupPolicyName"; + NullableResponse response = await collection.GetIfExistsAsync(backupPolicyName); + NetAppBackupPolicyResource 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 + NetAppBackupPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // BackupPolicies_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppSubvolumeInfoCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppSubvolumeInfoCollection.cs index cab9b19e6e07..ef77f89dab76 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppSubvolumeInfoCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppSubvolumeInfoCollection.cs @@ -126,6 +126,51 @@ public async Task Exists_SubvolumesGet() Console.WriteLine($"Succeeded: {result}"); } + // Subvolumes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubvolumesGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/Subvolumes_Get.json + // this example is just showing the usage of "Subvolumes_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 NetAppVolumeResource created on azure + // for more information of creating NetAppVolumeResource, please refer to the document of NetAppVolumeResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + string poolName = "pool1"; + string volumeName = "volume1"; + ResourceIdentifier netAppVolumeResourceId = NetAppVolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, poolName, volumeName); + NetAppVolumeResource netAppVolume = client.GetNetAppVolumeResource(netAppVolumeResourceId); + + // get the collection of this NetAppSubvolumeInfoResource + NetAppSubvolumeInfoCollection collection = netAppVolume.GetNetAppSubvolumeInfos(); + + // invoke the operation + string subvolumeName = "subvolume1"; + NullableResponse response = await collection.GetIfExistsAsync(subvolumeName); + NetAppSubvolumeInfoResource 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 + NetAppSubvolumeInfoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Subvolumes_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeBackupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeBackupCollection.cs index 9caa34ff4d0a..a48778f92b48 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeBackupCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeBackupCollection.cs @@ -126,6 +126,51 @@ public async Task Exists_BackupsGet() Console.WriteLine($"Succeeded: {result}"); } + // Backups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_BackupsGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/Backups_Get.json + // this example is just showing the usage of "Backups_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 NetAppVolumeResource created on azure + // for more information of creating NetAppVolumeResource, please refer to the document of NetAppVolumeResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + string poolName = "pool1"; + string volumeName = "volume1"; + ResourceIdentifier netAppVolumeResourceId = NetAppVolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, poolName, volumeName); + NetAppVolumeResource netAppVolume = client.GetNetAppVolumeResource(netAppVolumeResourceId); + + // get the collection of this NetAppVolumeBackupResource + NetAppVolumeBackupCollection collection = netAppVolume.GetNetAppVolumeBackups(); + + // invoke the operation + string backupName = "backup1"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + NetAppVolumeBackupResource 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 + NetAppBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Backups_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeCollection.cs index a328f368443d..a696c84c174e 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_VolumesGet() Console.WriteLine($"Succeeded: {result}"); } + // Volumes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumesGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/Volumes_Get.json + // this example is just showing the usage of "Volumes_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 CapacityPoolResource created on azure + // for more information of creating CapacityPoolResource, please refer to the document of CapacityPoolResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + string poolName = "pool1"; + ResourceIdentifier capacityPoolResourceId = CapacityPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, poolName); + CapacityPoolResource capacityPool = client.GetCapacityPoolResource(capacityPoolResourceId); + + // get the collection of this NetAppVolumeResource + NetAppVolumeCollection collection = capacityPool.GetNetAppVolumes(); + + // invoke the operation + string volumeName = "volume1"; + NullableResponse response = await collection.GetIfExistsAsync(volumeName); + NetAppVolumeResource 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 + NetAppVolumeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Volumes_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeGroupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeGroupCollection.cs index 3af01817da5e..0df037aaad38 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeGroupCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeGroupCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_VolumeGroupsGet() Console.WriteLine($"Succeeded: {result}"); } + // VolumeGroups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumeGroupsGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/VolumeGroups_Get.json + // this example is just showing the usage of "VolumeGroups_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 NetAppAccountResource created on azure + // for more information of creating NetAppAccountResource, please refer to the document of NetAppAccountResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + ResourceIdentifier netAppAccountResourceId = NetAppAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + NetAppAccountResource netAppAccount = client.GetNetAppAccountResource(netAppAccountResourceId); + + // get the collection of this NetAppVolumeGroupResource + NetAppVolumeGroupCollection collection = netAppAccount.GetNetAppVolumeGroups(); + + // invoke the operation + string volumeGroupName = "group1"; + NullableResponse response = await collection.GetIfExistsAsync(volumeGroupName); + NetAppVolumeGroupResource 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 + NetAppVolumeGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VolumeGroups_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeQuotaRuleCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeQuotaRuleCollection.cs index 3267321ec639..b82573376338 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeQuotaRuleCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeQuotaRuleCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_VolumeQuotaRulesGet() Console.WriteLine($"Succeeded: {result}"); } + // VolumeQuotaRules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumeQuotaRulesGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/VolumeQuotaRules_Get.json + // this example is just showing the usage of "VolumeQuotaRules_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 NetAppVolumeResource created on azure + // for more information of creating NetAppVolumeResource, please refer to the document of NetAppVolumeResource + string subscriptionId = "5275316f-a498-48d6-b324-2cbfdc4311b9"; + string resourceGroupName = "myRG"; + string accountName = "account-9957"; + string poolName = "pool-5210"; + string volumeName = "volume-6387"; + ResourceIdentifier netAppVolumeResourceId = NetAppVolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, poolName, volumeName); + NetAppVolumeResource netAppVolume = client.GetNetAppVolumeResource(netAppVolumeResourceId); + + // get the collection of this NetAppVolumeQuotaRuleResource + NetAppVolumeQuotaRuleCollection collection = netAppVolume.GetNetAppVolumeQuotaRules(); + + // invoke the operation + string volumeQuotaRuleName = "rule-0004"; + NullableResponse response = await collection.GetIfExistsAsync(volumeQuotaRuleName); + NetAppVolumeQuotaRuleResource 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 + NetAppVolumeQuotaRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VolumeQuotaRules_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeSnapshotCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeSnapshotCollection.cs index b3feb7cb0fb3..2e3537cbd65e 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeSnapshotCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_NetAppVolumeSnapshotCollection.cs @@ -126,6 +126,51 @@ public async Task Exists_SnapshotsGet() Console.WriteLine($"Succeeded: {result}"); } + // Snapshots_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SnapshotsGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/Snapshots_Get.json + // this example is just showing the usage of "Snapshots_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 NetAppVolumeResource created on azure + // for more information of creating NetAppVolumeResource, please refer to the document of NetAppVolumeResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + string poolName = "pool1"; + string volumeName = "volume1"; + ResourceIdentifier netAppVolumeResourceId = NetAppVolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, poolName, volumeName); + NetAppVolumeResource netAppVolume = client.GetNetAppVolumeResource(netAppVolumeResourceId); + + // get the collection of this NetAppVolumeSnapshotResource + NetAppVolumeSnapshotCollection collection = netAppVolume.GetNetAppVolumeSnapshots(); + + // invoke the operation + string snapshotName = "snapshot1"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotName); + NetAppVolumeSnapshotResource 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 + NetAppVolumeSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Snapshots_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_SnapshotPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_SnapshotPolicyCollection.cs index fbc6bfd325e0..a2924afd6198 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_SnapshotPolicyCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/samples/Generated/Samples/Sample_SnapshotPolicyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_SnapshotPoliciesGet() Console.WriteLine($"Succeeded: {result}"); } + // SnapshotPolicies_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SnapshotPoliciesGet() + { + // Generated from example definition: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-11-01/examples/SnapshotPolicies_Get.json + // this example is just showing the usage of "SnapshotPolicies_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 NetAppAccountResource created on azure + // for more information of creating NetAppAccountResource, please refer to the document of NetAppAccountResource + string subscriptionId = "D633CC2E-722B-4AE1-B636-BBD9E4C60ED9"; + string resourceGroupName = "myRG"; + string accountName = "account1"; + ResourceIdentifier netAppAccountResourceId = NetAppAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + NetAppAccountResource netAppAccount = client.GetNetAppAccountResource(netAppAccountResourceId); + + // get the collection of this SnapshotPolicyResource + SnapshotPolicyCollection collection = netAppAccount.GetSnapshotPolicies(); + + // invoke the operation + string snapshotPolicyName = "snapshotPolicyName"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotPolicyName); + SnapshotPolicyResource 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 + SnapshotPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SnapshotPolicies_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolCollection.cs index aa776fab595b..d498c4a9f44c 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string poolName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// + /// + /// Operation Id + /// Pools_Get + /// + /// + /// + /// The name of the capacity pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _capacityPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapacityPoolResource(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.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// + /// + /// Operation Id + /// Pools_Get + /// + /// + /// + /// The name of the capacity pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _capacityPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountBackupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountBackupCollection.cs index 496ef471d544..e24b8d3a9bb6 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountBackupCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountBackupCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName} + /// + /// + /// Operation Id + /// AccountBackups_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _netAppAccountBackupAccountBackupsClientDiagnostics.CreateScope("NetAppAccountBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppAccountBackupAccountBackupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppAccountBackupResource(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.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName} + /// + /// + /// Operation Id + /// AccountBackups_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _netAppAccountBackupAccountBackupsClientDiagnostics.CreateScope("NetAppAccountBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppAccountBackupAccountBackupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppAccountBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountCollection.cs index 3e3a5a2900d9..8e313c19beb3 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the NetApp 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppAccountResource(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.NetApp/netAppAccounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the NetApp account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyCollection.cs index 083d8e57718c..28b8a33df07f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string backupPolicyName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} + /// + /// + /// Operation Id + /// BackupPolicies_Get + /// + /// + /// + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppBackupPolicyResource(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.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} + /// + /// + /// Operation Id + /// BackupPolicies_Get + /// + /// + /// + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoCollection.cs index f9299d1e957a..4e43e30b32a6 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string subvolumeName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} + /// + /// + /// Operation Id + /// Subvolumes_Get + /// + /// + /// + /// The name of the subvolume. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppSubvolumeInfoSubvolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppSubvolumeInfoResource(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.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} + /// + /// + /// Operation Id + /// Subvolumes_Get + /// + /// + /// + /// The name of the subvolume. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppSubvolumeInfoSubvolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppSubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeBackupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeBackupCollection.cs index 3ef528afa980..f23ab157c61e 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeBackupCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeBackupCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName} + /// + /// + /// Operation Id + /// Backups_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _netAppVolumeBackupBackupsClientDiagnostics.CreateScope("NetAppVolumeBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppVolumeBackupBackupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeBackupResource(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.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName} + /// + /// + /// Operation Id + /// Backups_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _netAppVolumeBackupBackupsClientDiagnostics.CreateScope("NetAppVolumeBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppVolumeBackupBackupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeCollection.cs index 0811c4f13f9f..cc0c1411b2f3 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string volumeName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} + /// + /// + /// Operation Id + /// Volumes_Get + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeResource(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.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} + /// + /// + /// Operation Id + /// Volumes_Get + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupCollection.cs index 84b2c9ff4b89..a8febfcc2633 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string volumeGroupName, CancellationToken c throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} + /// + /// + /// Operation Id + /// VolumeGroups_Get + /// + /// + /// + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeGroupResource(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.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} + /// + /// + /// Operation Id + /// VolumeGroups_Get + /// + /// + /// + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleCollection.cs index bed1385fbde8..6eb636a08e79 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string volumeQuotaRuleName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} + /// + /// + /// Operation Id + /// VolumeQuotaRules_Get + /// + /// + /// + /// The name of volume quota rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeQuotaRuleResource(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.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} + /// + /// + /// Operation Id + /// VolumeQuotaRules_Get + /// + /// + /// + /// The name of volume quota rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotCollection.cs index ed6cc8ac185f..9ae503676b34 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string snapshotName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the snapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _netAppVolumeSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeSnapshotResource(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.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the snapshot. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _netAppVolumeSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetAppVolumeSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyCollection.cs index ad55a3e14923..6aa1531cf93b 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string snapshotPolicyName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// + /// + /// Operation Id + /// SnapshotPolicies_Get + /// + /// + /// + /// The name of the snapshot policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _snapshotPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SnapshotPolicyResource(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.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// + /// + /// Operation Id + /// SnapshotPolicies_Get + /// + /// + /// + /// The name of the snapshot policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _snapshotPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AdminRuleGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AdminRuleGroupCollection.cs index 4e9d013aa2bf..2afbdb9d2218 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AdminRuleGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AdminRuleGroupCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetsSecurityAdminRuleCollection() Console.WriteLine($"Succeeded: {result}"); } + // Gets security admin rule collection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsSecurityAdminRuleCollection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerAdminRuleCollectionGet.json + // this example is just showing the usage of "AdminRuleCollections_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 SecurityAdminConfigurationResource created on azure + // for more information of creating SecurityAdminConfigurationResource, please refer to the document of SecurityAdminConfigurationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string networkManagerName = "testNetworkManager"; + string configurationName = "myTestSecurityConfig"; + ResourceIdentifier securityAdminConfigurationResourceId = SecurityAdminConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkManagerName, configurationName); + SecurityAdminConfigurationResource securityAdminConfiguration = client.GetSecurityAdminConfigurationResource(securityAdminConfigurationResourceId); + + // get the collection of this AdminRuleGroupResource + AdminRuleGroupCollection collection = securityAdminConfiguration.GetAdminRuleGroups(); + + // invoke the operation + string ruleCollectionName = "testRuleCollection"; + NullableResponse response = await collection.GetIfExistsAsync(ruleCollectionName); + AdminRuleGroupResource 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 + AdminRuleGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update an admin rule collection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayCollection.cs index 0212dd7f9a96..f1d506a4aee9 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayCollection.cs @@ -85,6 +85,48 @@ public async Task Exists_GetApplicationGateway() Console.WriteLine($"Succeeded: {result}"); } + // Get ApplicationGateway + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetApplicationGateway() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ApplicationGatewayGet.json + // this example is just showing the usage of "ApplicationGateways_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApplicationGatewayResource + ApplicationGatewayCollection collection = resourceGroupResource.GetApplicationGateways(); + + // invoke the operation + string applicationGatewayName = "appgw"; + NullableResponse response = await collection.GetIfExistsAsync(applicationGatewayName); + ApplicationGatewayResource 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 + ApplicationGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Application Gateway [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayPrivateEndpointConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayPrivateEndpointConnectionCollection.cs index 77a5784856e7..ac8a6a409f85 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayPrivateEndpointConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayPrivateEndpointConnectionCollection.cs @@ -129,6 +129,49 @@ public async Task Exists_GetApplicationGatewayPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get Application Gateway Private Endpoint Connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetApplicationGatewayPrivateEndpointConnection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ApplicationGatewayPrivateEndpointConnectionGet.json + // this example is just showing the usage of "ApplicationGatewayPrivateEndpointConnections_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 ApplicationGatewayResource created on azure + // for more information of creating ApplicationGatewayResource, please refer to the document of ApplicationGatewayResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string applicationGatewayName = "appgw"; + ResourceIdentifier applicationGatewayResourceId = ApplicationGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, applicationGatewayName); + ApplicationGatewayResource applicationGateway = client.GetApplicationGatewayResource(applicationGatewayResourceId); + + // get the collection of this ApplicationGatewayPrivateEndpointConnectionResource + ApplicationGatewayPrivateEndpointConnectionCollection collection = applicationGateway.GetApplicationGatewayPrivateEndpointConnections(); + + // invoke the operation + string connectionName = "connection1"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + ApplicationGatewayPrivateEndpointConnectionResource 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 + ApplicationGatewayPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Lists all private endpoint connections on application gateway [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayWafDynamicManifestCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayWafDynamicManifestCollection.cs index 5b4f15546466..2a53e0a4f645 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayWafDynamicManifestCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationGatewayWafDynamicManifestCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -79,6 +80,47 @@ public async Task Exists_GetsWAFDefaultManifest() Console.WriteLine($"Succeeded: {result}"); } + // Gets WAF default manifest + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsWAFDefaultManifest() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/GetApplicationGatewayWafDynamicManifestsDefault.json + // this example is just showing the usage of "ApplicationGatewayWafDynamicManifestsDefault_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ApplicationGatewayWafDynamicManifestResource + AzureLocation location = new AzureLocation("westus"); + ApplicationGatewayWafDynamicManifestCollection collection = subscriptionResource.GetApplicationGatewayWafDynamicManifests(location); + + // invoke the operation + NullableResponse response = await collection.GetIfExistsAsync(); + ApplicationGatewayWafDynamicManifestResource 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 + ApplicationGatewayWafDynamicManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets WAF manifests [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationSecurityGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationSecurityGroupCollection.cs index 1c987be34cb7..a944bf7e09c4 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationSecurityGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ApplicationSecurityGroupCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetApplicationSecurityGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get application security group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetApplicationSecurityGroup() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ApplicationSecurityGroupGet.json + // this example is just showing the usage of "ApplicationSecurityGroups_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApplicationSecurityGroupResource + ApplicationSecurityGroupCollection collection = resourceGroupResource.GetApplicationSecurityGroups(); + + // invoke the operation + string applicationSecurityGroupName = "test-asg"; + NullableResponse response = await collection.GetIfExistsAsync(applicationSecurityGroupName); + ApplicationSecurityGroupResource 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 + ApplicationSecurityGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create application security group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AzureFirewallCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AzureFirewallCollection.cs index b3e533ce64fc..6bebd0fe61ad 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AzureFirewallCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AzureFirewallCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetAzureFirewall() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure Firewall + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureFirewall() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/AzureFirewallGet.json + // this example is just showing the usage of "AzureFirewalls_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureFirewallResource + AzureFirewallCollection collection = resourceGroupResource.GetAzureFirewalls(); + + // invoke the operation + string azureFirewallName = "azurefirewall"; + NullableResponse response = await collection.GetIfExistsAsync(azureFirewallName); + AzureFirewallResource 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 + AzureFirewallData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Azure Firewall With Additional Properties [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -147,6 +189,48 @@ public async Task Exists_GetAzureFirewallWithAdditionalProperties() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure Firewall With Additional Properties + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureFirewallWithAdditionalProperties() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/AzureFirewallGetWithAdditionalProperties.json + // this example is just showing the usage of "AzureFirewalls_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureFirewallResource + AzureFirewallCollection collection = resourceGroupResource.GetAzureFirewalls(); + + // invoke the operation + string azureFirewallName = "azurefirewall"; + NullableResponse response = await collection.GetIfExistsAsync(azureFirewallName); + AzureFirewallResource 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 + AzureFirewallData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Azure Firewall With IpGroups [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -211,6 +295,48 @@ public async Task Exists_GetAzureFirewallWithIpGroups() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure Firewall With IpGroups + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureFirewallWithIpGroups() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/AzureFirewallGetWithIpGroups.json + // this example is just showing the usage of "AzureFirewalls_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureFirewallResource + AzureFirewallCollection collection = resourceGroupResource.GetAzureFirewalls(); + + // invoke the operation + string azureFirewallName = "azurefirewall"; + NullableResponse response = await collection.GetIfExistsAsync(azureFirewallName); + AzureFirewallResource 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 + AzureFirewallData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Azure Firewall With Zones [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -275,6 +401,48 @@ public async Task Exists_GetAzureFirewallWithZones() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure Firewall With Zones + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureFirewallWithZones() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/AzureFirewallGetWithZones.json + // this example is just showing the usage of "AzureFirewalls_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureFirewallResource + AzureFirewallCollection collection = resourceGroupResource.GetAzureFirewalls(); + + // invoke the operation + string azureFirewallName = "azurefirewall"; + NullableResponse response = await collection.GetIfExistsAsync(azureFirewallName); + AzureFirewallResource 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 + AzureFirewallData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Azure Firewall With management subnet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -339,6 +507,48 @@ public async Task Exists_GetAzureFirewallWithManagementSubnet() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure Firewall With management subnet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureFirewallWithManagementSubnet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/AzureFirewallGetWithMgmtSubnet.json + // this example is just showing the usage of "AzureFirewalls_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureFirewallResource + AzureFirewallCollection collection = resourceGroupResource.GetAzureFirewalls(); + + // invoke the operation + string azureFirewallName = "azurefirewall"; + NullableResponse response = await collection.GetIfExistsAsync(azureFirewallName); + AzureFirewallResource 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 + AzureFirewallData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Azure Firewall [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AzureWebCategoryCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AzureWebCategoryCollection.cs index 910e687242f3..e8ed02129462 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AzureWebCategoryCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_AzureWebCategoryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -79,6 +80,47 @@ public async Task Exists_GetAzureWebCategoryByName() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure Web Category by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureWebCategoryByName() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/AzureWebCategoryGet.json + // this example is just showing the usage of "WebCategories_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "4de8428a-4a92-4cea-90ff-b47128b8cab8"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this AzureWebCategoryResource + AzureWebCategoryCollection collection = subscriptionResource.GetAzureWebCategories(); + + // invoke the operation + string name = "Arts"; + NullableResponse response = await collection.GetIfExistsAsync(name); + AzureWebCategoryResource 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 + AzureWebCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all Azure Web Categories for a given subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BackendAddressPoolCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BackendAddressPoolCollection.cs index 24b0babfa21b..0c2815e70d4d 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BackendAddressPoolCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BackendAddressPoolCollection.cs @@ -158,6 +158,49 @@ public async Task Exists_LoadBalancerWithBackendAddressPoolWithBackendAddresses( Console.WriteLine($"Succeeded: {result}"); } + // LoadBalancer with BackendAddressPool with BackendAddresses + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LoadBalancerWithBackendAddressPoolWithBackendAddresses() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LBBackendAddressPoolWithBackendAddressesGet.json + // this example is just showing the usage of "LoadBalancerBackendAddressPools_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 LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string loadBalancerName = "lb"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // get the collection of this BackendAddressPoolResource + BackendAddressPoolCollection collection = loadBalancer.GetBackendAddressPools(); + + // invoke the operation + string backendAddressPoolName = "backend"; + NullableResponse response = await collection.GetIfExistsAsync(backendAddressPoolName); + BackendAddressPoolResource 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 + BackendAddressPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // LoadBalancerBackendAddressPoolGet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -224,6 +267,49 @@ public async Task Exists_LoadBalancerBackendAddressPoolGet() Console.WriteLine($"Succeeded: {result}"); } + // LoadBalancerBackendAddressPoolGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LoadBalancerBackendAddressPoolGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LoadBalancerBackendAddressPoolGet.json + // this example is just showing the usage of "LoadBalancerBackendAddressPools_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 LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string loadBalancerName = "lb"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // get the collection of this BackendAddressPoolResource + BackendAddressPoolCollection collection = loadBalancer.GetBackendAddressPools(); + + // invoke the operation + string backendAddressPoolName = "backend"; + NullableResponse response = await collection.GetIfExistsAsync(backendAddressPoolName); + BackendAddressPoolResource 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 + BackendAddressPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update load balancer backend pool with backend addresses containing virtual network and IP address. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BaseAdminRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BaseAdminRuleCollection.cs index 6cb8f43e354c..182b2c650871 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BaseAdminRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BaseAdminRuleCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_GetsSecurityAdminRule() Console.WriteLine($"Succeeded: {result}"); } + // Gets security admin rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsSecurityAdminRule() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerAdminRuleGet.json + // this example is just showing the usage of "AdminRules_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 AdminRuleGroupResource created on azure + // for more information of creating AdminRuleGroupResource, please refer to the document of AdminRuleGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string networkManagerName = "testNetworkManager"; + string configurationName = "myTestSecurityConfig"; + string ruleCollectionName = "testRuleCollection"; + ResourceIdentifier adminRuleGroupResourceId = AdminRuleGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkManagerName, configurationName, ruleCollectionName); + AdminRuleGroupResource adminRuleGroup = client.GetAdminRuleGroupResource(adminRuleGroupResourceId); + + // get the collection of this BaseAdminRuleResource + BaseAdminRuleCollection collection = adminRuleGroup.GetBaseAdminRules(); + + // invoke the operation + string ruleName = "SampleAdminRule"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + BaseAdminRuleResource 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 + BaseAdminRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets security default admin rule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -197,6 +242,51 @@ public async Task Exists_GetsSecurityDefaultAdminRule() Console.WriteLine($"Succeeded: {result}"); } + // Gets security default admin rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsSecurityDefaultAdminRule() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerDefaultAdminRuleGet.json + // this example is just showing the usage of "AdminRules_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 AdminRuleGroupResource created on azure + // for more information of creating AdminRuleGroupResource, please refer to the document of AdminRuleGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string networkManagerName = "testNetworkManager"; + string configurationName = "myTestSecurityConfig"; + string ruleCollectionName = "testRuleCollection"; + ResourceIdentifier adminRuleGroupResourceId = AdminRuleGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkManagerName, configurationName, ruleCollectionName); + AdminRuleGroupResource adminRuleGroup = client.GetAdminRuleGroupResource(adminRuleGroupResourceId); + + // get the collection of this BaseAdminRuleResource + BaseAdminRuleCollection collection = adminRuleGroup.GetBaseAdminRules(); + + // invoke the operation + string ruleName = "SampleDefaultAdminRule"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + BaseAdminRuleResource 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 + BaseAdminRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a default admin rule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BastionHostCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BastionHostCollection.cs index da8b7b493b2e..c09573a6673c 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BastionHostCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BastionHostCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetBastionHost() Console.WriteLine($"Succeeded: {result}"); } + // Get Bastion Host + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBastionHost() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/BastionHostGet.json + // this example is just showing the usage of "BastionHosts_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BastionHostResource + BastionHostCollection collection = resourceGroupResource.GetBastionHosts(); + + // invoke the operation + string bastionHostName = "bastionhosttenant'"; + NullableResponse response = await collection.GetIfExistsAsync(bastionHostName); + BastionHostResource 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 + BastionHostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Developer Bastion Host [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -147,6 +189,48 @@ public async Task Exists_GetDeveloperBastionHost() Console.WriteLine($"Succeeded: {result}"); } + // Get Developer Bastion Host + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDeveloperBastionHost() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/BastionHostDeveloperGet.json + // this example is just showing the usage of "BastionHosts_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BastionHostResource + BastionHostCollection collection = resourceGroupResource.GetBastionHosts(); + + // invoke the operation + string bastionHostName = "bastionhostdeveloper'"; + NullableResponse response = await collection.GetIfExistsAsync(bastionHostName); + BastionHostResource 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 + BastionHostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Bastion Host [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BgpConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BgpConnectionCollection.cs index 8c4ce3591254..ab8ea3a38b59 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BgpConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_BgpConnectionCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_VirtualHubVirtualHubRouteTableV2Get() Console.WriteLine($"Succeeded: {result}"); } + // VirtualHubVirtualHubRouteTableV2Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualHubVirtualHubRouteTableV2Get() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualHubBgpConnectionGet.json + // this example is just showing the usage of "VirtualHubBgpConnection_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 VirtualHubResource created on azure + // for more information of creating VirtualHubResource, please refer to the document of VirtualHubResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualHubName = "hub1"; + ResourceIdentifier virtualHubResourceId = VirtualHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualHubName); + VirtualHubResource virtualHub = client.GetVirtualHubResource(virtualHubResourceId); + + // get the collection of this BgpConnectionResource + BgpConnectionCollection collection = virtualHub.GetBgpConnections(); + + // invoke the operation + string connectionName = "conn1"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + BgpConnectionResource 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 + BgpConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualHubRouteTableV2Put [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_CloudServiceSwapCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_CloudServiceSwapCollection.cs index 9b9684674bc7..ed82c9e8937f 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_CloudServiceSwapCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_CloudServiceSwapCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetSwapResource() Console.WriteLine($"Succeeded: {result}"); } + // Get swap resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSwapResource() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/CloudServiceSwapGet.json + // this example is just showing the usage of "VipSwap_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 = "subid"; + string groupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, groupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CloudServiceSwapResource + string resourceName = "testCloudService"; + CloudServiceSwapCollection collection = resourceGroupResource.GetCloudServiceSwaps(resourceName); + + // invoke the operation + NullableResponse response = await collection.GetIfExistsAsync(); + CloudServiceSwapResource 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 + CloudServiceSwapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put vip swap operation. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ConnectionMonitorCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ConnectionMonitorCollection.cs index 0ea55c1a44ba..3f21ee9372d8 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ConnectionMonitorCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ConnectionMonitorCollection.cs @@ -256,6 +256,49 @@ public async Task Exists_GetConnectionMonitor() Console.WriteLine($"Succeeded: {result}"); } + // Get connection monitor + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConnectionMonitor() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkWatcherConnectionMonitorGet.json + // this example is just showing the usage of "ConnectionMonitors_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 NetworkWatcherResource created on azure + // for more information of creating NetworkWatcherResource, please refer to the document of NetworkWatcherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string networkWatcherName = "nw1"; + ResourceIdentifier networkWatcherResourceId = NetworkWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkWatcherName); + NetworkWatcherResource networkWatcher = client.GetNetworkWatcherResource(networkWatcherResourceId); + + // get the collection of this ConnectionMonitorResource + ConnectionMonitorCollection collection = networkWatcher.GetConnectionMonitors(); + + // invoke the operation + string connectionMonitorName = "cm1"; + NullableResponse response = await collection.GetIfExistsAsync(connectionMonitorName); + ConnectionMonitorResource 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 + ConnectionMonitorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List connection monitors [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ConnectivityConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ConnectivityConfigurationCollection.cs index 7160ca7ede97..758d0ce802cd 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ConnectivityConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ConnectivityConfigurationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ConnectivityConfigurationsGet() Console.WriteLine($"Succeeded: {result}"); } + // ConnectivityConfigurationsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConnectivityConfigurationsGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerConnectivityConfigurationGet.json + // this example is just showing the usage of "ConnectivityConfigurations_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 NetworkManagerResource created on azure + // for more information of creating NetworkManagerResource, please refer to the document of NetworkManagerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string networkManagerName = "testNetworkManager"; + ResourceIdentifier networkManagerResourceId = NetworkManagerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkManagerName); + NetworkManagerResource networkManager = client.GetNetworkManagerResource(networkManagerResourceId); + + // get the collection of this ConnectivityConfigurationResource + ConnectivityConfigurationCollection collection = networkManager.GetConnectivityConfigurations(); + + // invoke the operation + string configurationName = "myTestConnectivityConfig"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + ConnectivityConfigurationResource 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 + ConnectivityConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConnectivityConfigurationsPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_CustomIPPrefixCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_CustomIPPrefixCollection.cs index 9d38e3b468da..60a6e70e3bab 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_CustomIPPrefixCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_CustomIPPrefixCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetCustomIPPrefix() Console.WriteLine($"Succeeded: {result}"); } + // Get custom IP prefix + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCustomIPPrefix() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/CustomIpPrefixGet.json + // this example is just showing the usage of "CustomIPPrefixes_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CustomIPPrefixResource + CustomIPPrefixCollection collection = resourceGroupResource.GetCustomIPPrefixes(); + + // invoke the operation + string customIPPrefixName = "test-customipprefix"; + NullableResponse response = await collection.GetIfExistsAsync(customIPPrefixName); + CustomIPPrefixResource 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 + CustomIPPrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create custom IP prefix allocation method [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DdosCustomPolicyCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DdosCustomPolicyCollection.cs index 80616b20a5f6..8a0816810f9e 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DdosCustomPolicyCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DdosCustomPolicyCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetDDoSCustomPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get DDoS custom policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDDoSCustomPolicy() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/DdosCustomPolicyGet.json + // this example is just showing the usage of "DdosCustomPolicies_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DdosCustomPolicyResource + DdosCustomPolicyCollection collection = resourceGroupResource.GetDdosCustomPolicies(); + + // invoke the operation + string ddosCustomPolicyName = "test-ddos-custom-policy"; + NullableResponse response = await collection.GetIfExistsAsync(ddosCustomPolicyName); + DdosCustomPolicyResource 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 + DdosCustomPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create DDoS custom policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DdosProtectionPlanCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DdosProtectionPlanCollection.cs index 65f8cb802042..1c4cf466faf3 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DdosProtectionPlanCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DdosProtectionPlanCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetDDoSProtectionPlan() Console.WriteLine($"Succeeded: {result}"); } + // Get DDoS protection plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDDoSProtectionPlan() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/DdosProtectionPlanGet.json + // this example is just showing the usage of "DdosProtectionPlans_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DdosProtectionPlanResource + DdosProtectionPlanCollection collection = resourceGroupResource.GetDdosProtectionPlans(); + + // invoke the operation + string ddosProtectionPlanName = "test-plan"; + NullableResponse response = await collection.GetIfExistsAsync(ddosProtectionPlanName); + DdosProtectionPlanResource 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 + DdosProtectionPlanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create DDoS protection plan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DefaultSecurityRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DefaultSecurityRuleCollection.cs index aab5a91567c6..74a822e210ee 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DefaultSecurityRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DefaultSecurityRuleCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_DefaultSecurityRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // DefaultSecurityRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DefaultSecurityRuleGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/DefaultSecurityRuleGet.json + // this example is just showing the usage of "DefaultSecurityRules_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 NetworkSecurityGroupResource created on azure + // for more information of creating NetworkSecurityGroupResource, please refer to the document of NetworkSecurityGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string networkSecurityGroupName = "nsg1"; + ResourceIdentifier networkSecurityGroupResourceId = NetworkSecurityGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkSecurityGroupName); + NetworkSecurityGroupResource networkSecurityGroup = client.GetNetworkSecurityGroupResource(networkSecurityGroupResourceId); + + // get the collection of this DefaultSecurityRuleResource + DefaultSecurityRuleCollection collection = networkSecurityGroup.GetDefaultSecurityRules(); + + // invoke the operation + string defaultSecurityRuleName = "AllowVnetInBound"; + NullableResponse response = await collection.GetIfExistsAsync(defaultSecurityRuleName); + DefaultSecurityRuleResource 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 + SecurityRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DscpConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DscpConfigurationCollection.cs index e5cf7092725e..aa1f63db7fca 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DscpConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_DscpConfigurationCollection.cs @@ -208,6 +208,48 @@ public async Task Exists_GetDscpConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get Dscp Configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDscpConfiguration() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/DscpConfigurationGet.json + // this example is just showing the usage of "DscpConfiguration_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DscpConfigurationResource + DscpConfigurationCollection collection = resourceGroupResource.GetDscpConfigurations(); + + // invoke the operation + string dscpConfigurationName = "mydscpConfig"; + NullableResponse response = await collection.GetIfExistsAsync(dscpConfigurationName); + DscpConfigurationResource 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 + DscpConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Dscp Configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitAuthorizationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitAuthorizationCollection.cs index 753408b47729..fc0b92ee312c 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitAuthorizationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitAuthorizationCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetExpressRouteCircuitAuthorization() Console.WriteLine($"Succeeded: {result}"); } + // Get ExpressRouteCircuit Authorization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExpressRouteCircuitAuthorization() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteCircuitAuthorizationGet.json + // this example is just showing the usage of "ExpressRouteCircuitAuthorizations_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 ExpressRouteCircuitResource created on azure + // for more information of creating ExpressRouteCircuitResource, please refer to the document of ExpressRouteCircuitResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string circuitName = "circuitName"; + ResourceIdentifier expressRouteCircuitResourceId = ExpressRouteCircuitResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, circuitName); + ExpressRouteCircuitResource expressRouteCircuit = client.GetExpressRouteCircuitResource(expressRouteCircuitResourceId); + + // get the collection of this ExpressRouteCircuitAuthorizationResource + ExpressRouteCircuitAuthorizationCollection collection = expressRouteCircuit.GetExpressRouteCircuitAuthorizations(); + + // invoke the operation + string authorizationName = "authorizationName"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationName); + ExpressRouteCircuitAuthorizationResource 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 + ExpressRouteCircuitAuthorizationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create ExpressRouteCircuit Authorization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitCollection.cs index 307b6cf3da38..a91c17864d79 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetExpressRouteCircuit() Console.WriteLine($"Succeeded: {result}"); } + // Get ExpressRouteCircuit + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExpressRouteCircuit() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteCircuitGet.json + // this example is just showing the usage of "ExpressRouteCircuits_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ExpressRouteCircuitResource + ExpressRouteCircuitCollection collection = resourceGroupResource.GetExpressRouteCircuits(); + + // invoke the operation + string circuitName = "circuitName"; + NullableResponse response = await collection.GetIfExistsAsync(circuitName); + ExpressRouteCircuitResource 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 + ExpressRouteCircuitData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create ExpressRouteCircuit [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitConnectionCollection.cs index 7306b3c27e65..6c8c34b5be0c 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitConnectionCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_ExpressRouteCircuitConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // ExpressRouteCircuitConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExpressRouteCircuitConnectionGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteCircuitConnectionGet.json + // this example is just showing the usage of "ExpressRouteCircuitConnections_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 ExpressRouteCircuitPeeringResource created on azure + // for more information of creating ExpressRouteCircuitPeeringResource, please refer to the document of ExpressRouteCircuitPeeringResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string circuitName = "ExpressRouteARMCircuitA"; + string peeringName = "AzurePrivatePeering"; + ResourceIdentifier expressRouteCircuitPeeringResourceId = ExpressRouteCircuitPeeringResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, circuitName, peeringName); + ExpressRouteCircuitPeeringResource expressRouteCircuitPeering = client.GetExpressRouteCircuitPeeringResource(expressRouteCircuitPeeringResourceId); + + // get the collection of this ExpressRouteCircuitConnectionResource + ExpressRouteCircuitConnectionCollection collection = expressRouteCircuitPeering.GetExpressRouteCircuitConnections(); + + // invoke the operation + string connectionName = "circuitConnectionUSAUS"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + ExpressRouteCircuitConnectionResource 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 + ExpressRouteCircuitConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExpressRouteCircuitConnectionCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitPeeringCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitPeeringCollection.cs index 8856f0d56307..b1c3f3a31de6 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitPeeringCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCircuitPeeringCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetExpressRouteCircuitPeering() Console.WriteLine($"Succeeded: {result}"); } + // Get ExpressRouteCircuit Peering + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExpressRouteCircuitPeering() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteCircuitPeeringGet.json + // this example is just showing the usage of "ExpressRouteCircuitPeerings_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 ExpressRouteCircuitResource created on azure + // for more information of creating ExpressRouteCircuitResource, please refer to the document of ExpressRouteCircuitResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string circuitName = "circuitName"; + ResourceIdentifier expressRouteCircuitResourceId = ExpressRouteCircuitResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, circuitName); + ExpressRouteCircuitResource expressRouteCircuit = client.GetExpressRouteCircuitResource(expressRouteCircuitResourceId); + + // get the collection of this ExpressRouteCircuitPeeringResource + ExpressRouteCircuitPeeringCollection collection = expressRouteCircuit.GetExpressRouteCircuitPeerings(); + + // invoke the operation + string peeringName = "MicrosoftPeering"; + NullableResponse response = await collection.GetIfExistsAsync(peeringName); + ExpressRouteCircuitPeeringResource 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 + ExpressRouteCircuitPeeringData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create ExpressRouteCircuit Peerings [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteConnectionCollection.cs index f8e893f29e87..de228075f1ed 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteConnectionCollection.cs @@ -155,6 +155,49 @@ public async Task Exists_ExpressRouteConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // ExpressRouteConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExpressRouteConnectionGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteConnectionGet.json + // this example is just showing the usage of "ExpressRouteConnections_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 ExpressRouteGatewayResource created on azure + // for more information of creating ExpressRouteGatewayResource, please refer to the document of ExpressRouteGatewayResource + string subscriptionId = "subid"; + string resourceGroupName = "resourceGroupName"; + string expressRouteGatewayName = "expressRouteGatewayName"; + ResourceIdentifier expressRouteGatewayResourceId = ExpressRouteGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, expressRouteGatewayName); + ExpressRouteGatewayResource expressRouteGateway = client.GetExpressRouteGatewayResource(expressRouteGatewayResourceId); + + // get the collection of this ExpressRouteConnectionResource + ExpressRouteConnectionCollection collection = expressRouteGateway.GetExpressRouteConnections(); + + // invoke the operation + string connectionName = "connectionName"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + ExpressRouteConnectionResource 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 + ExpressRouteConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExpressRouteConnectionList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCrossConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCrossConnectionCollection.cs index 93d8e7eb9c10..c593c6303582 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCrossConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCrossConnectionCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetExpressRouteCrossConnection() Console.WriteLine($"Succeeded: {result}"); } + // GetExpressRouteCrossConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExpressRouteCrossConnection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteCrossConnectionGet.json + // this example is just showing the usage of "ExpressRouteCrossConnections_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 = "subid"; + string resourceGroupName = "CrossConnection-SiliconValley"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ExpressRouteCrossConnectionResource + ExpressRouteCrossConnectionCollection collection = resourceGroupResource.GetExpressRouteCrossConnections(); + + // invoke the operation + string crossConnectionName = ""; + NullableResponse response = await collection.GetIfExistsAsync(crossConnectionName); + ExpressRouteCrossConnectionResource 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 + ExpressRouteCrossConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // UpdateExpressRouteCrossConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCrossConnectionPeeringCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCrossConnectionPeeringCollection.cs index 384a11e88552..f81eee161bbf 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCrossConnectionPeeringCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteCrossConnectionPeeringCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetExpressRouteCrossConnectionBgpPeering() Console.WriteLine($"Succeeded: {result}"); } + // GetExpressRouteCrossConnectionBgpPeering + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExpressRouteCrossConnectionBgpPeering() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteCrossConnectionBgpPeeringGet.json + // this example is just showing the usage of "ExpressRouteCrossConnectionPeerings_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 ExpressRouteCrossConnectionResource created on azure + // for more information of creating ExpressRouteCrossConnectionResource, please refer to the document of ExpressRouteCrossConnectionResource + string subscriptionId = "subid"; + string resourceGroupName = "CrossConnection-SiliconValley"; + string crossConnectionName = ""; + ResourceIdentifier expressRouteCrossConnectionResourceId = ExpressRouteCrossConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, crossConnectionName); + ExpressRouteCrossConnectionResource expressRouteCrossConnection = client.GetExpressRouteCrossConnectionResource(expressRouteCrossConnectionResourceId); + + // get the collection of this ExpressRouteCrossConnectionPeeringResource + ExpressRouteCrossConnectionPeeringCollection collection = expressRouteCrossConnection.GetExpressRouteCrossConnectionPeerings(); + + // invoke the operation + string peeringName = "AzurePrivatePeering"; + NullableResponse response = await collection.GetIfExistsAsync(peeringName); + ExpressRouteCrossConnectionPeeringResource 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 + ExpressRouteCrossConnectionPeeringData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExpressRouteCrossConnectionBgpPeeringCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteGatewayCollection.cs index 1219acf5265a..0889678e23f0 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteGatewayCollection.cs @@ -163,5 +163,47 @@ public async Task Exists_ExpressRouteGatewayGet() Console.WriteLine($"Succeeded: {result}"); } + + // ExpressRouteGatewayGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExpressRouteGatewayGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteGatewayGet.json + // this example is just showing the usage of "ExpressRouteGateways_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 = "subid"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ExpressRouteGatewayResource + ExpressRouteGatewayCollection collection = resourceGroupResource.GetExpressRouteGateways(); + + // invoke the operation + string expressRouteGatewayName = "expressRouteGatewayName"; + NullableResponse response = await collection.GetIfExistsAsync(expressRouteGatewayName); + ExpressRouteGatewayResource 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 + ExpressRouteGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteLinkCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteLinkCollection.cs index 09c8a98be9c8..ffb35bab2c2b 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteLinkCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteLinkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_ExpressRouteLinkGet() Console.WriteLine($"Succeeded: {result}"); } + // ExpressRouteLinkGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExpressRouteLinkGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRouteLinkGet.json + // this example is just showing the usage of "ExpressRouteLinks_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 ExpressRoutePortResource created on azure + // for more information of creating ExpressRoutePortResource, please refer to the document of ExpressRoutePortResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string expressRoutePortName = "portName"; + ResourceIdentifier expressRoutePortResourceId = ExpressRoutePortResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, expressRoutePortName); + ExpressRoutePortResource expressRoutePort = client.GetExpressRoutePortResource(expressRoutePortResourceId); + + // get the collection of this ExpressRouteLinkResource + ExpressRouteLinkCollection collection = expressRoutePort.GetExpressRouteLinks(); + + // invoke the operation + string linkName = "linkName"; + NullableResponse response = await collection.GetIfExistsAsync(linkName); + ExpressRouteLinkResource 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 + ExpressRouteLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExpressRouteLinkGet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortAuthorizationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortAuthorizationCollection.cs index eb638508c704..090d9107a7f6 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortAuthorizationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortAuthorizationCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetExpressRoutePortAuthorization() Console.WriteLine($"Succeeded: {result}"); } + // Get ExpressRoutePort Authorization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetExpressRoutePortAuthorization() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRoutePortAuthorizationGet.json + // this example is just showing the usage of "ExpressRoutePortAuthorizations_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 ExpressRoutePortResource created on azure + // for more information of creating ExpressRoutePortResource, please refer to the document of ExpressRoutePortResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string expressRoutePortName = "expressRoutePortName"; + ResourceIdentifier expressRoutePortResourceId = ExpressRoutePortResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, expressRoutePortName); + ExpressRoutePortResource expressRoutePort = client.GetExpressRoutePortResource(expressRoutePortResourceId); + + // get the collection of this ExpressRoutePortAuthorizationResource + ExpressRoutePortAuthorizationCollection collection = expressRoutePort.GetExpressRoutePortAuthorizations(); + + // invoke the operation + string authorizationName = "authorizationName"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationName); + ExpressRoutePortAuthorizationResource 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 + ExpressRoutePortAuthorizationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create ExpressRoutePort Authorization [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortCollection.cs index 0b08b97ca934..2e79d926d692 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_ExpressRoutePortGet() Console.WriteLine($"Succeeded: {result}"); } + // ExpressRoutePortGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExpressRoutePortGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRoutePortGet.json + // this example is just showing the usage of "ExpressRoutePorts_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ExpressRoutePortResource + ExpressRoutePortCollection collection = resourceGroupResource.GetExpressRoutePorts(); + + // invoke the operation + string expressRoutePortName = "portName"; + NullableResponse response = await collection.GetIfExistsAsync(expressRoutePortName); + ExpressRoutePortResource 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 + ExpressRoutePortData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExpressRoutePortCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortsLocationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortsLocationCollection.cs index abbcfc5d7771..227b2a89551a 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortsLocationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRoutePortsLocationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_ExpressRoutePortsLocationGet() Console.WriteLine($"Succeeded: {result}"); } + + // ExpressRoutePortsLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExpressRoutePortsLocationGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ExpressRoutePortsLocationGet.json + // this example is just showing the usage of "ExpressRoutePortsLocations_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ExpressRoutePortsLocationResource + ExpressRoutePortsLocationCollection collection = subscriptionResource.GetExpressRoutePortsLocations(); + + // invoke the operation + string locationName = "locationName"; + NullableResponse response = await collection.GetIfExistsAsync(locationName); + ExpressRoutePortsLocationResource 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 + ExpressRoutePortsLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteProviderPortCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteProviderPortCollection.cs index 5b3576a99d1c..670ce19e9afb 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteProviderPortCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ExpressRouteProviderPortCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -79,6 +80,47 @@ public async Task Exists_ExpressRouteProviderPort() Console.WriteLine($"Succeeded: {result}"); } + // ExpressRouteProviderPort + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExpressRouteProviderPort() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/expressRouteProviderPort.json + // this example is just showing the usage of "ExpressRouteProviderPort" 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 = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ExpressRouteProviderPortResource + ExpressRouteProviderPortCollection collection = subscriptionResource.GetExpressRouteProviderPorts(); + + // invoke the operation + string providerport = "abc"; + NullableResponse response = await collection.GetIfExistsAsync(providerport); + ExpressRouteProviderPortResource 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 + ExpressRouteProviderPortData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExpressRouteProviderPortList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FirewallPolicyCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FirewallPolicyCollection.cs index a69daba9407d..fb3b24a7e8a1 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FirewallPolicyCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FirewallPolicyCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetFirewallPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get FirewallPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFirewallPolicy() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/FirewallPolicyGet.json + // this example is just showing the usage of "FirewallPolicies_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FirewallPolicyResource + FirewallPolicyCollection collection = resourceGroupResource.GetFirewallPolicies(); + + // invoke the operation + string firewallPolicyName = "firewallPolicy"; + NullableResponse response = await collection.GetIfExistsAsync(firewallPolicyName); + FirewallPolicyResource 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 + FirewallPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create FirewallPolicy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FirewallPolicyRuleCollectionGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FirewallPolicyRuleCollectionGroupCollection.cs index 0d2fcf79bef0..5a7821ea515b 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FirewallPolicyRuleCollectionGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FirewallPolicyRuleCollectionGroupCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetFirewallPolicyNatRuleCollectionGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get FirewallPolicyNatRuleCollectionGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFirewallPolicyNatRuleCollectionGroup() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/FirewallPolicyNatRuleCollectionGroupGet.json + // this example is just showing the usage of "FirewallPolicyRuleCollectionGroups_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 FirewallPolicyResource created on azure + // for more information of creating FirewallPolicyResource, please refer to the document of FirewallPolicyResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string firewallPolicyName = "firewallPolicy"; + ResourceIdentifier firewallPolicyResourceId = FirewallPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, firewallPolicyName); + FirewallPolicyResource firewallPolicy = client.GetFirewallPolicyResource(firewallPolicyResourceId); + + // get the collection of this FirewallPolicyRuleCollectionGroupResource + FirewallPolicyRuleCollectionGroupCollection collection = firewallPolicy.GetFirewallPolicyRuleCollectionGroups(); + + // invoke the operation + string ruleCollectionGroupName = "ruleCollectionGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(ruleCollectionGroupName); + FirewallPolicyRuleCollectionGroupResource 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 + FirewallPolicyRuleCollectionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get FirewallPolicyRuleCollectionGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -150,6 +193,49 @@ public async Task Exists_GetFirewallPolicyRuleCollectionGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get FirewallPolicyRuleCollectionGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFirewallPolicyRuleCollectionGroup() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/FirewallPolicyRuleCollectionGroupGet.json + // this example is just showing the usage of "FirewallPolicyRuleCollectionGroups_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 FirewallPolicyResource created on azure + // for more information of creating FirewallPolicyResource, please refer to the document of FirewallPolicyResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string firewallPolicyName = "firewallPolicy"; + ResourceIdentifier firewallPolicyResourceId = FirewallPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, firewallPolicyName); + FirewallPolicyResource firewallPolicy = client.GetFirewallPolicyResource(firewallPolicyResourceId); + + // get the collection of this FirewallPolicyRuleCollectionGroupResource + FirewallPolicyRuleCollectionGroupCollection collection = firewallPolicy.GetFirewallPolicyRuleCollectionGroups(); + + // invoke the operation + string ruleCollectionGroupName = "ruleCollectionGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(ruleCollectionGroupName); + FirewallPolicyRuleCollectionGroupResource 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 + FirewallPolicyRuleCollectionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get FirewallPolicyRuleCollectionGroup With IpGroups [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -216,6 +302,49 @@ public async Task Exists_GetFirewallPolicyRuleCollectionGroupWithIpGroups() Console.WriteLine($"Succeeded: {result}"); } + // Get FirewallPolicyRuleCollectionGroup With IpGroups + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFirewallPolicyRuleCollectionGroupWithIpGroups() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsGet.json + // this example is just showing the usage of "FirewallPolicyRuleCollectionGroups_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 FirewallPolicyResource created on azure + // for more information of creating FirewallPolicyResource, please refer to the document of FirewallPolicyResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string firewallPolicyName = "firewallPolicy"; + ResourceIdentifier firewallPolicyResourceId = FirewallPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, firewallPolicyName); + FirewallPolicyResource firewallPolicy = client.GetFirewallPolicyResource(firewallPolicyResourceId); + + // get the collection of this FirewallPolicyRuleCollectionGroupResource + FirewallPolicyRuleCollectionGroupCollection collection = firewallPolicy.GetFirewallPolicyRuleCollectionGroups(); + + // invoke the operation + string ruleCollectionGroupName = "ruleGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(ruleCollectionGroupName); + FirewallPolicyRuleCollectionGroupResource 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 + FirewallPolicyRuleCollectionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get FirewallPolicyRuleCollectionGroup With Web Categories [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -282,6 +411,49 @@ public async Task Exists_GetFirewallPolicyRuleCollectionGroupWithWebCategories() Console.WriteLine($"Succeeded: {result}"); } + // Get FirewallPolicyRuleCollectionGroup With Web Categories + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFirewallPolicyRuleCollectionGroupWithWebCategories() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesGet.json + // this example is just showing the usage of "FirewallPolicyRuleCollectionGroups_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 FirewallPolicyResource created on azure + // for more information of creating FirewallPolicyResource, please refer to the document of FirewallPolicyResource + string subscriptionId = "e747cc13-97d4-4a79-b463-42d7f4e558f2"; + string resourceGroupName = "rg1"; + string firewallPolicyName = "firewallPolicy"; + ResourceIdentifier firewallPolicyResourceId = FirewallPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, firewallPolicyName); + FirewallPolicyResource firewallPolicy = client.GetFirewallPolicyResource(firewallPolicyResourceId); + + // get the collection of this FirewallPolicyRuleCollectionGroupResource + FirewallPolicyRuleCollectionGroupCollection collection = firewallPolicy.GetFirewallPolicyRuleCollectionGroups(); + + // invoke the operation + string ruleCollectionGroupName = "ruleCollectionGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(ruleCollectionGroupName); + FirewallPolicyRuleCollectionGroupResource 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 + FirewallPolicyRuleCollectionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create FirewallPolicyNatRuleCollectionGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FlowLogCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FlowLogCollection.cs index 0aba4d9831c8..dd47862a6b80 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FlowLogCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FlowLogCollection.cs @@ -132,6 +132,49 @@ public async Task Exists_GetFlowLog() Console.WriteLine($"Succeeded: {result}"); } + // Get flow log + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFlowLog() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkWatcherFlowLogGet.json + // this example is just showing the usage of "FlowLogs_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 NetworkWatcherResource created on azure + // for more information of creating NetworkWatcherResource, please refer to the document of NetworkWatcherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string networkWatcherName = "nw1"; + ResourceIdentifier networkWatcherResourceId = NetworkWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkWatcherName); + NetworkWatcherResource networkWatcher = client.GetNetworkWatcherResource(networkWatcherResourceId); + + // get the collection of this FlowLogResource + FlowLogCollection collection = networkWatcher.GetFlowLogs(); + + // invoke the operation + string flowLogName = "flowLog1"; + NullableResponse response = await collection.GetIfExistsAsync(flowLogName); + FlowLogResource 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 + FlowLogData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List connection monitors [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FrontendIPConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FrontendIPConfigurationCollection.cs index 75102dfcd5be..eea47f999b79 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FrontendIPConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_FrontendIPConfigurationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_LoadBalancerFrontendIPConfigurationGet() Console.WriteLine($"Succeeded: {result}"); } + + // LoadBalancerFrontendIPConfigurationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LoadBalancerFrontendIPConfigurationGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LoadBalancerFrontendIPConfigurationGet.json + // this example is just showing the usage of "LoadBalancerFrontendIPConfigurations_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 LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string loadBalancerName = "lb"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // get the collection of this FrontendIPConfigurationResource + FrontendIPConfigurationCollection collection = loadBalancer.GetFrontendIPConfigurations(); + + // invoke the operation + string frontendIPConfigurationName = "frontend"; + NullableResponse response = await collection.GetIfExistsAsync(frontendIPConfigurationName); + FrontendIPConfigurationResource 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 + FrontendIPConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubIPConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubIPConfigurationCollection.cs index 727739390037..9148dbab56a1 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubIPConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubIPConfigurationCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_VirtualHubVirtualHubRouteTableV2Get() Console.WriteLine($"Succeeded: {result}"); } + // VirtualHubVirtualHubRouteTableV2Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualHubVirtualHubRouteTableV2Get() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualHubIpConfigurationGet.json + // this example is just showing the usage of "VirtualHubIpConfiguration_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 VirtualHubResource created on azure + // for more information of creating VirtualHubResource, please refer to the document of VirtualHubResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualHubName = "hub1"; + ResourceIdentifier virtualHubResourceId = VirtualHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualHubName); + VirtualHubResource virtualHub = client.GetVirtualHubResource(virtualHubResourceId); + + // get the collection of this HubIPConfigurationResource + HubIPConfigurationCollection collection = virtualHub.GetHubIPConfigurations(); + + // invoke the operation + string ipConfigName = "ipconfig1"; + NullableResponse response = await collection.GetIfExistsAsync(ipConfigName); + HubIPConfigurationResource 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 + HubIPConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualHubIpConfigurationPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubRouteTableCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubRouteTableCollection.cs index b1d64c08f5ca..d8dfa06fe06e 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubRouteTableCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubRouteTableCollection.cs @@ -134,6 +134,49 @@ public async Task Exists_RouteTableGet() Console.WriteLine($"Succeeded: {result}"); } + // RouteTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RouteTableGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/HubRouteTableGet.json + // this example is just showing the usage of "HubRouteTables_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 VirtualHubResource created on azure + // for more information of creating VirtualHubResource, please refer to the document of VirtualHubResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualHubName = "virtualHub1"; + ResourceIdentifier virtualHubResourceId = VirtualHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualHubName); + VirtualHubResource virtualHub = client.GetVirtualHubResource(virtualHubResourceId); + + // get the collection of this HubRouteTableResource + HubRouteTableCollection collection = virtualHub.GetHubRouteTables(); + + // invoke the operation + string routeTableName = "hubRouteTable1"; + NullableResponse response = await collection.GetIfExistsAsync(routeTableName); + HubRouteTableResource 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 + HubRouteTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RouteTableList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubVirtualNetworkConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubVirtualNetworkConnectionCollection.cs index 9eb2b4ebbbfb..2fc681f3ecc4 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubVirtualNetworkConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_HubVirtualNetworkConnectionCollection.cs @@ -173,6 +173,49 @@ public async Task Exists_HubVirtualNetworkConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // HubVirtualNetworkConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HubVirtualNetworkConnectionGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/HubVirtualNetworkConnectionGet.json + // this example is just showing the usage of "HubVirtualNetworkConnections_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 VirtualHubResource created on azure + // for more information of creating VirtualHubResource, please refer to the document of VirtualHubResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualHubName = "virtualHub1"; + ResourceIdentifier virtualHubResourceId = VirtualHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualHubName); + VirtualHubResource virtualHub = client.GetVirtualHubResource(virtualHubResourceId); + + // get the collection of this HubVirtualNetworkConnectionResource + HubVirtualNetworkConnectionCollection collection = virtualHub.GetHubVirtualNetworkConnections(); + + // invoke the operation + string connectionName = "connection1"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + HubVirtualNetworkConnectionResource 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 + HubVirtualNetworkConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HubVirtualNetworkConnectionList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_IPAllocationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_IPAllocationCollection.cs index 4ca37f0f4df7..10b693a2bfc3 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_IPAllocationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_IPAllocationCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetIpAllocation() Console.WriteLine($"Succeeded: {result}"); } + // Get IpAllocation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetIpAllocation() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/IpAllocationGet.json + // this example is just showing the usage of "IpAllocations_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this IPAllocationResource + IPAllocationCollection collection = resourceGroupResource.GetIPAllocations(); + + // invoke the operation + string ipAllocationName = "test-ipallocation"; + NullableResponse response = await collection.GetIfExistsAsync(ipAllocationName); + IPAllocationResource 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 + IPAllocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create IpAllocation [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_IPGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_IPGroupCollection.cs index 6bb977b3cf8c..acc05b0e46c8 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_IPGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_IPGroupCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetIpGroups() Console.WriteLine($"Succeeded: {result}"); } + // Get_IpGroups + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetIpGroups() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/IpGroupsGet.json + // this example is just showing the usage of "IpGroups_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 = "subId"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this IPGroupResource + IPGroupCollection collection = resourceGroupResource.GetIPGroups(); + + // invoke the operation + string ipGroupsName = "ipGroups1"; + NullableResponse response = await collection.GetIfExistsAsync(ipGroupsName); + IPGroupResource 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 + IPGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdate_IpGroups [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_InboundNatRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_InboundNatRuleCollection.cs index 10f81c1cfae3..04075eb781c1 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_InboundNatRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_InboundNatRuleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_InboundNatRuleGet() Console.WriteLine($"Succeeded: {result}"); } + // InboundNatRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_InboundNatRuleGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/InboundNatRuleGet.json + // this example is just showing the usage of "InboundNatRules_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 LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string loadBalancerName = "lb1"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // get the collection of this InboundNatRuleResource + InboundNatRuleCollection collection = loadBalancer.GetInboundNatRules(); + + // invoke the operation + string inboundNatRuleName = "natRule1.1"; + NullableResponse response = await collection.GetIfExistsAsync(inboundNatRuleName); + InboundNatRuleResource 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 + InboundNatRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // InboundNatRuleCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LoadBalancerCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LoadBalancerCollection.cs index 5ac3d560e7b9..8d8b54f8b96c 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LoadBalancerCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LoadBalancerCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetLoadBalancer() Console.WriteLine($"Succeeded: {result}"); } + // Get load balancer + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLoadBalancer() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LoadBalancerGet.json + // this example is just showing the usage of "LoadBalancers_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LoadBalancerResource + LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers(); + + // invoke the operation + string loadBalancerName = "lb"; + NullableResponse response = await collection.GetIfExistsAsync(loadBalancerName); + LoadBalancerResource 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 + LoadBalancerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get load balancer with inbound NAT rule port mapping [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -148,6 +190,48 @@ public async Task Exists_GetLoadBalancerWithInboundNATRulePortMapping() Console.WriteLine($"Succeeded: {result}"); } + // Get load balancer with inbound NAT rule port mapping + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLoadBalancerWithInboundNATRulePortMapping() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LoadBalancerGetInboundNatRulePortMapping.json + // this example is just showing the usage of "LoadBalancers_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LoadBalancerResource + LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers(); + + // invoke the operation + string loadBalancerName = "lb"; + NullableResponse response = await collection.GetIfExistsAsync(loadBalancerName); + LoadBalancerResource 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 + LoadBalancerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create load balancer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LoadBalancingRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LoadBalancingRuleCollection.cs index 1cbb111e90e7..1cdbf53c40c5 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LoadBalancingRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LoadBalancingRuleCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_LoadBalancerLoadBalancingRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // LoadBalancerLoadBalancingRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LoadBalancerLoadBalancingRuleGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LoadBalancerLoadBalancingRuleGet.json + // this example is just showing the usage of "LoadBalancerLoadBalancingRules_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 LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string loadBalancerName = "lb1"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // get the collection of this LoadBalancingRuleResource + LoadBalancingRuleCollection collection = loadBalancer.GetLoadBalancingRules(); + + // invoke the operation + string loadBalancingRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(loadBalancingRuleName); + LoadBalancingRuleResource 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 + LoadBalancingRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LocalNetworkGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LocalNetworkGatewayCollection.cs index d636eef227e4..fca53a785f05 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LocalNetworkGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_LocalNetworkGatewayCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_GetLocalNetworkGateway() Console.WriteLine($"Succeeded: {result}"); } + // GetLocalNetworkGateway + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetLocalNetworkGateway() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LocalNetworkGatewayGet.json + // this example is just showing the usage of "LocalNetworkGateways_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocalNetworkGatewayResource + LocalNetworkGatewayCollection collection = resourceGroupResource.GetLocalNetworkGateways(); + + // invoke the operation + string localNetworkGatewayName = "localgw"; + NullableResponse response = await collection.GetIfExistsAsync(localNetworkGatewayName); + LocalNetworkGatewayResource 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 + LocalNetworkGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListLocalNetworkGateways [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ManagementGroupNetworkManagerConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ManagementGroupNetworkManagerConnectionCollection.cs index 86de21177267..1177453b7e20 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ManagementGroupNetworkManagerConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ManagementGroupNetworkManagerConnectionCollection.cs @@ -118,6 +118,47 @@ public async Task Exists_GetManagementGroupNetworkManagerConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get Management Group Network Manager Connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagementGroupNetworkManagerConnection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerConnectionManagementGroupGet.json + // this example is just showing the usage of "ManagementGroupNetworkManagerConnections_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 ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "managementGroupA"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this ManagementGroupNetworkManagerConnectionResource + ManagementGroupNetworkManagerConnectionCollection collection = managementGroupResource.GetManagementGroupNetworkManagerConnections(); + + // invoke the operation + string networkManagerConnectionName = "TestNMConnection"; + NullableResponse response = await collection.GetIfExistsAsync(networkManagerConnectionName); + ManagementGroupNetworkManagerConnectionResource 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 + NetworkManagerConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Management Group Network Manager Connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NatGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NatGatewayCollection.cs index 90699554334e..78f3e549ec8e 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NatGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NatGatewayCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetNatGateway() Console.WriteLine($"Succeeded: {result}"); } + // Get nat gateway + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNatGateway() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NatGatewayGet.json + // this example is just showing the usage of "NatGateways_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NatGatewayResource + NatGatewayCollection collection = resourceGroupResource.GetNatGateways(); + + // invoke the operation + string natGatewayName = "test-natGateway"; + NullableResponse response = await collection.GetIfExistsAsync(natGatewayName); + NatGatewayResource 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 + NatGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create nat gateway [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkGroupCollection.cs index 1eaddcb26c7a..d55cb89509b7 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkGroupCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_NetworkGroupsGet() Console.WriteLine($"Succeeded: {result}"); } + // NetworkGroupsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkGroupsGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerGroupGet.json + // this example is just showing the usage of "NetworkGroups_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 NetworkManagerResource created on azure + // for more information of creating NetworkManagerResource, please refer to the document of NetworkManagerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string networkManagerName = "testNetworkManager"; + ResourceIdentifier networkManagerResourceId = NetworkManagerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkManagerName); + NetworkManagerResource networkManager = client.GetNetworkManagerResource(networkManagerResourceId); + + // get the collection of this NetworkGroupResource + NetworkGroupCollection collection = networkManager.GetNetworkGroups(); + + // invoke the operation + string networkGroupName = "testNetworkGroup"; + NullableResponse response = await collection.GetIfExistsAsync(networkGroupName); + NetworkGroupResource 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 + NetworkGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkGroupsPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkGroupStaticMemberCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkGroupStaticMemberCollection.cs index 11db874754ab..da9f462e7395 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkGroupStaticMemberCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkGroupStaticMemberCollection.cs @@ -85,6 +85,50 @@ public async Task Exists_StaticMembersGet() Console.WriteLine($"Succeeded: {result}"); } + // StaticMembersGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StaticMembersGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerStaticMemberGet.json + // this example is just showing the usage of "StaticMembers_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 NetworkGroupResource created on azure + // for more information of creating NetworkGroupResource, please refer to the document of NetworkGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string networkManagerName = "testNetworkManager"; + string networkGroupName = "testNetworkGroup"; + ResourceIdentifier networkGroupResourceId = NetworkGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkManagerName, networkGroupName); + NetworkGroupResource networkGroup = client.GetNetworkGroupResource(networkGroupResourceId); + + // get the collection of this NetworkGroupStaticMemberResource + NetworkGroupStaticMemberCollection collection = networkGroup.GetNetworkGroupStaticMembers(); + + // invoke the operation + string staticMemberName = "testStaticMember"; + NullableResponse response = await collection.GetIfExistsAsync(staticMemberName); + NetworkGroupStaticMemberResource 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 + NetworkGroupStaticMemberData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StaticMemberPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceCollection.cs index fbaf0b1b3394..40c892a46aaf 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetNetworkInterface() Console.WriteLine($"Succeeded: {result}"); } + // Get network interface + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkInterface() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkInterfaceGet.json + // this example is just showing the usage of "NetworkInterfaces_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkInterfaceResource + NetworkInterfaceCollection collection = resourceGroupResource.GetNetworkInterfaces(); + + // invoke the operation + string networkInterfaceName = "test-nic"; + NullableResponse response = await collection.GetIfExistsAsync(networkInterfaceName); + NetworkInterfaceResource 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 + NetworkInterfaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create network interface [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceIPConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceIPConfigurationCollection.cs index 4f318f86f431..d97823e0c1c1 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceIPConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceIPConfigurationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_NetworkInterfaceIPConfigurationGet() Console.WriteLine($"Succeeded: {result}"); } + + // NetworkInterfaceIPConfigurationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkInterfaceIPConfigurationGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkInterfaceIPConfigurationGet.json + // this example is just showing the usage of "NetworkInterfaceIPConfigurations_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 NetworkInterfaceResource created on azure + // for more information of creating NetworkInterfaceResource, please refer to the document of NetworkInterfaceResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string networkInterfaceName = "mynic"; + ResourceIdentifier networkInterfaceResourceId = NetworkInterfaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkInterfaceName); + NetworkInterfaceResource networkInterface = client.GetNetworkInterfaceResource(networkInterfaceResourceId); + + // get the collection of this NetworkInterfaceIPConfigurationResource + NetworkInterfaceIPConfigurationCollection collection = networkInterface.GetNetworkInterfaceIPConfigurations(); + + // invoke the operation + string ipConfigurationName = "ipconfig1"; + NullableResponse response = await collection.GetIfExistsAsync(ipConfigurationName); + NetworkInterfaceIPConfigurationResource 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 + NetworkInterfaceIPConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceTapConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceTapConfigurationCollection.cs index f91569ce7dce..5fc167b90b1d 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceTapConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkInterfaceTapConfigurationCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetNetworkInterfaceTapConfigurations() Console.WriteLine($"Succeeded: {result}"); } + // Get Network Interface Tap Configurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkInterfaceTapConfigurations() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkInterfaceTapConfigurationGet.json + // this example is just showing the usage of "NetworkInterfaceTapConfigurations_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 NetworkInterfaceResource created on azure + // for more information of creating NetworkInterfaceResource, please refer to the document of NetworkInterfaceResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string networkInterfaceName = "mynic"; + ResourceIdentifier networkInterfaceResourceId = NetworkInterfaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkInterfaceName); + NetworkInterfaceResource networkInterface = client.GetNetworkInterfaceResource(networkInterfaceResourceId); + + // get the collection of this NetworkInterfaceTapConfigurationResource + NetworkInterfaceTapConfigurationCollection collection = networkInterface.GetNetworkInterfaceTapConfigurations(); + + // invoke the operation + string tapConfigurationName = "tapconfiguration1"; + NullableResponse response = await collection.GetIfExistsAsync(tapConfigurationName); + NetworkInterfaceTapConfigurationResource 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 + NetworkInterfaceTapConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Network Interface Tap Configurations [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkManagerCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkManagerCollection.cs index e69ee2d4e050..3cbca51f0b1f 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkManagerCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkManagerCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_NetworkManagersGet() Console.WriteLine($"Succeeded: {result}"); } + // NetworkManagersGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkManagersGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerGet.json + // this example is just showing the usage of "NetworkManagers_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 = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkManagerResource + NetworkManagerCollection collection = resourceGroupResource.GetNetworkManagers(); + + // invoke the operation + string networkManagerName = "testNetworkManager"; + NullableResponse response = await collection.GetIfExistsAsync(networkManagerName); + NetworkManagerResource 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 + NetworkManagerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put Network Manager [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkPrivateEndpointConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkPrivateEndpointConnectionCollection.cs index d5bb9a6e1f9c..b75e4279874a 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkPrivateEndpointConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetPrivateEndPointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get private end point connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndPointConnection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PrivateLinkServiceGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateLinkServices_GetPrivateEndpointConnection" 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 PrivateLinkServiceResource created on azure + // for more information of creating PrivateLinkServiceResource, please refer to the document of PrivateLinkServiceResource + string subscriptionId = "subId"; + string resourceGroupName = "rg1"; + string serviceName = "testPls"; + ResourceIdentifier privateLinkServiceResourceId = PrivateLinkServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); + PrivateLinkServiceResource privateLinkService = client.GetPrivateLinkServiceResource(privateLinkServiceResourceId); + + // get the collection of this NetworkPrivateEndpointConnectionResource + NetworkPrivateEndpointConnectionCollection collection = privateLinkService.GetNetworkPrivateEndpointConnections(); + + // invoke the operation + string peConnectionName = "testPlePeConnection"; + NullableResponse response = await collection.GetIfExistsAsync(peConnectionName); + NetworkPrivateEndpointConnectionResource 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 + NetworkPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // approve or reject private end point connection for a private link service [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkProfileCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkProfileCollection.cs index bbf3ce86a805..55ee8891b780 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkProfileCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkProfileCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetNetworkProfile() Console.WriteLine($"Succeeded: {result}"); } + // Get network profile + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkProfile() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkProfileGetConfigOnly.json + // this example is just showing the usage of "NetworkProfiles_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkProfileResource + NetworkProfileCollection collection = resourceGroupResource.GetNetworkProfiles(); + + // invoke the operation + string networkProfileName = "networkProfile1"; + NullableResponse response = await collection.GetIfExistsAsync(networkProfileName); + NetworkProfileResource 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 + NetworkProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get network profile with container network interfaces [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -147,6 +189,48 @@ public async Task Exists_GetNetworkProfileWithContainerNetworkInterfaces() Console.WriteLine($"Succeeded: {result}"); } + // Get network profile with container network interfaces + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkProfileWithContainerNetworkInterfaces() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkProfileGetWithContainerNic.json + // this example is just showing the usage of "NetworkProfiles_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkProfileResource + NetworkProfileCollection collection = resourceGroupResource.GetNetworkProfiles(); + + // invoke the operation + string networkProfileName = "networkProfile1"; + NullableResponse response = await collection.GetIfExistsAsync(networkProfileName); + NetworkProfileResource 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 + NetworkProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create network profile defaults [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkSecurityGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkSecurityGroupCollection.cs index b51b0b9af4ab..6eb7b5e62980 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkSecurityGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkSecurityGroupCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetNetworkSecurityGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get network security group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkSecurityGroup() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkSecurityGroupGet.json + // this example is just showing the usage of "NetworkSecurityGroups_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkSecurityGroupResource + NetworkSecurityGroupCollection collection = resourceGroupResource.GetNetworkSecurityGroups(); + + // invoke the operation + string networkSecurityGroupName = "testnsg"; + NullableResponse response = await collection.GetIfExistsAsync(networkSecurityGroupName); + NetworkSecurityGroupResource 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 + NetworkSecurityGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create network security group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceCollection.cs index 18bb93b287c9..c84789847049 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetNetworkVirtualAppliance() Console.WriteLine($"Succeeded: {result}"); } + // Get NetworkVirtualAppliance + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkVirtualAppliance() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkVirtualApplianceGet.json + // this example is just showing the usage of "NetworkVirtualAppliances_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkVirtualApplianceResource + NetworkVirtualApplianceCollection collection = resourceGroupResource.GetNetworkVirtualAppliances(); + + // invoke the operation + string networkVirtualApplianceName = "nva"; + NullableResponse response = await collection.GetIfExistsAsync(networkVirtualApplianceName); + NetworkVirtualApplianceResource 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 + NetworkVirtualApplianceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create NetworkVirtualAppliance [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceConnectionCollection.cs index fe2d07997052..22f16302de13 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceConnectionCollection.cs @@ -152,6 +152,49 @@ public async Task Exists_NetworkVirtualApplianceConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // NetworkVirtualApplianceConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkVirtualApplianceConnectionGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkVirtualApplianceConnectionGet.json + // this example is just showing the usage of "NetworkVirtualApplianceConnections_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 NetworkVirtualApplianceResource created on azure + // for more information of creating NetworkVirtualApplianceResource, please refer to the document of NetworkVirtualApplianceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string networkVirtualApplianceName = "nva1"; + ResourceIdentifier networkVirtualApplianceResourceId = NetworkVirtualApplianceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkVirtualApplianceName); + NetworkVirtualApplianceResource networkVirtualAppliance = client.GetNetworkVirtualApplianceResource(networkVirtualApplianceResourceId); + + // get the collection of this NetworkVirtualApplianceConnectionResource + NetworkVirtualApplianceConnectionCollection collection = networkVirtualAppliance.GetNetworkVirtualApplianceConnections(); + + // invoke the operation + string connectionName = "connection1"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + NetworkVirtualApplianceConnectionResource 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 + NetworkVirtualApplianceConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NetworkVirtualApplianceConnectionList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceSkuCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceSkuCollection.cs index 6f5768cfa9e5..29891bb91b76 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceSkuCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkVirtualApplianceSkuCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_NetworkVirtualApplianceSkuGet() Console.WriteLine($"Succeeded: {result}"); } + + // NetworkVirtualApplianceSkuGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NetworkVirtualApplianceSkuGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkVirtualApplianceSkuGet.json + // this example is just showing the usage of "VirtualApplianceSkus_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this NetworkVirtualApplianceSkuResource + NetworkVirtualApplianceSkuCollection collection = subscriptionResource.GetNetworkVirtualApplianceSkus(); + + // invoke the operation + string skuName = "ciscoSdwan"; + NullableResponse response = await collection.GetIfExistsAsync(skuName); + NetworkVirtualApplianceSkuResource 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 + NetworkVirtualApplianceSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkWatcherCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkWatcherCollection.cs index ec2a7bf37a9a..1748544578f8 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkWatcherCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_NetworkWatcherCollection.cs @@ -121,6 +121,48 @@ public async Task Exists_GetNetworkWatcher() Console.WriteLine($"Succeeded: {result}"); } + // Get network watcher + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkWatcher() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkWatcherGet.json + // this example is just showing the usage of "NetworkWatchers_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkWatcherResource + NetworkWatcherCollection collection = resourceGroupResource.GetNetworkWatchers(); + + // invoke the operation + string networkWatcherName = "nw1"; + NullableResponse response = await collection.GetIfExistsAsync(networkWatcherName); + NetworkWatcherResource 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 + NetworkWatcherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List network watchers [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_OutboundRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_OutboundRuleCollection.cs index 66082cf84efc..b5b608022f1e 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_OutboundRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_OutboundRuleCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_LoadBalancerOutboundRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // LoadBalancerOutboundRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LoadBalancerOutboundRuleGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LoadBalancerOutboundRuleGet.json + // this example is just showing the usage of "LoadBalancerOutboundRules_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 LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string loadBalancerName = "lb1"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // get the collection of this OutboundRuleResource + OutboundRuleCollection collection = loadBalancer.GetOutboundRules(); + + // invoke the operation + string outboundRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(outboundRuleName); + OutboundRuleResource 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 + OutboundRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_P2SVpnGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_P2SVpnGatewayCollection.cs index 569f39824149..aa201552f249 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_P2SVpnGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_P2SVpnGatewayCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_P2SVpnGatewayGet() Console.WriteLine($"Succeeded: {result}"); } + // P2SVpnGatewayGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_P2SVpnGatewayGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/P2SVpnGatewayGet.json + // this example is just showing the usage of "P2sVpnGateways_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this P2SVpnGatewayResource + P2SVpnGatewayCollection collection = resourceGroupResource.GetP2SVpnGateways(); + + // invoke the operation + string gatewayName = "p2sVpnGateway1"; + NullableResponse response = await collection.GetIfExistsAsync(gatewayName); + P2SVpnGatewayResource 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 + P2SVpnGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // P2SVpnGatewayPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PacketCaptureCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PacketCaptureCollection.cs index c593605e0d4d..b6f9bf87cda9 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PacketCaptureCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PacketCaptureCollection.cs @@ -140,6 +140,49 @@ public async Task Exists_GetPacketCapture() Console.WriteLine($"Succeeded: {result}"); } + // Get packet capture + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPacketCapture() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkWatcherPacketCaptureGet.json + // this example is just showing the usage of "PacketCaptures_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 NetworkWatcherResource created on azure + // for more information of creating NetworkWatcherResource, please refer to the document of NetworkWatcherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string networkWatcherName = "nw1"; + ResourceIdentifier networkWatcherResourceId = NetworkWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkWatcherName); + NetworkWatcherResource networkWatcher = client.GetNetworkWatcherResource(networkWatcherResourceId); + + // get the collection of this PacketCaptureResource + PacketCaptureCollection collection = networkWatcher.GetPacketCaptures(); + + // invoke the operation + string packetCaptureName = "pc1"; + NullableResponse response = await collection.GetIfExistsAsync(packetCaptureName); + PacketCaptureResource 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 + PacketCaptureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List packet captures [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PeerExpressRouteCircuitConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PeerExpressRouteCircuitConnectionCollection.cs index 4fb2f2679412..4271b4fbca8a 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PeerExpressRouteCircuitConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PeerExpressRouteCircuitConnectionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_PeerExpressRouteCircuitConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // PeerExpressRouteCircuitConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PeerExpressRouteCircuitConnectionGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PeerExpressRouteCircuitConnectionGet.json + // this example is just showing the usage of "PeerExpressRouteCircuitConnections_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 ExpressRouteCircuitPeeringResource created on azure + // for more information of creating ExpressRouteCircuitPeeringResource, please refer to the document of ExpressRouteCircuitPeeringResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string circuitName = "ExpressRouteARMCircuitA"; + string peeringName = "AzurePrivatePeering"; + ResourceIdentifier expressRouteCircuitPeeringResourceId = ExpressRouteCircuitPeeringResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, circuitName, peeringName); + ExpressRouteCircuitPeeringResource expressRouteCircuitPeering = client.GetExpressRouteCircuitPeeringResource(expressRouteCircuitPeeringResourceId); + + // get the collection of this PeerExpressRouteCircuitConnectionResource + PeerExpressRouteCircuitConnectionCollection collection = expressRouteCircuitPeering.GetPeerExpressRouteCircuitConnections(); + + // invoke the operation + string connectionName = "60aee347-e889-4a42-8c1b-0aae8b1e4013"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + PeerExpressRouteCircuitConnectionResource 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 + PeerExpressRouteCircuitConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Peer ExpressRouteCircuit Connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateDnsZoneGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateDnsZoneGroupCollection.cs index 9b7dad06417e..e3cd18f6e8c7 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateDnsZoneGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateDnsZoneGroupCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetPrivateDnsZoneGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get private dns zone group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateDnsZoneGroup() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PrivateEndpointDnsZoneGroupGet.json + // this example is just showing the usage of "PrivateDnsZoneGroups_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 PrivateEndpointResource created on azure + // for more information of creating PrivateEndpointResource, please refer to the document of PrivateEndpointResource + string subscriptionId = "subId"; + string resourceGroupName = "rg1"; + string privateEndpointName = "testPe"; + ResourceIdentifier privateEndpointResourceId = PrivateEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateEndpointName); + PrivateEndpointResource privateEndpoint = client.GetPrivateEndpointResource(privateEndpointResourceId); + + // get the collection of this PrivateDnsZoneGroupResource + PrivateDnsZoneGroupCollection collection = privateEndpoint.GetPrivateDnsZoneGroups(); + + // invoke the operation + string privateDnsZoneGroupName = "testPdnsgroup"; + NullableResponse response = await collection.GetIfExistsAsync(privateDnsZoneGroupName); + PrivateDnsZoneGroupResource 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 + PrivateDnsZoneGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create private dns zone group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateEndpointCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateEndpointCollection.cs index 43dd7d89270d..c6ca620a1c55 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateEndpointCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateEndpointCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetPrivateEndpoint() Console.WriteLine($"Succeeded: {result}"); } + // Get private endpoint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpoint() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PrivateEndpointGet.json + // this example is just showing the usage of "PrivateEndpoints_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 = "subId"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateEndpointResource + PrivateEndpointCollection collection = resourceGroupResource.GetPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "testPe"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointName); + PrivateEndpointResource 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 + PrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get private endpoint with application security groups [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -148,6 +190,48 @@ public async Task Exists_GetPrivateEndpointWithApplicationSecurityGroups() Console.WriteLine($"Succeeded: {result}"); } + // Get private endpoint with application security groups + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpointWithApplicationSecurityGroups() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PrivateEndpointGetWithASG.json + // this example is just showing the usage of "PrivateEndpoints_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 = "subId"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateEndpointResource + PrivateEndpointCollection collection = resourceGroupResource.GetPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "testPe"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointName); + PrivateEndpointResource 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 + PrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get private endpoint with manual approval connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -212,6 +296,48 @@ public async Task Exists_GetPrivateEndpointWithManualApprovalConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get private endpoint with manual approval connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpointWithManualApprovalConnection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PrivateEndpointGetForManualApproval.json + // this example is just showing the usage of "PrivateEndpoints_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 = "subId"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateEndpointResource + PrivateEndpointCollection collection = resourceGroupResource.GetPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "testPe"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointName); + PrivateEndpointResource 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 + PrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create private endpoint [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateLinkServiceCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateLinkServiceCollection.cs index f8bcce30a518..d9fcf47f4b2f 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateLinkServiceCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PrivateLinkServiceCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetPrivateLinkService() Console.WriteLine($"Succeeded: {result}"); } + // Get private link service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateLinkService() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PrivateLinkServiceGet.json + // this example is just showing the usage of "PrivateLinkServices_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 = "subId"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateLinkServiceResource + PrivateLinkServiceCollection collection = resourceGroupResource.GetPrivateLinkServices(); + + // invoke the operation + string serviceName = "testPls"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + PrivateLinkServiceResource 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 + PrivateLinkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create private link service [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ProbeCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ProbeCollection.cs index ea1eda91d74f..076ec4b6fe65 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ProbeCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ProbeCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_LoadBalancerProbeGet() Console.WriteLine($"Succeeded: {result}"); } + + // LoadBalancerProbeGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LoadBalancerProbeGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/LoadBalancerProbeGet.json + // this example is just showing the usage of "LoadBalancerProbes_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 LoadBalancerResource created on azure + // for more information of creating LoadBalancerResource, please refer to the document of LoadBalancerResource + string subscriptionId = "subid"; + string resourceGroupName = "testrg"; + string loadBalancerName = "lb"; + ResourceIdentifier loadBalancerResourceId = LoadBalancerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, loadBalancerName); + LoadBalancerResource loadBalancer = client.GetLoadBalancerResource(loadBalancerResourceId); + + // get the collection of this ProbeResource + ProbeCollection collection = loadBalancer.GetProbes(); + + // invoke the operation + string probeName = "probe1"; + NullableResponse response = await collection.GetIfExistsAsync(probeName); + ProbeResource 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 + ProbeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PublicIPAddressCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PublicIPAddressCollection.cs index a58948568de4..23677cb0f3d2 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PublicIPAddressCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PublicIPAddressCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetPublicIPAddress() Console.WriteLine($"Succeeded: {result}"); } + // Get public IP address + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPublicIPAddress() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PublicIpAddressGet.json + // this example is just showing the usage of "PublicIPAddresses_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublicIPAddressResource + PublicIPAddressCollection collection = resourceGroupResource.GetPublicIPAddresses(); + + // invoke the operation + string publicIPAddressName = "testDNS-ip"; + NullableResponse response = await collection.GetIfExistsAsync(publicIPAddressName); + PublicIPAddressResource 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 + PublicIPAddressData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create public IP address DNS [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PublicIPPrefixCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PublicIPPrefixCollection.cs index be1cfa6f934a..0b5d4e40bdc7 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PublicIPPrefixCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_PublicIPPrefixCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetPublicIPPrefix() Console.WriteLine($"Succeeded: {result}"); } + // Get public IP prefix + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPublicIPPrefix() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/PublicIpPrefixGet.json + // this example is just showing the usage of "PublicIPPrefixes_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublicIPPrefixResource + PublicIPPrefixCollection collection = resourceGroupResource.GetPublicIPPrefixes(); + + // invoke the operation + string publicIPPrefixName = "test-ipprefix"; + NullableResponse response = await collection.GetIfExistsAsync(publicIPPrefixName); + PublicIPPrefixResource 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 + PublicIPPrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create public IP prefix allocation method [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteCollection.cs index 9276bdfd3d43..2dba1c8df89b 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetRoute() Console.WriteLine($"Succeeded: {result}"); } + // Get route + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRoute() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/RouteTableRouteGet.json + // this example is just showing the usage of "Routes_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 RouteTableResource created on azure + // for more information of creating RouteTableResource, please refer to the document of RouteTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string routeTableName = "testrt"; + ResourceIdentifier routeTableResourceId = RouteTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, routeTableName); + RouteTableResource routeTable = client.GetRouteTableResource(routeTableResourceId); + + // get the collection of this RouteResource + RouteCollection collection = routeTable.GetRoutes(); + + // invoke the operation + string routeName = "route1"; + NullableResponse response = await collection.GetIfExistsAsync(routeName); + RouteResource 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 + RouteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create route [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteFilterCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteFilterCollection.cs index 519cb92407da..74da03750ca1 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteFilterCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteFilterCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_RouteFilterGet() Console.WriteLine($"Succeeded: {result}"); } + // RouteFilterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RouteFilterGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/RouteFilterGet.json + // this example is just showing the usage of "RouteFilters_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RouteFilterResource + RouteFilterCollection collection = resourceGroupResource.GetRouteFilters(); + + // invoke the operation + string routeFilterName = "filterName"; + NullableResponse response = await collection.GetIfExistsAsync(routeFilterName); + RouteFilterResource 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 + RouteFilterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RouteFilterCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteFilterRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteFilterRuleCollection.cs index 7786f83978b8..8d02ca5ffbde 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteFilterRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteFilterRuleCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_RouteFilterRuleGet() Console.WriteLine($"Succeeded: {result}"); } + // RouteFilterRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RouteFilterRuleGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/RouteFilterRuleGet.json + // this example is just showing the usage of "RouteFilterRules_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 RouteFilterResource created on azure + // for more information of creating RouteFilterResource, please refer to the document of RouteFilterResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string routeFilterName = "filterName"; + ResourceIdentifier routeFilterResourceId = RouteFilterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, routeFilterName); + RouteFilterResource routeFilter = client.GetRouteFilterResource(routeFilterResourceId); + + // get the collection of this RouteFilterRuleResource + RouteFilterRuleCollection collection = routeFilter.GetRouteFilterRules(); + + // invoke the operation + string ruleName = "filterName"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + RouteFilterRuleResource 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 + RouteFilterRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RouteFilterRuleCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteMapCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteMapCollection.cs index 31fab16b7bfe..a95be319e1c4 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteMapCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteMapCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_RouteMapGet() Console.WriteLine($"Succeeded: {result}"); } + // RouteMapGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RouteMapGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/RouteMapGet.json + // this example is just showing the usage of "RouteMaps_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 VirtualHubResource created on azure + // for more information of creating VirtualHubResource, please refer to the document of VirtualHubResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualHubName = "virtualHub1"; + ResourceIdentifier virtualHubResourceId = VirtualHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualHubName); + VirtualHubResource virtualHub = client.GetVirtualHubResource(virtualHubResourceId); + + // get the collection of this RouteMapResource + RouteMapCollection collection = virtualHub.GetRouteMaps(); + + // invoke the operation + string routeMapName = "routeMap1"; + NullableResponse response = await collection.GetIfExistsAsync(routeMapName); + RouteMapResource 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 + RouteMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RouteMapPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteTableCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteTableCollection.cs index 929a0b8b1e0b..55613e4c8e27 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteTableCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RouteTableCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetRouteTable() Console.WriteLine($"Succeeded: {result}"); } + // Get route table + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRouteTable() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/RouteTableGet.json + // this example is just showing the usage of "RouteTables_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RouteTableResource + RouteTableCollection collection = resourceGroupResource.GetRouteTables(); + + // invoke the operation + string routeTableName = "testrt"; + NullableResponse response = await collection.GetIfExistsAsync(routeTableName); + RouteTableResource 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 + RouteTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create route table [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RoutingIntentCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RoutingIntentCollection.cs index deb47f60b8ca..2cfdd4a2db31 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RoutingIntentCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_RoutingIntentCollection.cs @@ -133,6 +133,49 @@ public async Task Exists_RouteTableGet() Console.WriteLine($"Succeeded: {result}"); } + // RouteTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RouteTableGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/RoutingIntentGet.json + // this example is just showing the usage of "RoutingIntent_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 VirtualHubResource created on azure + // for more information of creating VirtualHubResource, please refer to the document of VirtualHubResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualHubName = "virtualHub1"; + ResourceIdentifier virtualHubResourceId = VirtualHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualHubName); + VirtualHubResource virtualHub = client.GetVirtualHubResource(virtualHubResourceId); + + // get the collection of this RoutingIntentResource + RoutingIntentCollection collection = virtualHub.GetRoutingIntents(); + + // invoke the operation + string routingIntentName = "Intent1"; + NullableResponse response = await collection.GetIfExistsAsync(routingIntentName); + RoutingIntentResource 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 + RoutingIntentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RoutingIntentList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ScopeConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ScopeConnectionCollection.cs index 9844545954ea..7494169617e8 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ScopeConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ScopeConnectionCollection.cs @@ -125,6 +125,49 @@ public async Task Exists_GetNetworkManagerScopeConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get Network Manager Scope Connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkManagerScopeConnection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerScopeConnectionGet.json + // this example is just showing the usage of "ScopeConnections_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 NetworkManagerResource created on azure + // for more information of creating NetworkManagerResource, please refer to the document of NetworkManagerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string networkManagerName = "testNetworkManager"; + ResourceIdentifier networkManagerResourceId = NetworkManagerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkManagerName); + NetworkManagerResource networkManager = client.GetNetworkManagerResource(networkManagerResourceId); + + // get the collection of this ScopeConnectionResource + ScopeConnectionCollection collection = networkManager.GetScopeConnections(); + + // invoke the operation + string scopeConnectionName = "TestScopeConnection"; + NullableResponse response = await collection.GetIfExistsAsync(scopeConnectionName); + ScopeConnectionResource 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 + ScopeConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Network Manager Scope Connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityAdminConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityAdminConfigurationCollection.cs index 75eb07054029..beef52ec12bc 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityAdminConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityAdminConfigurationCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetSecurityAdminConfigurations() Console.WriteLine($"Succeeded: {result}"); } + // Get security admin configurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityAdminConfigurations() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerSecurityAdminConfigurationGet.json + // this example is just showing the usage of "SecurityAdminConfigurations_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 NetworkManagerResource created on azure + // for more information of creating NetworkManagerResource, please refer to the document of NetworkManagerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string networkManagerName = "testNetworkManager"; + ResourceIdentifier networkManagerResourceId = NetworkManagerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkManagerName); + NetworkManagerResource networkManager = client.GetNetworkManagerResource(networkManagerResourceId); + + // get the collection of this SecurityAdminConfigurationResource + SecurityAdminConfigurationCollection collection = networkManager.GetSecurityAdminConfigurations(); + + // invoke the operation + string configurationName = "myTestSecurityConfig"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + SecurityAdminConfigurationResource 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 + SecurityAdminConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create network manager security admin configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityPartnerProviderCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityPartnerProviderCollection.cs index 5ad91e76f6e4..376294fb4ddf 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityPartnerProviderCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityPartnerProviderCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetSecurityPartnerProvider() Console.WriteLine($"Succeeded: {result}"); } + // Get Security Partner Provider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityPartnerProvider() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/SecurityPartnerProviderGet.json + // this example is just showing the usage of "SecurityPartnerProviders_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecurityPartnerProviderResource + SecurityPartnerProviderCollection collection = resourceGroupResource.GetSecurityPartnerProviders(); + + // invoke the operation + string securityPartnerProviderName = "securityPartnerProvider"; + NullableResponse response = await collection.GetIfExistsAsync(securityPartnerProviderName); + SecurityPartnerProviderResource 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 + SecurityPartnerProviderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Security Partner Provider [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityRuleCollection.cs index b110dd0ce5c7..d872b03d9df8 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SecurityRuleCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetNetworkSecurityRuleInNetworkSecurityGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get network security rule in network security group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkSecurityRuleInNetworkSecurityGroup() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkSecurityGroupRuleGet.json + // this example is just showing the usage of "SecurityRules_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 NetworkSecurityGroupResource created on azure + // for more information of creating NetworkSecurityGroupResource, please refer to the document of NetworkSecurityGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string networkSecurityGroupName = "testnsg"; + ResourceIdentifier networkSecurityGroupResourceId = NetworkSecurityGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkSecurityGroupName); + NetworkSecurityGroupResource networkSecurityGroup = client.GetNetworkSecurityGroupResource(networkSecurityGroupResourceId); + + // get the collection of this SecurityRuleResource + SecurityRuleCollection collection = networkSecurityGroup.GetSecurityRules(); + + // invoke the operation + string securityRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(securityRuleName); + SecurityRuleResource 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 + SecurityRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create security rule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ServiceEndpointPolicyCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ServiceEndpointPolicyCollection.cs index 1bc62377323c..ff1d4a3d463d 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ServiceEndpointPolicyCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ServiceEndpointPolicyCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetServiceEndPointPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get service endPoint Policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetServiceEndPointPolicy() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ServiceEndpointPolicyGet.json + // this example is just showing the usage of "ServiceEndpointPolicies_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ServiceEndpointPolicyResource + ServiceEndpointPolicyCollection collection = resourceGroupResource.GetServiceEndpointPolicies(); + + // invoke the operation + string serviceEndpointPolicyName = "testServiceEndpointPolicy"; + NullableResponse response = await collection.GetIfExistsAsync(serviceEndpointPolicyName); + ServiceEndpointPolicyResource 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 + ServiceEndpointPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create service endpoint policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ServiceEndpointPolicyDefinitionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ServiceEndpointPolicyDefinitionCollection.cs index d51f246dd385..25d7a62f01aa 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ServiceEndpointPolicyDefinitionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_ServiceEndpointPolicyDefinitionCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetServiceEndpointDefinitionInServiceEndpointPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get service endpoint definition in service endpoint policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetServiceEndpointDefinitionInServiceEndpointPolicy() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ServiceEndpointPolicyDefinitionGet.json + // this example is just showing the usage of "ServiceEndpointPolicyDefinitions_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 ServiceEndpointPolicyResource created on azure + // for more information of creating ServiceEndpointPolicyResource, please refer to the document of ServiceEndpointPolicyResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string serviceEndpointPolicyName = "testPolicy"; + ResourceIdentifier serviceEndpointPolicyResourceId = ServiceEndpointPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceEndpointPolicyName); + ServiceEndpointPolicyResource serviceEndpointPolicy = client.GetServiceEndpointPolicyResource(serviceEndpointPolicyResourceId); + + // get the collection of this ServiceEndpointPolicyDefinitionResource + ServiceEndpointPolicyDefinitionCollection collection = serviceEndpointPolicy.GetServiceEndpointPolicyDefinitions(); + + // invoke the operation + string serviceEndpointPolicyDefinitionName = "testDefinition"; + NullableResponse response = await collection.GetIfExistsAsync(serviceEndpointPolicyDefinitionName); + ServiceEndpointPolicyDefinitionResource 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 + ServiceEndpointPolicyDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create service endpoint policy definition [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SubnetCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SubnetCollection.cs index b8e9881d57b0..63199e3c6560 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SubnetCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SubnetCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetSubnet() Console.WriteLine($"Succeeded: {result}"); } + // Get subnet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSubnet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/SubnetGet.json + // this example is just showing the usage of "Subnets_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 VirtualNetworkResource created on azure + // for more information of creating VirtualNetworkResource, please refer to the document of VirtualNetworkResource + string subscriptionId = "subid"; + string resourceGroupName = "subnet-test"; + string virtualNetworkName = "vnetname"; + ResourceIdentifier virtualNetworkResourceId = VirtualNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualNetworkName); + VirtualNetworkResource virtualNetwork = client.GetVirtualNetworkResource(virtualNetworkResourceId); + + // get the collection of this SubnetResource + SubnetCollection collection = virtualNetwork.GetSubnets(); + + // invoke the operation + string subnetName = "subnet1"; + NullableResponse response = await collection.GetIfExistsAsync(subnetName); + SubnetResource 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 + SubnetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get subnet with a delegation [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -150,6 +193,49 @@ public async Task Exists_GetSubnetWithADelegation() Console.WriteLine($"Succeeded: {result}"); } + // Get subnet with a delegation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSubnetWithADelegation() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/SubnetGetWithDelegation.json + // this example is just showing the usage of "Subnets_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 VirtualNetworkResource created on azure + // for more information of creating VirtualNetworkResource, please refer to the document of VirtualNetworkResource + string subscriptionId = "subId"; + string resourceGroupName = "subnet-test"; + string virtualNetworkName = "vnetname"; + ResourceIdentifier virtualNetworkResourceId = VirtualNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualNetworkName); + VirtualNetworkResource virtualNetwork = client.GetVirtualNetworkResource(virtualNetworkResourceId); + + // get the collection of this SubnetResource + SubnetCollection collection = virtualNetwork.GetSubnets(); + + // invoke the operation + string subnetName = "subnet1"; + NullableResponse response = await collection.GetIfExistsAsync(subnetName); + SubnetResource 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 + SubnetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create subnet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SubscriptionNetworkManagerConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SubscriptionNetworkManagerConnectionCollection.cs index 8dee327008df..311ab9822070 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SubscriptionNetworkManagerConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_SubscriptionNetworkManagerConnectionCollection.cs @@ -118,6 +118,47 @@ public async Task Exists_GetSubscriptionNetworkManagerConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get Subscription Network Manager Connection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSubscriptionNetworkManagerConnection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkManagerConnectionSubscriptionGet.json + // this example is just showing the usage of "SubscriptionNetworkManagerConnections_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionNetworkManagerConnectionResource + SubscriptionNetworkManagerConnectionCollection collection = subscriptionResource.GetSubscriptionNetworkManagerConnections(); + + // invoke the operation + string networkManagerConnectionName = "TestNMConnection"; + NullableResponse response = await collection.GetIfExistsAsync(networkManagerConnectionName); + SubscriptionNetworkManagerConnectionResource 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 + NetworkManagerConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Subscription Network Manager Connection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualApplianceSiteCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualApplianceSiteCollection.cs index ce326bd59d26..e944f759b14f 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualApplianceSiteCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualApplianceSiteCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetNetworkVirtualApplianceSite() Console.WriteLine($"Succeeded: {result}"); } + // GetNetwork Virtual Appliance Site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkVirtualApplianceSite() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NetworkVirtualApplianceSiteGet.json + // this example is just showing the usage of "VirtualApplianceSites_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 NetworkVirtualApplianceResource created on azure + // for more information of creating NetworkVirtualApplianceResource, please refer to the document of NetworkVirtualApplianceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string networkVirtualApplianceName = "nva"; + ResourceIdentifier networkVirtualApplianceResourceId = NetworkVirtualApplianceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkVirtualApplianceName); + NetworkVirtualApplianceResource networkVirtualAppliance = client.GetNetworkVirtualApplianceResource(networkVirtualApplianceResourceId); + + // get the collection of this VirtualApplianceSiteResource + VirtualApplianceSiteCollection collection = networkVirtualAppliance.GetVirtualApplianceSites(); + + // invoke the operation + string siteName = "site1"; + NullableResponse response = await collection.GetIfExistsAsync(siteName); + VirtualApplianceSiteResource 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 + VirtualApplianceSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Network Virtual Appliance Site [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualHubCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualHubCollection.cs index 403e47d229b6..63837a61af6c 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualHubCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualHubCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_VirtualHubGet() Console.WriteLine($"Succeeded: {result}"); } + // VirtualHubGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualHubGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualHubGet.json + // this example is just showing the usage of "VirtualHubs_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualHubResource + VirtualHubCollection collection = resourceGroupResource.GetVirtualHubs(); + + // invoke the operation + string virtualHubName = "virtualHub1"; + NullableResponse response = await collection.GetIfExistsAsync(virtualHubName); + VirtualHubResource 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 + VirtualHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualHubPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualHubRouteTableV2Collection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualHubRouteTableV2Collection.cs index 31415b8ec961..9a77d810f111 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualHubRouteTableV2Collection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualHubRouteTableV2Collection.cs @@ -84,6 +84,49 @@ public async Task Exists_VirtualHubVirtualHubRouteTableV2Get() Console.WriteLine($"Succeeded: {result}"); } + // VirtualHubVirtualHubRouteTableV2Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualHubVirtualHubRouteTableV2Get() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualHubRouteTableV2Get.json + // this example is just showing the usage of "VirtualHubRouteTableV2s_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 VirtualHubResource created on azure + // for more information of creating VirtualHubResource, please refer to the document of VirtualHubResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualHubName = "virtualHub1"; + ResourceIdentifier virtualHubResourceId = VirtualHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualHubName); + VirtualHubResource virtualHub = client.GetVirtualHubResource(virtualHubResourceId); + + // get the collection of this VirtualHubRouteTableV2Resource + VirtualHubRouteTableV2Collection collection = virtualHub.GetVirtualHubRouteTableV2s(); + + // invoke the operation + string routeTableName = "virtualHubRouteTable1a"; + NullableResponse response = await collection.GetIfExistsAsync(routeTableName); + VirtualHubRouteTableV2Resource 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 + VirtualHubRouteTableV2Data resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualHubRouteTableV2Put [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkCollection.cs index 33d666771c38..5160b4fc5fc1 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetVirtualNetwork() Console.WriteLine($"Succeeded: {result}"); } + // Get virtual network + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetwork() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkGet.json + // this example is just showing the usage of "VirtualNetworks_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualNetworkResource + VirtualNetworkCollection collection = resourceGroupResource.GetVirtualNetworks(); + + // invoke the operation + string virtualNetworkName = "test-vnet"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkName); + VirtualNetworkResource 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 + VirtualNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get virtual network with a delegated subnet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -147,6 +189,48 @@ public async Task Exists_GetVirtualNetworkWithADelegatedSubnet() Console.WriteLine($"Succeeded: {result}"); } + // Get virtual network with a delegated subnet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkWithADelegatedSubnet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkGetWithSubnetDelegation.json + // this example is just showing the usage of "VirtualNetworks_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 = "subId"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualNetworkResource + VirtualNetworkCollection collection = resourceGroupResource.GetVirtualNetworks(); + + // invoke the operation + string virtualNetworkName = "test-vnet"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkName); + VirtualNetworkResource 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 + VirtualNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get virtual network with service association links [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -211,6 +295,48 @@ public async Task Exists_GetVirtualNetworkWithServiceAssociationLinks() Console.WriteLine($"Succeeded: {result}"); } + // Get virtual network with service association links + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkWithServiceAssociationLinks() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkGetWithServiceAssociationLink.json + // this example is just showing the usage of "VirtualNetworks_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 = "subId"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualNetworkResource + VirtualNetworkCollection collection = resourceGroupResource.GetVirtualNetworks(); + + // invoke the operation + string virtualNetworkName = "test-vnet"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkName); + VirtualNetworkResource 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 + VirtualNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create virtual network [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayCollection.cs index 48e841bf741a..79837f5eb011 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayCollection.cs @@ -333,6 +333,48 @@ public async Task Exists_GetVirtualNetworkGateway() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualNetworkGateway + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkGateway() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkGatewayGet.json + // this example is just showing the usage of "VirtualNetworkGateways_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualNetworkGatewayResource + VirtualNetworkGatewayCollection collection = resourceGroupResource.GetVirtualNetworkGateways(); + + // invoke the operation + string virtualNetworkGatewayName = "vpngw"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkGatewayName); + VirtualNetworkGatewayResource 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 + VirtualNetworkGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetVirtualNetworkScalableGateway [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -397,6 +439,48 @@ public async Task Exists_GetVirtualNetworkScalableGateway() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualNetworkScalableGateway + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkScalableGateway() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkScalableGatewayGet.json + // this example is just showing the usage of "VirtualNetworkGateways_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualNetworkGatewayResource + VirtualNetworkGatewayCollection collection = resourceGroupResource.GetVirtualNetworkGateways(); + + // invoke the operation + string virtualNetworkGatewayName = "ergw"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkGatewayName); + VirtualNetworkGatewayResource 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 + VirtualNetworkGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListVirtualNetworkGatewaysinResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayConnectionCollection.cs index 2a79f0ee3f7a..51393a74546a 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayConnectionCollection.cs @@ -200,6 +200,48 @@ public async Task Exists_GetVirtualNetworkGatewayConnection() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualNetworkGatewayConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkGatewayConnection() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkGatewayConnectionGet.json + // this example is just showing the usage of "VirtualNetworkGatewayConnections_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualNetworkGatewayConnectionResource + VirtualNetworkGatewayConnectionCollection collection = resourceGroupResource.GetVirtualNetworkGatewayConnections(); + + // invoke the operation + string virtualNetworkGatewayConnectionName = "connS2S"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkGatewayConnectionName); + VirtualNetworkGatewayConnectionResource 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 + VirtualNetworkGatewayConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListVirtualNetworkGatewayConnectionsinResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayNatRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayNatRuleCollection.cs index 139b8a6264eb..0eaff7dca1ad 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayNatRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkGatewayNatRuleCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_VirtualNetworkGatewayNatRuleGet() Console.WriteLine($"Succeeded: {result}"); } + // VirtualNetworkGatewayNatRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualNetworkGatewayNatRuleGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkGatewayNatRuleGet.json + // this example is just showing the usage of "VirtualNetworkGatewayNatRules_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 VirtualNetworkGatewayResource created on azure + // for more information of creating VirtualNetworkGatewayResource, please refer to the document of VirtualNetworkGatewayResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualNetworkGatewayName = "gateway1"; + ResourceIdentifier virtualNetworkGatewayResourceId = VirtualNetworkGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualNetworkGatewayName); + VirtualNetworkGatewayResource virtualNetworkGateway = client.GetVirtualNetworkGatewayResource(virtualNetworkGatewayResourceId); + + // get the collection of this VirtualNetworkGatewayNatRuleResource + VirtualNetworkGatewayNatRuleCollection collection = virtualNetworkGateway.GetVirtualNetworkGatewayNatRules(); + + // invoke the operation + string natRuleName = "natRule1"; + NullableResponse response = await collection.GetIfExistsAsync(natRuleName); + VirtualNetworkGatewayNatRuleResource 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 + VirtualNetworkGatewayNatRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualNetworkGatewayNatRulePut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkPeeringCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkPeeringCollection.cs index 1a828806fa6b..a4ca083d0d7c 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkPeeringCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkPeeringCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetPeering() Console.WriteLine($"Succeeded: {result}"); } + // Get peering + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPeering() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkPeeringGet.json + // this example is just showing the usage of "VirtualNetworkPeerings_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 VirtualNetworkResource created on azure + // for more information of creating VirtualNetworkResource, please refer to the document of VirtualNetworkResource + string subscriptionId = "subid"; + string resourceGroupName = "peerTest"; + string virtualNetworkName = "vnet1"; + ResourceIdentifier virtualNetworkResourceId = VirtualNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualNetworkName); + VirtualNetworkResource virtualNetwork = client.GetVirtualNetworkResource(virtualNetworkResourceId); + + // get the collection of this VirtualNetworkPeeringResource + VirtualNetworkPeeringCollection collection = virtualNetwork.GetVirtualNetworkPeerings(); + + // invoke the operation + string virtualNetworkPeeringName = "peer"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkPeeringName); + VirtualNetworkPeeringResource 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 + VirtualNetworkPeeringData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get peering with remote virtual network encryption [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -150,6 +193,49 @@ public async Task Exists_GetPeeringWithRemoteVirtualNetworkEncryption() Console.WriteLine($"Succeeded: {result}"); } + // Get peering with remote virtual network encryption + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPeeringWithRemoteVirtualNetworkEncryption() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkPeeringGetWithRemoteVirtualNetworkEncryption.json + // this example is just showing the usage of "VirtualNetworkPeerings_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 VirtualNetworkResource created on azure + // for more information of creating VirtualNetworkResource, please refer to the document of VirtualNetworkResource + string subscriptionId = "subid"; + string resourceGroupName = "peerTest"; + string virtualNetworkName = "vnet1"; + ResourceIdentifier virtualNetworkResourceId = VirtualNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualNetworkName); + VirtualNetworkResource virtualNetwork = client.GetVirtualNetworkResource(virtualNetworkResourceId); + + // get the collection of this VirtualNetworkPeeringResource + VirtualNetworkPeeringCollection collection = virtualNetwork.GetVirtualNetworkPeerings(); + + // invoke the operation + string virtualNetworkPeeringName = "peer"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkPeeringName); + VirtualNetworkPeeringResource 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 + VirtualNetworkPeeringData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create peering [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkTapCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkTapCollection.cs index 0b77052a5b73..bd70638d7a97 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkTapCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualNetworkTapCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetVirtualNetworkTap() Console.WriteLine($"Succeeded: {result}"); } + // Get Virtual Network Tap + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkTap() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualNetworkTapGet.json + // this example is just showing the usage of "VirtualNetworkTaps_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualNetworkTapResource + VirtualNetworkTapCollection collection = resourceGroupResource.GetVirtualNetworkTaps(); + + // invoke the operation + string tapName = "testvtap"; + NullableResponse response = await collection.GetIfExistsAsync(tapName); + VirtualNetworkTapResource 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 + VirtualNetworkTapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Virtual Network Tap [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualRouterCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualRouterCollection.cs index b72e8054ea3a..812cc31c6031 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualRouterCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualRouterCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetVirtualRouter() Console.WriteLine($"Succeeded: {result}"); } + // Get VirtualRouter + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualRouter() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualRouterGet.json + // this example is just showing the usage of "VirtualRouters_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualRouterResource + VirtualRouterCollection collection = resourceGroupResource.GetVirtualRouters(); + + // invoke the operation + string virtualRouterName = "virtualRouter"; + NullableResponse response = await collection.GetIfExistsAsync(virtualRouterName); + VirtualRouterResource 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 + VirtualRouterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create VirtualRouter [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualRouterPeeringCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualRouterPeeringCollection.cs index 053915b229d1..a16a52ca11f0 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualRouterPeeringCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualRouterPeeringCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetVirtualRouterPeering() Console.WriteLine($"Succeeded: {result}"); } + // Get Virtual Router Peering + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualRouterPeering() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualRouterPeeringGet.json + // this example is just showing the usage of "VirtualRouterPeerings_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 VirtualRouterResource created on azure + // for more information of creating VirtualRouterResource, please refer to the document of VirtualRouterResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string virtualRouterName = "virtualRouter"; + ResourceIdentifier virtualRouterResourceId = VirtualRouterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualRouterName); + VirtualRouterResource virtualRouter = client.GetVirtualRouterResource(virtualRouterResourceId); + + // get the collection of this VirtualRouterPeeringResource + VirtualRouterPeeringCollection collection = virtualRouter.GetVirtualRouterPeerings(); + + // invoke the operation + string peeringName = "peering1"; + NullableResponse response = await collection.GetIfExistsAsync(peeringName); + VirtualRouterPeeringResource 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 + VirtualRouterPeeringData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Virtual Router Peering [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualWanCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualWanCollection.cs index 0c5830bfbb2b..e3c0d9f57e4d 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualWanCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VirtualWanCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_VirtualWANGet() Console.WriteLine($"Succeeded: {result}"); } + // VirtualWANGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualWANGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VirtualWANGet.json + // this example is just showing the usage of "VirtualWans_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualWanResource + VirtualWanCollection collection = resourceGroupResource.GetVirtualWans(); + + // invoke the operation + string virtualWanName = "wan1"; + NullableResponse response = await collection.GetIfExistsAsync(virtualWanName); + VirtualWanResource 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 + VirtualWanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualWANCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnConnectionCollection.cs index 59eb7586b227..8c3d1b4c265a 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnConnectionCollection.cs @@ -85,6 +85,49 @@ public async Task Exists_VpnConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // VpnConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VpnConnectionGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VpnConnectionGet.json + // this example is just showing the usage of "VpnConnections_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 VpnGatewayResource created on azure + // for more information of creating VpnGatewayResource, please refer to the document of VpnGatewayResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string gatewayName = "gateway1"; + ResourceIdentifier vpnGatewayResourceId = VpnGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gatewayName); + VpnGatewayResource vpnGateway = client.GetVpnGatewayResource(vpnGatewayResourceId); + + // get the collection of this VpnConnectionResource + VpnConnectionCollection collection = vpnGateway.GetVpnConnections(); + + // invoke the operation + string connectionName = "vpnConnection1"; + NullableResponse response = await collection.GetIfExistsAsync(connectionName); + VpnConnectionResource 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 + VpnConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VpnConnectionPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnGatewayCollection.cs index cade6420a001..8fdd28a9ff5c 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnGatewayCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_VpnGatewayGet() Console.WriteLine($"Succeeded: {result}"); } + // VpnGatewayGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VpnGatewayGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VpnGatewayGet.json + // this example is just showing the usage of "VpnGateways_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VpnGatewayResource + VpnGatewayCollection collection = resourceGroupResource.GetVpnGateways(); + + // invoke the operation + string gatewayName = "gateway1"; + NullableResponse response = await collection.GetIfExistsAsync(gatewayName); + VpnGatewayResource 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 + VpnGatewayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VpnGatewayPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnGatewayNatRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnGatewayNatRuleCollection.cs index 9f171f95a816..c7cf550f6968 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnGatewayNatRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnGatewayNatRuleCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_NatRuleGet() Console.WriteLine($"Succeeded: {result}"); } + // NatRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NatRuleGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/NatRuleGet.json + // this example is just showing the usage of "NatRules_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 VpnGatewayResource created on azure + // for more information of creating VpnGatewayResource, please refer to the document of VpnGatewayResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string gatewayName = "gateway1"; + ResourceIdentifier vpnGatewayResourceId = VpnGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gatewayName); + VpnGatewayResource vpnGateway = client.GetVpnGatewayResource(vpnGatewayResourceId); + + // get the collection of this VpnGatewayNatRuleResource + VpnGatewayNatRuleCollection collection = vpnGateway.GetVpnGatewayNatRules(); + + // invoke the operation + string natRuleName = "natRule1"; + NullableResponse response = await collection.GetIfExistsAsync(natRuleName); + VpnGatewayNatRuleResource 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 + VpnGatewayNatRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NatRulePut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnServerConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnServerConfigurationCollection.cs index ed0e2abba47d..726102bc7e18 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnServerConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnServerConfigurationCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_VpnServerConfigurationGet() Console.WriteLine($"Succeeded: {result}"); } + // VpnServerConfigurationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VpnServerConfigurationGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VpnServerConfigurationGet.json + // this example is just showing the usage of "VpnServerConfigurations_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VpnServerConfigurationResource + VpnServerConfigurationCollection collection = resourceGroupResource.GetVpnServerConfigurations(); + + // invoke the operation + string vpnServerConfigurationName = "vpnServerConfiguration1"; + NullableResponse response = await collection.GetIfExistsAsync(vpnServerConfigurationName); + VpnServerConfigurationResource 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 + VpnServerConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VpnServerConfigurationCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnServerConfigurationPolicyGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnServerConfigurationPolicyGroupCollection.cs index c6138ff89b69..1ae22f68f05d 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnServerConfigurationPolicyGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnServerConfigurationPolicyGroupCollection.cs @@ -139,6 +139,49 @@ public async Task Exists_ConfigurationPolicyGroupGet() Console.WriteLine($"Succeeded: {result}"); } + // ConfigurationPolicyGroupGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConfigurationPolicyGroupGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/ConfigurationPolicyGroupGet.json + // this example is just showing the usage of "ConfigurationPolicyGroups_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 VpnServerConfigurationResource created on azure + // for more information of creating VpnServerConfigurationResource, please refer to the document of VpnServerConfigurationResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string vpnServerConfigurationName = "vpnServerConfiguration1"; + ResourceIdentifier vpnServerConfigurationResourceId = VpnServerConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vpnServerConfigurationName); + VpnServerConfigurationResource vpnServerConfiguration = client.GetVpnServerConfigurationResource(vpnServerConfigurationResourceId); + + // get the collection of this VpnServerConfigurationPolicyGroupResource + VpnServerConfigurationPolicyGroupCollection collection = vpnServerConfiguration.GetVpnServerConfigurationPolicyGroups(); + + // invoke the operation + string configurationPolicyGroupName = "policyGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(configurationPolicyGroupName); + VpnServerConfigurationPolicyGroupResource 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 + VpnServerConfigurationPolicyGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConfigurationPolicyGroupListByVpnServerConfiguration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteCollection.cs index aaaf80f3591b..1bb50e1f2304 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_VpnSiteGet() Console.WriteLine($"Succeeded: {result}"); } + // VpnSiteGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VpnSiteGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VpnSiteGet.json + // this example is just showing the usage of "VpnSites_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VpnSiteResource + VpnSiteCollection collection = resourceGroupResource.GetVpnSites(); + + // invoke the operation + string vpnSiteName = "vpnSite1"; + NullableResponse response = await collection.GetIfExistsAsync(vpnSiteName); + VpnSiteResource 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 + VpnSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VpnSiteCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteLinkCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteLinkCollection.cs index 95b3d334f1a5..718f7cc9b6ca 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteLinkCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteLinkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_VpnSiteGet() Console.WriteLine($"Succeeded: {result}"); } + // VpnSiteGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VpnSiteGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VpnSiteLinkGet.json + // this example is just showing the usage of "VpnSiteLinks_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 VpnSiteResource created on azure + // for more information of creating VpnSiteResource, please refer to the document of VpnSiteResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string vpnSiteName = "vpnSite1"; + ResourceIdentifier vpnSiteResourceId = VpnSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vpnSiteName); + VpnSiteResource vpnSite = client.GetVpnSiteResource(vpnSiteResourceId); + + // get the collection of this VpnSiteLinkResource + VpnSiteLinkCollection collection = vpnSite.GetVpnSiteLinks(); + + // invoke the operation + string vpnSiteLinkName = "vpnSiteLink1"; + NullableResponse response = await collection.GetIfExistsAsync(vpnSiteLinkName); + VpnSiteLinkResource 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 + VpnSiteLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VpnSiteLinkListByVpnSite [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteLinkConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteLinkConnectionCollection.cs index 0d2bedfab52d..6844ddf5fca8 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteLinkConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_VpnSiteLinkConnectionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_VpnSiteLinkConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + + // VpnSiteLinkConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VpnSiteLinkConnectionGet() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/VpnSiteLinkConnectionGet.json + // this example is just showing the usage of "VpnSiteLinkConnections_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 VpnConnectionResource created on azure + // for more information of creating VpnConnectionResource, please refer to the document of VpnConnectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string gatewayName = "gateway1"; + string connectionName = "vpnConnection1"; + ResourceIdentifier vpnConnectionResourceId = VpnConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gatewayName, connectionName); + VpnConnectionResource vpnConnection = client.GetVpnConnectionResource(vpnConnectionResourceId); + + // get the collection of this VpnSiteLinkConnectionResource + VpnSiteLinkConnectionCollection collection = vpnConnection.GetVpnSiteLinkConnections(); + + // invoke the operation + string linkConnectionName = "Connection-Link1"; + NullableResponse response = await collection.GetIfExistsAsync(linkConnectionName); + VpnSiteLinkConnectionResource 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 + VpnSiteLinkConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_WebApplicationFirewallPolicyCollection.cs b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_WebApplicationFirewallPolicyCollection.cs index 8a81e33e7c05..c27348491d96 100644 --- a/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_WebApplicationFirewallPolicyCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/samples/Generated/Samples/Sample_WebApplicationFirewallPolicyCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetsAWAFPolicyWithinAResourceGroup() Console.WriteLine($"Succeeded: {result}"); } + // Gets a WAF policy within a resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAWAFPolicyWithinAResourceGroup() + { + // Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-05-01/examples/WafPolicyGet.json + // this example is just showing the usage of "WebApplicationFirewallPolicies_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebApplicationFirewallPolicyResource + WebApplicationFirewallPolicyCollection collection = resourceGroupResource.GetWebApplicationFirewallPolicies(); + + // invoke the operation + string policyName = "Policy1"; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + WebApplicationFirewallPolicyResource 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 + WebApplicationFirewallPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a WAF policy within a resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupCollection.cs index 36cc8f8802f9..10c1e496047f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string ruleCollectionName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName} + /// + /// + /// Operation Id + /// AdminRuleCollections_Get + /// + /// + /// + /// The name of the network manager security Configuration rule collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleCollectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleCollectionName, nameof(ruleCollectionName)); + + using var scope = _adminRuleGroupAdminRuleCollectionsClientDiagnostics.CreateScope("AdminRuleGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _adminRuleGroupAdminRuleCollectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ruleCollectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AdminRuleGroupResource(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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName} + /// + /// + /// Operation Id + /// AdminRuleCollections_Get + /// + /// + /// + /// The name of the network manager security Configuration rule collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleCollectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleCollectionName, nameof(ruleCollectionName)); + + using var scope = _adminRuleGroupAdminRuleCollectionsClientDiagnostics.CreateScope("AdminRuleGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _adminRuleGroupAdminRuleCollectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ruleCollectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AdminRuleGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayCollection.cs index 645de77af2f1..c6ec470d0fd8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string applicationGatewayName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName} + /// + /// + /// Operation Id + /// ApplicationGateways_Get + /// + /// + /// + /// The name of the application gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationGatewayName, nameof(applicationGatewayName)); + + using var scope = _applicationGatewayClientDiagnostics.CreateScope("ApplicationGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _applicationGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, applicationGatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationGatewayResource(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.Network/applicationGateways/{applicationGatewayName} + /// + /// + /// Operation Id + /// ApplicationGateways_Get + /// + /// + /// + /// The name of the application gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationGatewayName, nameof(applicationGatewayName)); + + using var scope = _applicationGatewayClientDiagnostics.CreateScope("ApplicationGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _applicationGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, applicationGatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionCollection.cs index 0c989b08efff..1c8c07a9f2ec 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName} + /// + /// + /// Operation Id + /// ApplicationGatewayPrivateEndpointConnections_Get + /// + /// + /// + /// The name of the application gateway private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _applicationGatewayPrivateEndpointConnectionClientDiagnostics.CreateScope("ApplicationGatewayPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _applicationGatewayPrivateEndpointConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationGatewayPrivateEndpointConnectionResource(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.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName} + /// + /// + /// Operation Id + /// ApplicationGatewayPrivateEndpointConnections_Get + /// + /// + /// + /// The name of the application gateway private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _applicationGatewayPrivateEndpointConnectionClientDiagnostics.CreateScope("ApplicationGatewayPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _applicationGatewayPrivateEndpointConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationGatewayPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayWafDynamicManifestCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayWafDynamicManifestCollection.cs index f44c49e06b65..c8f81a545893 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayWafDynamicManifestCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayWafDynamicManifestCollection.cs @@ -230,6 +230,70 @@ public virtual Response Exists(CancellationToken cancellationToken = defau } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault + /// + /// + /// Operation Id + /// ApplicationGatewayWafDynamicManifestsDefault_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(CancellationToken cancellationToken = default) + { + using var scope = _applicationGatewayWafDynamicManifestApplicationGatewayWafDynamicManifestsDefaultClientDiagnostics.CreateScope("ApplicationGatewayWafDynamicManifestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _applicationGatewayWafDynamicManifestApplicationGatewayWafDynamicManifestsDefaultRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationGatewayWafDynamicManifestResource(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}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault + /// + /// + /// Operation Id + /// ApplicationGatewayWafDynamicManifestsDefault_Get + /// + /// + /// + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(CancellationToken cancellationToken = default) + { + using var scope = _applicationGatewayWafDynamicManifestApplicationGatewayWafDynamicManifestsDefaultClientDiagnostics.CreateScope("ApplicationGatewayWafDynamicManifestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _applicationGatewayWafDynamicManifestApplicationGatewayWafDynamicManifestsDefaultRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationGatewayWafDynamicManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupCollection.cs index 9ffc20ddba00..da3c61a59708 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string applicationSecurityGroupName, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName} + /// + /// + /// Operation Id + /// ApplicationSecurityGroups_Get + /// + /// + /// + /// The name of the application security group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationSecurityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationSecurityGroupName, nameof(applicationSecurityGroupName)); + + using var scope = _applicationSecurityGroupClientDiagnostics.CreateScope("ApplicationSecurityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _applicationSecurityGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, applicationSecurityGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationSecurityGroupResource(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.Network/applicationSecurityGroups/{applicationSecurityGroupName} + /// + /// + /// Operation Id + /// ApplicationSecurityGroups_Get + /// + /// + /// + /// The name of the application security group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationSecurityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationSecurityGroupName, nameof(applicationSecurityGroupName)); + + using var scope = _applicationSecurityGroupClientDiagnostics.CreateScope("ApplicationSecurityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _applicationSecurityGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, applicationSecurityGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ApplicationSecurityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallCollection.cs index 31cc2dc7699b..8bfba957b91a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string azureFirewallName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName} + /// + /// + /// Operation Id + /// AzureFirewalls_Get + /// + /// + /// + /// The name of the Azure Firewall. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureFirewallName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureFirewallName, nameof(azureFirewallName)); + + using var scope = _azureFirewallClientDiagnostics.CreateScope("AzureFirewallCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _azureFirewallRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureFirewallName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureFirewallResource(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.Network/azureFirewalls/{azureFirewallName} + /// + /// + /// Operation Id + /// AzureFirewalls_Get + /// + /// + /// + /// The name of the Azure Firewall. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureFirewallName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureFirewallName, nameof(azureFirewallName)); + + using var scope = _azureFirewallClientDiagnostics.CreateScope("AzureFirewallCollection.GetIfExists"); + scope.Start(); + try + { + var response = _azureFirewallRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureFirewallName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureFirewallResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureWebCategoryCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureWebCategoryCollection.cs index c46e520372c1..16ec471061e9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureWebCategoryCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureWebCategoryCollection.cs @@ -246,6 +246,82 @@ public virtual Response Exists(string name, string expand = null, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name} + /// + /// + /// Operation Id + /// WebCategories_Get + /// + /// + /// + /// The name of the azureWebCategory. + /// Expands resourceIds back referenced by the azureWebCategory 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 name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _azureWebCategoryWebCategoriesClientDiagnostics.CreateScope("AzureWebCategoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _azureWebCategoryWebCategoriesRestClient.GetAsync(Id.SubscriptionId, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureWebCategoryResource(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}/providers/Microsoft.Network/azureWebCategories/{name} + /// + /// + /// Operation Id + /// WebCategories_Get + /// + /// + /// + /// The name of the azureWebCategory. + /// Expands resourceIds back referenced by the azureWebCategory resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _azureWebCategoryWebCategoriesClientDiagnostics.CreateScope("AzureWebCategoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _azureWebCategoryWebCategoriesRestClient.Get(Id.SubscriptionId, name, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureWebCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolCollection.cs index 47899ba78df8..7c7ef41d5e99 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string backendAddressPoolName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName} + /// + /// + /// Operation Id + /// LoadBalancerBackendAddressPools_Get + /// + /// + /// + /// The name of the backend address pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backendAddressPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backendAddressPoolName, nameof(backendAddressPoolName)); + + using var scope = _backendAddressPoolLoadBalancerBackendAddressPoolsClientDiagnostics.CreateScope("BackendAddressPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backendAddressPoolLoadBalancerBackendAddressPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backendAddressPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackendAddressPoolResource(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.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName} + /// + /// + /// Operation Id + /// LoadBalancerBackendAddressPools_Get + /// + /// + /// + /// The name of the backend address pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backendAddressPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backendAddressPoolName, nameof(backendAddressPoolName)); + + using var scope = _backendAddressPoolLoadBalancerBackendAddressPoolsClientDiagnostics.CreateScope("BackendAddressPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backendAddressPoolLoadBalancerBackendAddressPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backendAddressPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackendAddressPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BaseAdminRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BaseAdminRuleCollection.cs index 2cf8db876dd0..c710ab067274 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BaseAdminRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BaseAdminRuleCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName} + /// + /// + /// Operation Id + /// AdminRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _baseAdminRuleAdminRulesClientDiagnostics.CreateScope("BaseAdminRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _baseAdminRuleAdminRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BaseAdminRuleResource(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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName} + /// + /// + /// Operation Id + /// AdminRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _baseAdminRuleAdminRulesClientDiagnostics.CreateScope("BaseAdminRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _baseAdminRuleAdminRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BaseAdminRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostCollection.cs index 79f2a0a40778..d4c87c957e23 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string bastionHostName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName} + /// + /// + /// Operation Id + /// BastionHosts_Get + /// + /// + /// + /// The name of the Bastion Host. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string bastionHostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bastionHostName, nameof(bastionHostName)); + + using var scope = _bastionHostClientDiagnostics.CreateScope("BastionHostCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _bastionHostRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, bastionHostName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BastionHostResource(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.Network/bastionHosts/{bastionHostName} + /// + /// + /// Operation Id + /// BastionHosts_Get + /// + /// + /// + /// The name of the Bastion Host. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string bastionHostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bastionHostName, nameof(bastionHostName)); + + using var scope = _bastionHostClientDiagnostics.CreateScope("BastionHostCollection.GetIfExists"); + scope.Start(); + try + { + var response = _bastionHostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, bastionHostName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BastionHostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionCollection.cs index 01ca75204913..f1f7b9b7e600 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName} + /// + /// + /// Operation Id + /// VirtualHubBgpConnection_Get + /// + /// + /// + /// The name of the connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _bgpConnectionVirtualHubBgpConnectionClientDiagnostics.CreateScope("BgpConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _bgpConnectionVirtualHubBgpConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BgpConnectionResource(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.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName} + /// + /// + /// Operation Id + /// VirtualHubBgpConnection_Get + /// + /// + /// + /// The name of the connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _bgpConnectionVirtualHubBgpConnectionClientDiagnostics.CreateScope("BgpConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _bgpConnectionVirtualHubBgpConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BgpConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/CloudServiceSwapCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/CloudServiceSwapCollection.cs index 5429e7d19807..377ddcab9ca1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/CloudServiceSwapCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/CloudServiceSwapCollection.cs @@ -301,6 +301,70 @@ public virtual Response Exists(CancellationToken cancellationToken = defau } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource} + /// + /// + /// Operation Id + /// VipSwap_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(CancellationToken cancellationToken = default) + { + using var scope = _cloudServiceSwapVipSwapClientDiagnostics.CreateScope("CloudServiceSwapCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cloudServiceSwapVipSwapRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceSwapResource(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/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource} + /// + /// + /// Operation Id + /// VipSwap_Get + /// + /// + /// + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(CancellationToken cancellationToken = default) + { + using var scope = _cloudServiceSwapVipSwapClientDiagnostics.CreateScope("CloudServiceSwapCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cloudServiceSwapVipSwapRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceSwapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectionMonitorCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectionMonitorCollection.cs index 30deb86dfe50..819e9e2138dc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectionMonitorCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectionMonitorCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string connectionMonitorName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName} + /// + /// + /// Operation Id + /// ConnectionMonitors_Get + /// + /// + /// + /// The name of the connection monitor. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionMonitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionMonitorName, nameof(connectionMonitorName)); + + using var scope = _connectionMonitorClientDiagnostics.CreateScope("ConnectionMonitorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _connectionMonitorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionMonitorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectionMonitorResource(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.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName} + /// + /// + /// Operation Id + /// ConnectionMonitors_Get + /// + /// + /// + /// The name of the connection monitor. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionMonitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionMonitorName, nameof(connectionMonitorName)); + + using var scope = _connectionMonitorClientDiagnostics.CreateScope("ConnectionMonitorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _connectionMonitorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionMonitorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectionMonitorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectivityConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectivityConfigurationCollection.cs index fa523911b93a..2d22a46a70bc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectivityConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectivityConfigurationCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName} + /// + /// + /// Operation Id + /// ConnectivityConfigurations_Get + /// + /// + /// + /// The name of the network manager connectivity configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _connectivityConfigurationClientDiagnostics.CreateScope("ConnectivityConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _connectivityConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectivityConfigurationResource(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.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName} + /// + /// + /// Operation Id + /// ConnectivityConfigurations_Get + /// + /// + /// + /// The name of the network manager connectivity configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _connectivityConfigurationClientDiagnostics.CreateScope("ConnectivityConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _connectivityConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectivityConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIPPrefixCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIPPrefixCollection.cs index 1ab780603960..a1e1bf37578e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIPPrefixCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIPPrefixCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string customIPPrefixName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName} + /// + /// + /// Operation Id + /// CustomIPPrefixes_Get + /// + /// + /// + /// The name of the custom IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string customIPPrefixName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customIPPrefixName, nameof(customIPPrefixName)); + + using var scope = _customIPPrefixClientDiagnostics.CreateScope("CustomIPPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _customIPPrefixRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, customIPPrefixName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomIPPrefixResource(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.Network/customIpPrefixes/{customIpPrefixName} + /// + /// + /// Operation Id + /// CustomIPPrefixes_Get + /// + /// + /// + /// The name of the custom IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string customIPPrefixName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customIPPrefixName, nameof(customIPPrefixName)); + + using var scope = _customIPPrefixClientDiagnostics.CreateScope("CustomIPPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = _customIPPrefixRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, customIPPrefixName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomIPPrefixResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyCollection.cs index 916a228a7f8c..f6dd2e2ed95e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyCollection.cs @@ -276,5 +276,79 @@ public virtual Response Exists(string ddosCustomPolicyName, CancellationTo throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName} + /// + /// + /// Operation Id + /// DdosCustomPolicies_Get + /// + /// + /// + /// The name of the DDoS custom policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ddosCustomPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ddosCustomPolicyName, nameof(ddosCustomPolicyName)); + + using var scope = _ddosCustomPolicyClientDiagnostics.CreateScope("DdosCustomPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _ddosCustomPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ddosCustomPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DdosCustomPolicyResource(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.Network/ddosCustomPolicies/{ddosCustomPolicyName} + /// + /// + /// Operation Id + /// DdosCustomPolicies_Get + /// + /// + /// + /// The name of the DDoS custom policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ddosCustomPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ddosCustomPolicyName, nameof(ddosCustomPolicyName)); + + using var scope = _ddosCustomPolicyClientDiagnostics.CreateScope("DdosCustomPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _ddosCustomPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ddosCustomPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DdosCustomPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanCollection.cs index a07aa6d84ca6..9891a0f7b193 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string ddosProtectionPlanName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName} + /// + /// + /// Operation Id + /// DdosProtectionPlans_Get + /// + /// + /// + /// The name of the DDoS protection plan. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ddosProtectionPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ddosProtectionPlanName, nameof(ddosProtectionPlanName)); + + using var scope = _ddosProtectionPlanClientDiagnostics.CreateScope("DdosProtectionPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _ddosProtectionPlanRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ddosProtectionPlanName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DdosProtectionPlanResource(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.Network/ddosProtectionPlans/{ddosProtectionPlanName} + /// + /// + /// Operation Id + /// DdosProtectionPlans_Get + /// + /// + /// + /// The name of the DDoS protection plan. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ddosProtectionPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ddosProtectionPlanName, nameof(ddosProtectionPlanName)); + + using var scope = _ddosProtectionPlanClientDiagnostics.CreateScope("DdosProtectionPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _ddosProtectionPlanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ddosProtectionPlanName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DdosProtectionPlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DefaultSecurityRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DefaultSecurityRuleCollection.cs index 0319bd73b3c6..d0ab01c61d53 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DefaultSecurityRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DefaultSecurityRuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string defaultSecurityRuleName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName} + /// + /// + /// Operation Id + /// DefaultSecurityRules_Get + /// + /// + /// + /// The name of the default security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string defaultSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defaultSecurityRuleName, nameof(defaultSecurityRuleName)); + + using var scope = _defaultSecurityRuleClientDiagnostics.CreateScope("DefaultSecurityRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _defaultSecurityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultSecurityRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DefaultSecurityRuleResource(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.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName} + /// + /// + /// Operation Id + /// DefaultSecurityRules_Get + /// + /// + /// + /// The name of the default security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string defaultSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defaultSecurityRuleName, nameof(defaultSecurityRuleName)); + + using var scope = _defaultSecurityRuleClientDiagnostics.CreateScope("DefaultSecurityRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _defaultSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultSecurityRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DefaultSecurityRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationCollection.cs index 8c93f300d42a..db24f02a0499 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string dscpConfigurationName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName} + /// + /// + /// Operation Id + /// DscpConfiguration_Get + /// + /// + /// + /// The name of the 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 dscpConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dscpConfigurationName, nameof(dscpConfigurationName)); + + using var scope = _dscpConfigurationClientDiagnostics.CreateScope("DscpConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dscpConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dscpConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscpConfigurationResource(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.Network/dscpConfigurations/{dscpConfigurationName} + /// + /// + /// Operation Id + /// DscpConfiguration_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dscpConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dscpConfigurationName, nameof(dscpConfigurationName)); + + using var scope = _dscpConfigurationClientDiagnostics.CreateScope("DscpConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dscpConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dscpConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DscpConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationCollection.cs index 83da0b98a98e..edc17fb17ee5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// ExpressRouteCircuitAuthorizations_Get + /// + /// + /// + /// The name of the authorization. + /// 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 = _expressRouteCircuitAuthorizationClientDiagnostics.CreateScope("ExpressRouteCircuitAuthorizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteCircuitAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCircuitAuthorizationResource(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.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// ExpressRouteCircuitAuthorizations_Get + /// + /// + /// + /// The name of the authorization. + /// 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 = _expressRouteCircuitAuthorizationClientDiagnostics.CreateScope("ExpressRouteCircuitAuthorizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteCircuitAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCircuitAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitCollection.cs index 64e2cd068d6c..8003bf7f2247 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string circuitName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName} + /// + /// + /// Operation Id + /// ExpressRouteCircuits_Get + /// + /// + /// + /// The name of express route circuit. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string circuitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(circuitName, nameof(circuitName)); + + using var scope = _expressRouteCircuitClientDiagnostics.CreateScope("ExpressRouteCircuitCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteCircuitRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, circuitName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCircuitResource(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.Network/expressRouteCircuits/{circuitName} + /// + /// + /// Operation Id + /// ExpressRouteCircuits_Get + /// + /// + /// + /// The name of express route circuit. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string circuitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(circuitName, nameof(circuitName)); + + using var scope = _expressRouteCircuitClientDiagnostics.CreateScope("ExpressRouteCircuitCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteCircuitRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, circuitName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCircuitResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionCollection.cs index b16849ec2d61..ccdbd4526a88 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName} + /// + /// + /// Operation Id + /// ExpressRouteCircuitConnections_Get + /// + /// + /// + /// The name of the express route circuit connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _expressRouteCircuitConnectionClientDiagnostics.CreateScope("ExpressRouteCircuitConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteCircuitConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCircuitConnectionResource(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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName} + /// + /// + /// Operation Id + /// ExpressRouteCircuitConnections_Get + /// + /// + /// + /// The name of the express route circuit connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _expressRouteCircuitConnectionClientDiagnostics.CreateScope("ExpressRouteCircuitConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteCircuitConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCircuitConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringCollection.cs index 3b0cec6c3d97..6b363450d756 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string peeringName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName} + /// + /// + /// Operation Id + /// ExpressRouteCircuitPeerings_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string peeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); + + using var scope = _expressRouteCircuitPeeringClientDiagnostics.CreateScope("ExpressRouteCircuitPeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteCircuitPeeringRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCircuitPeeringResource(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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName} + /// + /// + /// Operation Id + /// ExpressRouteCircuitPeerings_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string peeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); + + using var scope = _expressRouteCircuitPeeringClientDiagnostics.CreateScope("ExpressRouteCircuitPeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteCircuitPeeringRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCircuitPeeringResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionCollection.cs index 785b0a282bb2..48d1358e7ab0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName} + /// + /// + /// Operation Id + /// ExpressRouteConnections_Get + /// + /// + /// + /// The name of the ExpressRoute connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _expressRouteConnectionClientDiagnostics.CreateScope("ExpressRouteConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteConnectionResource(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.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName} + /// + /// + /// Operation Id + /// ExpressRouteConnections_Get + /// + /// + /// + /// The name of the ExpressRoute connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _expressRouteConnectionClientDiagnostics.CreateScope("ExpressRouteConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionCollection.cs index fbdbb6022331..4405a9281aab 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string crossConnectionName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName} + /// + /// + /// Operation Id + /// ExpressRouteCrossConnections_Get + /// + /// + /// + /// The name of the ExpressRouteCrossConnection (service key of the circuit). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string crossConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(crossConnectionName, nameof(crossConnectionName)); + + using var scope = _expressRouteCrossConnectionClientDiagnostics.CreateScope("ExpressRouteCrossConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteCrossConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, crossConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCrossConnectionResource(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.Network/expressRouteCrossConnections/{crossConnectionName} + /// + /// + /// Operation Id + /// ExpressRouteCrossConnections_Get + /// + /// + /// + /// The name of the ExpressRouteCrossConnection (service key of the circuit). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string crossConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(crossConnectionName, nameof(crossConnectionName)); + + using var scope = _expressRouteCrossConnectionClientDiagnostics.CreateScope("ExpressRouteCrossConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteCrossConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, crossConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCrossConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringCollection.cs index 3011eb9617b0..5003f7584cf8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string peeringName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName} + /// + /// + /// Operation Id + /// ExpressRouteCrossConnectionPeerings_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string peeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); + + using var scope = _expressRouteCrossConnectionPeeringClientDiagnostics.CreateScope("ExpressRouteCrossConnectionPeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteCrossConnectionPeeringRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCrossConnectionPeeringResource(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.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName} + /// + /// + /// Operation Id + /// ExpressRouteCrossConnectionPeerings_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string peeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); + + using var scope = _expressRouteCrossConnectionPeeringClientDiagnostics.CreateScope("ExpressRouteCrossConnectionPeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteCrossConnectionPeeringRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteCrossConnectionPeeringResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayCollection.cs index 91ad24e11ef7..cb0f54f84fdd 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string expressRouteGatewayName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName} + /// + /// + /// Operation Id + /// ExpressRouteGateways_Get + /// + /// + /// + /// The name of the ExpressRoute gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string expressRouteGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(expressRouteGatewayName, nameof(expressRouteGatewayName)); + + using var scope = _expressRouteGatewayClientDiagnostics.CreateScope("ExpressRouteGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, expressRouteGatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteGatewayResource(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.Network/expressRouteGateways/{expressRouteGatewayName} + /// + /// + /// Operation Id + /// ExpressRouteGateways_Get + /// + /// + /// + /// The name of the ExpressRoute gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string expressRouteGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(expressRouteGatewayName, nameof(expressRouteGatewayName)); + + using var scope = _expressRouteGatewayClientDiagnostics.CreateScope("ExpressRouteGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, expressRouteGatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteLinkCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteLinkCollection.cs index 575cd67ef3f5..1dd6f778b306 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteLinkCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteLinkCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string linkName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName} + /// + /// + /// Operation Id + /// ExpressRouteLinks_Get + /// + /// + /// + /// The name of the ExpressRouteLink 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 linkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkName, nameof(linkName)); + + using var scope = _expressRouteLinkClientDiagnostics.CreateScope("ExpressRouteLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteLinkResource(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.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName} + /// + /// + /// Operation Id + /// ExpressRouteLinks_Get + /// + /// + /// + /// The name of the ExpressRouteLink resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkName, nameof(linkName)); + + using var scope = _expressRouteLinkClientDiagnostics.CreateScope("ExpressRouteLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortAuthorizationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortAuthorizationCollection.cs index 9fd1da762d73..5f35720aa29a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortAuthorizationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortAuthorizationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// ExpressRoutePortAuthorizations_Get + /// + /// + /// + /// The name of the authorization. + /// 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 = _expressRoutePortAuthorizationClientDiagnostics.CreateScope("ExpressRoutePortAuthorizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRoutePortAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRoutePortAuthorizationResource(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.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// ExpressRoutePortAuthorizations_Get + /// + /// + /// + /// The name of the authorization. + /// 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 = _expressRoutePortAuthorizationClientDiagnostics.CreateScope("ExpressRoutePortAuthorizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRoutePortAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRoutePortAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortCollection.cs index ca1ca2cd8040..96e41ea2a965 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string expressRoutePortName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName} + /// + /// + /// Operation Id + /// ExpressRoutePorts_Get + /// + /// + /// + /// The name of ExpressRoutePort. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string expressRoutePortName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(expressRoutePortName, nameof(expressRoutePortName)); + + using var scope = _expressRoutePortClientDiagnostics.CreateScope("ExpressRoutePortCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRoutePortRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, expressRoutePortName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRoutePortResource(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.Network/ExpressRoutePorts/{expressRoutePortName} + /// + /// + /// Operation Id + /// ExpressRoutePorts_Get + /// + /// + /// + /// The name of ExpressRoutePort. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string expressRoutePortName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(expressRoutePortName, nameof(expressRoutePortName)); + + using var scope = _expressRoutePortClientDiagnostics.CreateScope("ExpressRoutePortCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRoutePortRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, expressRoutePortName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRoutePortResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortsLocationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortsLocationCollection.cs index d29d622684dc..ecc831bab524 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortsLocationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortsLocationCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string locationName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName} + /// + /// + /// Operation Id + /// ExpressRoutePortsLocations_Get + /// + /// + /// + /// Name of the requested ExpressRoutePort peering location. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + using var scope = _expressRoutePortsLocationClientDiagnostics.CreateScope("ExpressRoutePortsLocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRoutePortsLocationRestClient.GetAsync(Id.SubscriptionId, locationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRoutePortsLocationResource(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}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName} + /// + /// + /// Operation Id + /// ExpressRoutePortsLocations_Get + /// + /// + /// + /// Name of the requested ExpressRoutePort peering location. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + using var scope = _expressRoutePortsLocationClientDiagnostics.CreateScope("ExpressRoutePortsLocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRoutePortsLocationRestClient.Get(Id.SubscriptionId, locationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRoutePortsLocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteProviderPortCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteProviderPortCollection.cs index daa39d9d740e..b04af31fffd2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteProviderPortCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteProviderPortCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string providerport, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport} + /// + /// + /// Operation Id + /// ExpressRouteProviderPort + /// + /// + /// + /// The name of the provider port. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string providerport, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerport, nameof(providerport)); + + using var scope = _expressRouteProviderPortClientDiagnostics.CreateScope("ExpressRouteProviderPortCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _expressRouteProviderPortRestClient.ExpressRouteProviderPortAsync(Id.SubscriptionId, providerport, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteProviderPortResource(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}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport} + /// + /// + /// Operation Id + /// ExpressRouteProviderPort + /// + /// + /// + /// The name of the provider port. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string providerport, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerport, nameof(providerport)); + + using var scope = _expressRouteProviderPortClientDiagnostics.CreateScope("ExpressRouteProviderPortCollection.GetIfExists"); + scope.Start(); + try + { + var response = _expressRouteProviderPortRestClient.ExpressRouteProviderPort(Id.SubscriptionId, providerport, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteProviderPortResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyCollection.cs index b511101f15d3..fa77ed4a60b1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string firewallPolicyName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName} + /// + /// + /// Operation Id + /// FirewallPolicies_Get + /// + /// + /// + /// The name of the Firewall Policy. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallPolicyName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallPolicyName, nameof(firewallPolicyName)); + + using var scope = _firewallPolicyClientDiagnostics.CreateScope("FirewallPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _firewallPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, firewallPolicyName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FirewallPolicyResource(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.Network/firewallPolicies/{firewallPolicyName} + /// + /// + /// Operation Id + /// FirewallPolicies_Get + /// + /// + /// + /// The name of the Firewall Policy. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallPolicyName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallPolicyName, nameof(firewallPolicyName)); + + using var scope = _firewallPolicyClientDiagnostics.CreateScope("FirewallPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _firewallPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, firewallPolicyName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FirewallPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupCollection.cs index e39a23acca01..7b3c6441ef60 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleCollectionGroupName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName} + /// + /// + /// Operation Id + /// FirewallPolicyRuleCollectionGroups_Get + /// + /// + /// + /// The name of the FirewallPolicyRuleCollectionGroup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleCollectionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleCollectionGroupName, nameof(ruleCollectionGroupName)); + + using var scope = _firewallPolicyRuleCollectionGroupClientDiagnostics.CreateScope("FirewallPolicyRuleCollectionGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _firewallPolicyRuleCollectionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleCollectionGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FirewallPolicyRuleCollectionGroupResource(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.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName} + /// + /// + /// Operation Id + /// FirewallPolicyRuleCollectionGroups_Get + /// + /// + /// + /// The name of the FirewallPolicyRuleCollectionGroup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleCollectionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleCollectionGroupName, nameof(ruleCollectionGroupName)); + + using var scope = _firewallPolicyRuleCollectionGroupClientDiagnostics.CreateScope("FirewallPolicyRuleCollectionGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _firewallPolicyRuleCollectionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleCollectionGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FirewallPolicyRuleCollectionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogCollection.cs index ed9ee0d72eb3..570b824fa669 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string flowLogName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName} + /// + /// + /// Operation Id + /// FlowLogs_Get + /// + /// + /// + /// The name of the flow log 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 flowLogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(flowLogName, nameof(flowLogName)); + + using var scope = _flowLogClientDiagnostics.CreateScope("FlowLogCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _flowLogRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FlowLogResource(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.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName} + /// + /// + /// Operation Id + /// FlowLogs_Get + /// + /// + /// + /// The name of the flow log resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string flowLogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(flowLogName, nameof(flowLogName)); + + using var scope = _flowLogClientDiagnostics.CreateScope("FlowLogCollection.GetIfExists"); + scope.Start(); + try + { + var response = _flowLogRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FlowLogResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FrontendIPConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FrontendIPConfigurationCollection.cs index 27e19f179108..a3529b1b8080 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FrontendIPConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FrontendIPConfigurationCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string frontendIPConfigurationName, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName} + /// + /// + /// Operation Id + /// LoadBalancerFrontendIPConfigurations_Get + /// + /// + /// + /// The name of the frontend IP configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string frontendIPConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(frontendIPConfigurationName, nameof(frontendIPConfigurationName)); + + using var scope = _frontendIPConfigurationLoadBalancerFrontendIPConfigurationsClientDiagnostics.CreateScope("FrontendIPConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontendIPConfigurationLoadBalancerFrontendIPConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, frontendIPConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontendIPConfigurationResource(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.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName} + /// + /// + /// Operation Id + /// LoadBalancerFrontendIPConfigurations_Get + /// + /// + /// + /// The name of the frontend IP configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string frontendIPConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(frontendIPConfigurationName, nameof(frontendIPConfigurationName)); + + using var scope = _frontendIPConfigurationLoadBalancerFrontendIPConfigurationsClientDiagnostics.CreateScope("FrontendIPConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontendIPConfigurationLoadBalancerFrontendIPConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, frontendIPConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontendIPConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIPConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIPConfigurationCollection.cs index 370335ca0922..a97f3920d46f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIPConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIPConfigurationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ipConfigName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName} + /// + /// + /// Operation Id + /// VirtualHubIpConfiguration_Get + /// + /// + /// + /// The name of the ipconfig. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ipConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipConfigName, nameof(ipConfigName)); + + using var scope = _hubIPConfigurationVirtualHubIPConfigurationClientDiagnostics.CreateScope("HubIPConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hubIPConfigurationVirtualHubIPConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HubIPConfigurationResource(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.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName} + /// + /// + /// Operation Id + /// VirtualHubIpConfiguration_Get + /// + /// + /// + /// The name of the ipconfig. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ipConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipConfigName, nameof(ipConfigName)); + + using var scope = _hubIPConfigurationVirtualHubIPConfigurationClientDiagnostics.CreateScope("HubIPConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hubIPConfigurationVirtualHubIPConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HubIPConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableCollection.cs index f63ea4e6640f..74ab36dd90e0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string routeTableName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName} + /// + /// + /// Operation Id + /// HubRouteTables_Get + /// + /// + /// + /// The name of the RouteTable. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routeTableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeTableName, nameof(routeTableName)); + + using var scope = _hubRouteTableClientDiagnostics.CreateScope("HubRouteTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hubRouteTableRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeTableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HubRouteTableResource(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.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName} + /// + /// + /// Operation Id + /// HubRouteTables_Get + /// + /// + /// + /// The name of the RouteTable. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routeTableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeTableName, nameof(routeTableName)); + + using var scope = _hubRouteTableClientDiagnostics.CreateScope("HubRouteTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hubRouteTableRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeTableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HubRouteTableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionCollection.cs index 19a039299216..d7d9943c07fe 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName} + /// + /// + /// Operation Id + /// HubVirtualNetworkConnections_Get + /// + /// + /// + /// The name of the vpn connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _hubVirtualNetworkConnectionClientDiagnostics.CreateScope("HubVirtualNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hubVirtualNetworkConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HubVirtualNetworkConnectionResource(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.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName} + /// + /// + /// Operation Id + /// HubVirtualNetworkConnections_Get + /// + /// + /// + /// The name of the vpn connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _hubVirtualNetworkConnectionClientDiagnostics.CreateScope("HubVirtualNetworkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hubVirtualNetworkConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HubVirtualNetworkConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/IPAllocationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/IPAllocationCollection.cs index 400ce3b808e3..208ae426ce2f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/IPAllocationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/IPAllocationCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string ipAllocationName, string expand = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName} + /// + /// + /// Operation Id + /// IpAllocations_Get + /// + /// + /// + /// The name of the IpAllocation. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ipAllocationName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipAllocationName, nameof(ipAllocationName)); + + using var scope = _ipAllocationIPAllocationsClientDiagnostics.CreateScope("IPAllocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _ipAllocationIPAllocationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ipAllocationName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IPAllocationResource(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.Network/IpAllocations/{ipAllocationName} + /// + /// + /// Operation Id + /// IpAllocations_Get + /// + /// + /// + /// The name of the IpAllocation. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ipAllocationName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipAllocationName, nameof(ipAllocationName)); + + using var scope = _ipAllocationIPAllocationsClientDiagnostics.CreateScope("IPAllocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _ipAllocationIPAllocationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ipAllocationName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IPAllocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/IPGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/IPGroupCollection.cs index 1fb450dfb4fe..1889a1f0dc08 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/IPGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/IPGroupCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string ipGroupsName, string expand = null, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName} + /// + /// + /// Operation Id + /// IpGroups_Get + /// + /// + /// + /// The name of the ipGroups. + /// Expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups 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 ipGroupsName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipGroupsName, nameof(ipGroupsName)); + + using var scope = _ipGroupIPGroupsClientDiagnostics.CreateScope("IPGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _ipGroupIPGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ipGroupsName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IPGroupResource(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.Network/ipGroups/{ipGroupsName} + /// + /// + /// Operation Id + /// IpGroups_Get + /// + /// + /// + /// The name of the ipGroups. + /// Expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ipGroupsName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipGroupsName, nameof(ipGroupsName)); + + using var scope = _ipGroupIPGroupsClientDiagnostics.CreateScope("IPGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _ipGroupIPGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ipGroupsName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IPGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleCollection.cs index 71d927515016..5de0179da8e1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string inboundNatRuleName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName} + /// + /// + /// Operation Id + /// InboundNatRules_Get + /// + /// + /// + /// The name of the inbound NAT rule. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inboundNatRuleName, nameof(inboundNatRuleName)); + + using var scope = _inboundNatRuleClientDiagnostics.CreateScope("InboundNatRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _inboundNatRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InboundNatRuleResource(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.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName} + /// + /// + /// Operation Id + /// InboundNatRules_Get + /// + /// + /// + /// The name of the inbound NAT rule. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inboundNatRuleName, nameof(inboundNatRuleName)); + + using var scope = _inboundNatRuleClientDiagnostics.CreateScope("InboundNatRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _inboundNatRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InboundNatRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerCollection.cs index 0813cdbe11bc..e320e48a2e4c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string loadBalancerName, string expand = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// + /// The name of the load balancer. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string loadBalancerName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _loadBalancerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, loadBalancerName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadBalancerResource(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.Network/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// + /// The name of the load balancer. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string loadBalancerName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancerName, nameof(loadBalancerName)); + + using var scope = _loadBalancerClientDiagnostics.CreateScope("LoadBalancerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _loadBalancerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, loadBalancerName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadBalancerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancingRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancingRuleCollection.cs index 16105a4368bb..d47c295e2214 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancingRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancingRuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string loadBalancingRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName} + /// + /// + /// Operation Id + /// LoadBalancerLoadBalancingRules_Get + /// + /// + /// + /// The name of the load balancing rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string loadBalancingRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancingRuleName, nameof(loadBalancingRuleName)); + + using var scope = _loadBalancingRuleLoadBalancerLoadBalancingRulesClientDiagnostics.CreateScope("LoadBalancingRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _loadBalancingRuleLoadBalancerLoadBalancingRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancingRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadBalancingRuleResource(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.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName} + /// + /// + /// Operation Id + /// LoadBalancerLoadBalancingRules_Get + /// + /// + /// + /// The name of the load balancing rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string loadBalancingRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(loadBalancingRuleName, nameof(loadBalancingRuleName)); + + using var scope = _loadBalancingRuleLoadBalancerLoadBalancingRulesClientDiagnostics.CreateScope("LoadBalancingRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _loadBalancingRuleLoadBalancerLoadBalancingRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, loadBalancingRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LoadBalancingRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayCollection.cs index 97fd6889cd5a..a5ac8c022849 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string localNetworkGatewayName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName} + /// + /// + /// Operation Id + /// LocalNetworkGateways_Get + /// + /// + /// + /// The name of the local network gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string localNetworkGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(localNetworkGatewayName, nameof(localNetworkGatewayName)); + + using var scope = _localNetworkGatewayClientDiagnostics.CreateScope("LocalNetworkGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _localNetworkGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, localNetworkGatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalNetworkGatewayResource(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.Network/localNetworkGateways/{localNetworkGatewayName} + /// + /// + /// Operation Id + /// LocalNetworkGateways_Get + /// + /// + /// + /// The name of the local network gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string localNetworkGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(localNetworkGatewayName, nameof(localNetworkGatewayName)); + + using var scope = _localNetworkGatewayClientDiagnostics.CreateScope("LocalNetworkGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _localNetworkGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, localNetworkGatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ManagementGroupNetworkManagerConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ManagementGroupNetworkManagerConnectionCollection.cs index 83f1d1e85f9d..c0cf1a29d73c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ManagementGroupNetworkManagerConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ManagementGroupNetworkManagerConnectionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string networkManagerConnectionName, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName} + /// + /// + /// Operation Id + /// ManagementGroupNetworkManagerConnections_Get + /// + /// + /// + /// Name for the network manager connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkManagerConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkManagerConnectionName, nameof(networkManagerConnectionName)); + + using var scope = _managementGroupNetworkManagerConnectionClientDiagnostics.CreateScope("ManagementGroupNetworkManagerConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managementGroupNetworkManagerConnectionRestClient.GetAsync(Id.Name, networkManagerConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementGroupNetworkManagerConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName} + /// + /// + /// Operation Id + /// ManagementGroupNetworkManagerConnections_Get + /// + /// + /// + /// Name for the network manager connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkManagerConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkManagerConnectionName, nameof(networkManagerConnectionName)); + + using var scope = _managementGroupNetworkManagerConnectionClientDiagnostics.CreateScope("ManagementGroupNetworkManagerConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managementGroupNetworkManagerConnectionRestClient.Get(Id.Name, networkManagerConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementGroupNetworkManagerConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayCollection.cs index c8e6203fe976..d277e6d313ce 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string natGatewayName, string expand = null } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName} + /// + /// + /// Operation Id + /// NatGateways_Get + /// + /// + /// + /// The name of the nat gateway. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string natGatewayName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(natGatewayName, nameof(natGatewayName)); + + using var scope = _natGatewayClientDiagnostics.CreateScope("NatGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _natGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, natGatewayName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NatGatewayResource(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.Network/natGateways/{natGatewayName} + /// + /// + /// Operation Id + /// NatGateways_Get + /// + /// + /// + /// The name of the nat gateway. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string natGatewayName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(natGatewayName, nameof(natGatewayName)); + + using var scope = _natGatewayClientDiagnostics.CreateScope("NatGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _natGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, natGatewayName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NatGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupCollection.cs index 065f28668c16..13c28406df61 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string networkGroupName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName} + /// + /// + /// Operation Id + /// NetworkGroups_Get + /// + /// + /// + /// The name of the network group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkGroupName, nameof(networkGroupName)); + + using var scope = _networkGroupClientDiagnostics.CreateScope("NetworkGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkGroupResource(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.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName} + /// + /// + /// Operation Id + /// NetworkGroups_Get + /// + /// + /// + /// The name of the network group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkGroupName, nameof(networkGroupName)); + + using var scope = _networkGroupClientDiagnostics.CreateScope("NetworkGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupStaticMemberCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupStaticMemberCollection.cs index d47bc6f344f4..d727022e8199 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupStaticMemberCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupStaticMemberCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string staticMemberName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName} + /// + /// + /// Operation Id + /// StaticMembers_Get + /// + /// + /// + /// The name of the static member. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string staticMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(staticMemberName, nameof(staticMemberName)); + + using var scope = _networkGroupStaticMemberStaticMembersClientDiagnostics.CreateScope("NetworkGroupStaticMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkGroupStaticMemberStaticMembersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, staticMemberName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkGroupStaticMemberResource(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.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName} + /// + /// + /// Operation Id + /// StaticMembers_Get + /// + /// + /// + /// The name of the static member. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string staticMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(staticMemberName, nameof(staticMemberName)); + + using var scope = _networkGroupStaticMemberStaticMembersClientDiagnostics.CreateScope("NetworkGroupStaticMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkGroupStaticMemberStaticMembersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, staticMemberName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkGroupStaticMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceCollection.cs index 2e8cf7991313..c92993610e5a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string networkInterfaceName, string expand } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName} + /// + /// + /// Operation Id + /// NetworkInterfaces_Get + /// + /// + /// + /// The name of the network interface. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkInterfaceName, nameof(networkInterfaceName)); + + using var scope = _networkInterfaceClientDiagnostics.CreateScope("NetworkInterfaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkInterfaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkInterfaceName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkInterfaceResource(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.Network/networkInterfaces/{networkInterfaceName} + /// + /// + /// Operation Id + /// NetworkInterfaces_Get + /// + /// + /// + /// The name of the network interface. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkInterfaceName, nameof(networkInterfaceName)); + + using var scope = _networkInterfaceClientDiagnostics.CreateScope("NetworkInterfaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkInterfaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkInterfaceName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkInterfaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceIPConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceIPConfigurationCollection.cs index af98f6df6a46..0c714e971c5a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceIPConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceIPConfigurationCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string ipConfigurationName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName} + /// + /// + /// Operation Id + /// NetworkInterfaceIPConfigurations_Get + /// + /// + /// + /// The name of the ip configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ipConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipConfigurationName, nameof(ipConfigurationName)); + + using var scope = _networkInterfaceIPConfigurationClientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkInterfaceIPConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkInterfaceIPConfigurationResource(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.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName} + /// + /// + /// Operation Id + /// NetworkInterfaceIPConfigurations_Get + /// + /// + /// + /// The name of the ip configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ipConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ipConfigurationName, nameof(ipConfigurationName)); + + using var scope = _networkInterfaceIPConfigurationClientDiagnostics.CreateScope("NetworkInterfaceIPConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkInterfaceIPConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkInterfaceIPConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationCollection.cs index 5fac3b243926..a422339684ec 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string tapConfigurationName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName} + /// + /// + /// Operation Id + /// NetworkInterfaceTapConfigurations_Get + /// + /// + /// + /// The name of the tap configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tapConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tapConfigurationName, nameof(tapConfigurationName)); + + using var scope = _networkInterfaceTapConfigurationClientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkInterfaceTapConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tapConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkInterfaceTapConfigurationResource(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.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName} + /// + /// + /// Operation Id + /// NetworkInterfaceTapConfigurations_Get + /// + /// + /// + /// The name of the tap configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tapConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tapConfigurationName, nameof(tapConfigurationName)); + + using var scope = _networkInterfaceTapConfigurationClientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkInterfaceTapConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tapConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkInterfaceTapConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerCollection.cs index c67dd06374b4..eea2fee62d23 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string networkManagerName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName} + /// + /// + /// Operation Id + /// NetworkManagers_Get + /// + /// + /// + /// The name of the network manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkManagerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkManagerName, nameof(networkManagerName)); + + using var scope = _networkManagerClientDiagnostics.CreateScope("NetworkManagerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkManagerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkManagerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkManagerResource(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.Network/networkManagers/{networkManagerName} + /// + /// + /// Operation Id + /// NetworkManagers_Get + /// + /// + /// + /// The name of the network manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkManagerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkManagerName, nameof(networkManagerName)); + + using var scope = _networkManagerClientDiagnostics.CreateScope("NetworkManagerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkManagerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkManagerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkManagerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkPrivateEndpointConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkPrivateEndpointConnectionCollection.cs index 1bf2fe4d2c2d..5e5d56eb7912 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkPrivateEndpointConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkPrivateEndpointConnectionCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string peConnectionName, string expand = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName} + /// + /// + /// Operation Id + /// PrivateLinkServices_GetPrivateEndpointConnection + /// + /// + /// + /// The name of the private end point connection. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string peConnectionName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName)); + + using var scope = _networkPrivateEndpointConnectionPrivateLinkServicesClientDiagnostics.CreateScope("NetworkPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkPrivateEndpointConnectionPrivateLinkServicesRestClient.GetPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkPrivateEndpointConnectionResource(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.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName} + /// + /// + /// Operation Id + /// PrivateLinkServices_GetPrivateEndpointConnection + /// + /// + /// + /// The name of the private end point connection. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string peConnectionName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName)); + + using var scope = _networkPrivateEndpointConnectionPrivateLinkServicesClientDiagnostics.CreateScope("NetworkPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkPrivateEndpointConnectionPrivateLinkServicesRestClient.GetPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileCollection.cs index e934260ac439..e78eb9d14f72 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string networkProfileName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName} + /// + /// + /// Operation Id + /// NetworkProfiles_Get + /// + /// + /// + /// The name of the public IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkProfileName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkProfileName, nameof(networkProfileName)); + + using var scope = _networkProfileClientDiagnostics.CreateScope("NetworkProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkProfileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkProfileName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkProfileResource(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.Network/networkProfiles/{networkProfileName} + /// + /// + /// Operation Id + /// NetworkProfiles_Get + /// + /// + /// + /// The name of the public IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkProfileName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkProfileName, nameof(networkProfileName)); + + using var scope = _networkProfileClientDiagnostics.CreateScope("NetworkProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkProfileName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupCollection.cs index 913d09dba0d3..fd71aa99dc8e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string networkSecurityGroupName, string exp } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName} + /// + /// + /// Operation Id + /// NetworkSecurityGroups_Get + /// + /// + /// + /// The name of the network security group. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkSecurityGroupName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkSecurityGroupName, nameof(networkSecurityGroupName)); + + using var scope = _networkSecurityGroupClientDiagnostics.CreateScope("NetworkSecurityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkSecurityGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkSecurityGroupName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkSecurityGroupResource(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.Network/networkSecurityGroups/{networkSecurityGroupName} + /// + /// + /// Operation Id + /// NetworkSecurityGroups_Get + /// + /// + /// + /// The name of the network security group. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkSecurityGroupName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkSecurityGroupName, nameof(networkSecurityGroupName)); + + using var scope = _networkSecurityGroupClientDiagnostics.CreateScope("NetworkSecurityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkSecurityGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkSecurityGroupName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkSecurityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceCollection.cs index 442bffe84c2e..f8b94da69df8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string networkVirtualApplianceName, string } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName} + /// + /// + /// Operation Id + /// NetworkVirtualAppliances_Get + /// + /// + /// + /// The name of Network Virtual Appliance. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkVirtualApplianceName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkVirtualApplianceName, nameof(networkVirtualApplianceName)); + + using var scope = _networkVirtualApplianceClientDiagnostics.CreateScope("NetworkVirtualApplianceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkVirtualApplianceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkVirtualApplianceName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkVirtualApplianceResource(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.Network/networkVirtualAppliances/{networkVirtualApplianceName} + /// + /// + /// Operation Id + /// NetworkVirtualAppliances_Get + /// + /// + /// + /// The name of Network Virtual Appliance. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkVirtualApplianceName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkVirtualApplianceName, nameof(networkVirtualApplianceName)); + + using var scope = _networkVirtualApplianceClientDiagnostics.CreateScope("NetworkVirtualApplianceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkVirtualApplianceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkVirtualApplianceName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkVirtualApplianceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceConnectionCollection.cs index 3337194ca4e4..7db32f4d631d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName} + /// + /// + /// Operation Id + /// NetworkVirtualApplianceConnections_Get + /// + /// + /// + /// The name of the NVA connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _networkVirtualApplianceConnectionClientDiagnostics.CreateScope("NetworkVirtualApplianceConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkVirtualApplianceConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkVirtualApplianceConnectionResource(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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName} + /// + /// + /// Operation Id + /// NetworkVirtualApplianceConnections_Get + /// + /// + /// + /// The name of the NVA connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _networkVirtualApplianceConnectionClientDiagnostics.CreateScope("NetworkVirtualApplianceConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkVirtualApplianceConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkVirtualApplianceConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceSkuCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceSkuCollection.cs index 7d74b7e53c77..7fd64818d0be 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceSkuCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceSkuCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string skuName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName} + /// + /// + /// Operation Id + /// VirtualApplianceSkus_Get + /// + /// + /// + /// Name of the Sku. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string skuName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + using var scope = _networkVirtualApplianceSkuVirtualApplianceSkusClientDiagnostics.CreateScope("NetworkVirtualApplianceSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkVirtualApplianceSkuVirtualApplianceSkusRestClient.GetAsync(Id.SubscriptionId, skuName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkVirtualApplianceSkuResource(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}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName} + /// + /// + /// Operation Id + /// VirtualApplianceSkus_Get + /// + /// + /// + /// Name of the Sku. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string skuName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + using var scope = _networkVirtualApplianceSkuVirtualApplianceSkusClientDiagnostics.CreateScope("NetworkVirtualApplianceSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkVirtualApplianceSkuVirtualApplianceSkusRestClient.Get(Id.SubscriptionId, skuName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkVirtualApplianceSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherCollection.cs index ecf81cab1e18..5174219eebf0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string networkWatcherName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName} + /// + /// + /// Operation Id + /// NetworkWatchers_Get + /// + /// + /// + /// The name of the network watcher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkWatcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkWatcherName, nameof(networkWatcherName)); + + using var scope = _networkWatcherClientDiagnostics.CreateScope("NetworkWatcherCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkWatcherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkWatcherName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkWatcherResource(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.Network/networkWatchers/{networkWatcherName} + /// + /// + /// Operation Id + /// NetworkWatchers_Get + /// + /// + /// + /// The name of the network watcher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkWatcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkWatcherName, nameof(networkWatcherName)); + + using var scope = _networkWatcherClientDiagnostics.CreateScope("NetworkWatcherCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkWatcherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkWatcherName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkWatcherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/OutboundRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/OutboundRuleCollection.cs index 91e073437687..eda3df22eaa7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/OutboundRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/OutboundRuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string outboundRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName} + /// + /// + /// Operation Id + /// LoadBalancerOutboundRules_Get + /// + /// + /// + /// The name of the outbound rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string outboundRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(outboundRuleName, nameof(outboundRuleName)); + + using var scope = _outboundRuleLoadBalancerOutboundRulesClientDiagnostics.CreateScope("OutboundRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _outboundRuleLoadBalancerOutboundRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OutboundRuleResource(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.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName} + /// + /// + /// Operation Id + /// LoadBalancerOutboundRules_Get + /// + /// + /// + /// The name of the outbound rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string outboundRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(outboundRuleName, nameof(outboundRuleName)); + + using var scope = _outboundRuleLoadBalancerOutboundRulesClientDiagnostics.CreateScope("OutboundRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _outboundRuleLoadBalancerOutboundRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OutboundRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayCollection.cs index 6f409a3eab8b..1e0c04d8b660 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string gatewayName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName} + /// + /// + /// Operation Id + /// P2sVpnGateways_Get + /// + /// + /// + /// The name of the gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _p2sVpnGatewayP2sVpnGatewaysClientDiagnostics.CreateScope("P2SVpnGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _p2sVpnGatewayP2sVpnGatewaysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, gatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new P2SVpnGatewayResource(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.Network/p2svpnGateways/{gatewayName} + /// + /// + /// Operation Id + /// P2sVpnGateways_Get + /// + /// + /// + /// The name of the gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _p2sVpnGatewayP2sVpnGatewaysClientDiagnostics.CreateScope("P2SVpnGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _p2sVpnGatewayP2sVpnGatewaysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, gatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new P2SVpnGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureCollection.cs index 2f14a0a5af73..1b7c80167357 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string packetCaptureName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName} + /// + /// + /// Operation Id + /// PacketCaptures_Get + /// + /// + /// + /// The name of the packet capture session. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string packetCaptureName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packetCaptureName, nameof(packetCaptureName)); + + using var scope = _packetCaptureClientDiagnostics.CreateScope("PacketCaptureCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _packetCaptureRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, packetCaptureName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PacketCaptureResource(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.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName} + /// + /// + /// Operation Id + /// PacketCaptures_Get + /// + /// + /// + /// The name of the packet capture session. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string packetCaptureName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(packetCaptureName, nameof(packetCaptureName)); + + using var scope = _packetCaptureClientDiagnostics.CreateScope("PacketCaptureCollection.GetIfExists"); + scope.Start(); + try + { + var response = _packetCaptureRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, packetCaptureName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PacketCaptureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PeerExpressRouteCircuitConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PeerExpressRouteCircuitConnectionCollection.cs index d13b38e1c2cf..f3ea2a8be9d9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PeerExpressRouteCircuitConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PeerExpressRouteCircuitConnectionCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections/{connectionName} + /// + /// + /// Operation Id + /// PeerExpressRouteCircuitConnections_Get + /// + /// + /// + /// The name of the peer express route circuit connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _peerExpressRouteCircuitConnectionClientDiagnostics.CreateScope("PeerExpressRouteCircuitConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _peerExpressRouteCircuitConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeerExpressRouteCircuitConnectionResource(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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections/{connectionName} + /// + /// + /// Operation Id + /// PeerExpressRouteCircuitConnections_Get + /// + /// + /// + /// The name of the peer express route circuit connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _peerExpressRouteCircuitConnectionClientDiagnostics.CreateScope("PeerExpressRouteCircuitConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _peerExpressRouteCircuitConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeerExpressRouteCircuitConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupCollection.cs index 235b7d0562a9..0a899835aee8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateDnsZoneGroupName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName} + /// + /// + /// Operation Id + /// PrivateDnsZoneGroups_Get + /// + /// + /// + /// The name of the private dns zone group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateDnsZoneGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateDnsZoneGroupName, nameof(privateDnsZoneGroupName)); + + using var scope = _privateDnsZoneGroupClientDiagnostics.CreateScope("PrivateDnsZoneGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateDnsZoneGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateDnsZoneGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateDnsZoneGroupResource(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.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName} + /// + /// + /// Operation Id + /// PrivateDnsZoneGroups_Get + /// + /// + /// + /// The name of the private dns zone group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateDnsZoneGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateDnsZoneGroupName, nameof(privateDnsZoneGroupName)); + + using var scope = _privateDnsZoneGroupClientDiagnostics.CreateScope("PrivateDnsZoneGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateDnsZoneGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateDnsZoneGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateDnsZoneGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointCollection.cs index d17bfd10e4bd..8a272c3dabe1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string privateEndpointName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// PrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _privateEndpointClientDiagnostics.CreateScope("PrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateEndpointName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointResource(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.Network/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// PrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _privateEndpointClientDiagnostics.CreateScope("PrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateEndpointName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceCollection.cs index b27bdc82829c..2dd200a1a8a3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string serviceName, string expand = null, C } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName} + /// + /// + /// Operation Id + /// PrivateLinkServices_Get + /// + /// + /// + /// The name of the private link service. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _privateLinkServiceClientDiagnostics.CreateScope("PrivateLinkServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateLinkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateLinkServiceResource(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.Network/privateLinkServices/{serviceName} + /// + /// + /// Operation Id + /// PrivateLinkServices_Get + /// + /// + /// + /// The name of the private link service. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _privateLinkServiceClientDiagnostics.CreateScope("PrivateLinkServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateLinkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serviceName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateLinkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ProbeCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ProbeCollection.cs index bfcc5f3b6b79..5c8b3f76e415 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ProbeCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ProbeCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string probeName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName} + /// + /// + /// Operation Id + /// LoadBalancerProbes_Get + /// + /// + /// + /// The name of the probe. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string probeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(probeName, nameof(probeName)); + + using var scope = _probeLoadBalancerProbesClientDiagnostics.CreateScope("ProbeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _probeLoadBalancerProbesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, probeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProbeResource(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.Network/loadBalancers/{loadBalancerName}/probes/{probeName} + /// + /// + /// Operation Id + /// LoadBalancerProbes_Get + /// + /// + /// + /// The name of the probe. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string probeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(probeName, nameof(probeName)); + + using var scope = _probeLoadBalancerProbesClientDiagnostics.CreateScope("ProbeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _probeLoadBalancerProbesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, probeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProbeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressCollection.cs index ea8e2bb0d1e9..79d79f976597 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string publicIPAddressName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName} + /// + /// + /// Operation Id + /// PublicIPAddresses_Get + /// + /// + /// + /// The name of the public IP address. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publicIPAddressName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPAddressName, nameof(publicIPAddressName)); + + using var scope = _publicIPAddressClientDiagnostics.CreateScope("PublicIPAddressCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _publicIPAddressRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publicIPAddressName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublicIPAddressResource(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.Network/publicIPAddresses/{publicIpAddressName} + /// + /// + /// Operation Id + /// PublicIPAddresses_Get + /// + /// + /// + /// The name of the public IP address. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publicIPAddressName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPAddressName, nameof(publicIPAddressName)); + + using var scope = _publicIPAddressClientDiagnostics.CreateScope("PublicIPAddressCollection.GetIfExists"); + scope.Start(); + try + { + var response = _publicIPAddressRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publicIPAddressName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublicIPAddressResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixCollection.cs index 9c5e1491b435..375ec623b048 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string publicIPPrefixName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName} + /// + /// + /// Operation Id + /// PublicIPPrefixes_Get + /// + /// + /// + /// The name of the public IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publicIPPrefixName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPPrefixName, nameof(publicIPPrefixName)); + + using var scope = _publicIPPrefixClientDiagnostics.CreateScope("PublicIPPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _publicIPPrefixRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publicIPPrefixName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublicIPPrefixResource(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.Network/publicIPPrefixes/{publicIpPrefixName} + /// + /// + /// Operation Id + /// PublicIPPrefixes_Get + /// + /// + /// + /// The name of the public IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publicIPPrefixName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPPrefixName, nameof(publicIPPrefixName)); + + using var scope = _publicIPPrefixClientDiagnostics.CreateScope("PublicIPPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = _publicIPPrefixRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publicIPPrefixName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublicIPPrefixResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteCollection.cs index 229f2dca5eb8..38084670d5fb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string routeName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName} + /// + /// + /// Operation Id + /// Routes_Get + /// + /// + /// + /// The name of the route. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeName, nameof(routeName)); + + using var scope = _routeClientDiagnostics.CreateScope("RouteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _routeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteResource(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.Network/routeTables/{routeTableName}/routes/{routeName} + /// + /// + /// Operation Id + /// Routes_Get + /// + /// + /// + /// The name of the route. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeName, nameof(routeName)); + + using var scope = _routeClientDiagnostics.CreateScope("RouteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _routeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterCollection.cs index 592cd5db6892..d9c769bdcfb9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string routeFilterName, string expand = nul } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName} + /// + /// + /// Operation Id + /// RouteFilters_Get + /// + /// + /// + /// The name of the route filter. + /// Expands referenced express route bgp peering resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routeFilterName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeFilterName, nameof(routeFilterName)); + + using var scope = _routeFilterClientDiagnostics.CreateScope("RouteFilterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _routeFilterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, routeFilterName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteFilterResource(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.Network/routeFilters/{routeFilterName} + /// + /// + /// Operation Id + /// RouteFilters_Get + /// + /// + /// + /// The name of the route filter. + /// Expands referenced express route bgp peering resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routeFilterName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeFilterName, nameof(routeFilterName)); + + using var scope = _routeFilterClientDiagnostics.CreateScope("RouteFilterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _routeFilterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, routeFilterName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteFilterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleCollection.cs index e56788517027..a4ca91bbac7e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName} + /// + /// + /// Operation Id + /// RouteFilterRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _routeFilterRuleClientDiagnostics.CreateScope("RouteFilterRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _routeFilterRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteFilterRuleResource(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.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName} + /// + /// + /// Operation Id + /// RouteFilterRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _routeFilterRuleClientDiagnostics.CreateScope("RouteFilterRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _routeFilterRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteFilterRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteMapCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteMapCollection.cs index 765901dcd19e..962a45dd62de 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteMapCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteMapCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string routeMapName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName} + /// + /// + /// Operation Id + /// RouteMaps_Get + /// + /// + /// + /// The name of the RouteMap. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routeMapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeMapName, nameof(routeMapName)); + + using var scope = _routeMapClientDiagnostics.CreateScope("RouteMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _routeMapRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeMapName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteMapResource(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.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName} + /// + /// + /// Operation Id + /// RouteMaps_Get + /// + /// + /// + /// The name of the RouteMap. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routeMapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeMapName, nameof(routeMapName)); + + using var scope = _routeMapClientDiagnostics.CreateScope("RouteMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = _routeMapRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeMapName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteMapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableCollection.cs index 053dc199ea3f..a225741a2543 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string routeTableName, string expand = null } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName} + /// + /// + /// Operation Id + /// RouteTables_Get + /// + /// + /// + /// The name of the route table. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routeTableName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeTableName, nameof(routeTableName)); + + using var scope = _routeTableClientDiagnostics.CreateScope("RouteTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _routeTableRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, routeTableName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteTableResource(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.Network/routeTables/{routeTableName} + /// + /// + /// Operation Id + /// RouteTables_Get + /// + /// + /// + /// The name of the route table. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routeTableName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeTableName, nameof(routeTableName)); + + using var scope = _routeTableClientDiagnostics.CreateScope("RouteTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _routeTableRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, routeTableName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RouteTableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RoutingIntentCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RoutingIntentCollection.cs index ecafc88e677f..c1c8e14164f3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RoutingIntentCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RoutingIntentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string routingIntentName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName} + /// + /// + /// Operation Id + /// RoutingIntent_Get + /// + /// + /// + /// The name of the RoutingIntent. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routingIntentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routingIntentName, nameof(routingIntentName)); + + using var scope = _routingIntentClientDiagnostics.CreateScope("RoutingIntentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _routingIntentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routingIntentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoutingIntentResource(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.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName} + /// + /// + /// Operation Id + /// RoutingIntent_Get + /// + /// + /// + /// The name of the RoutingIntent. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routingIntentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routingIntentName, nameof(routingIntentName)); + + using var scope = _routingIntentClientDiagnostics.CreateScope("RoutingIntentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _routingIntentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routingIntentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoutingIntentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ScopeConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ScopeConnectionCollection.cs index 2ed5942cf3b4..b28415cfb0b3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ScopeConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ScopeConnectionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string scopeConnectionName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName} + /// + /// + /// Operation Id + /// ScopeConnections_Get + /// + /// + /// + /// Name for the cross-tenant connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scopeConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeConnectionName, nameof(scopeConnectionName)); + + using var scope = _scopeConnectionClientDiagnostics.CreateScope("ScopeConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scopeConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scopeConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScopeConnectionResource(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.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName} + /// + /// + /// Operation Id + /// ScopeConnections_Get + /// + /// + /// + /// Name for the cross-tenant connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scopeConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeConnectionName, nameof(scopeConnectionName)); + + using var scope = _scopeConnectionClientDiagnostics.CreateScope("ScopeConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scopeConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scopeConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScopeConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationCollection.cs index 15aab1be908f..3cad5c66fe64 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName} + /// + /// + /// Operation Id + /// SecurityAdminConfigurations_Get + /// + /// + /// + /// The name of the network manager Security Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _securityAdminConfigurationClientDiagnostics.CreateScope("SecurityAdminConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityAdminConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityAdminConfigurationResource(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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName} + /// + /// + /// Operation Id + /// SecurityAdminConfigurations_Get + /// + /// + /// + /// The name of the network manager Security Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _securityAdminConfigurationClientDiagnostics.CreateScope("SecurityAdminConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityAdminConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityAdminConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderCollection.cs index 4e10fb9f516e..18367058a3f4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string securityPartnerProviderName, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName} + /// + /// + /// Operation Id + /// SecurityPartnerProviders_Get + /// + /// + /// + /// The name of the Security Partner Provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string securityPartnerProviderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityPartnerProviderName, nameof(securityPartnerProviderName)); + + using var scope = _securityPartnerProviderClientDiagnostics.CreateScope("SecurityPartnerProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityPartnerProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, securityPartnerProviderName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityPartnerProviderResource(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.Network/securityPartnerProviders/{securityPartnerProviderName} + /// + /// + /// Operation Id + /// SecurityPartnerProviders_Get + /// + /// + /// + /// The name of the Security Partner Provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string securityPartnerProviderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityPartnerProviderName, nameof(securityPartnerProviderName)); + + using var scope = _securityPartnerProviderClientDiagnostics.CreateScope("SecurityPartnerProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityPartnerProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, securityPartnerProviderName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityPartnerProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleCollection.cs index 4281704905c9..eb0c2b883ef3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string securityRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName} + /// + /// + /// Operation Id + /// SecurityRules_Get + /// + /// + /// + /// The name of the security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string securityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityRuleName, nameof(securityRuleName)); + + using var scope = _securityRuleClientDiagnostics.CreateScope("SecurityRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityRuleResource(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.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName} + /// + /// + /// Operation Id + /// SecurityRules_Get + /// + /// + /// + /// The name of the security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string securityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityRuleName, nameof(securityRuleName)); + + using var scope = _securityRuleClientDiagnostics.CreateScope("SecurityRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyCollection.cs index 785f9e5b361f..b49edf4aba90 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string serviceEndpointPolicyName, string ex } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName} + /// + /// + /// Operation Id + /// ServiceEndpointPolicies_Get + /// + /// + /// + /// The name of the service endpoint policy. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceEndpointPolicyName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceEndpointPolicyName, nameof(serviceEndpointPolicyName)); + + using var scope = _serviceEndpointPolicyClientDiagnostics.CreateScope("ServiceEndpointPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceEndpointPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceEndpointPolicyName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceEndpointPolicyResource(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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName} + /// + /// + /// Operation Id + /// ServiceEndpointPolicies_Get + /// + /// + /// + /// The name of the service endpoint policy. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceEndpointPolicyName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceEndpointPolicyName, nameof(serviceEndpointPolicyName)); + + using var scope = _serviceEndpointPolicyClientDiagnostics.CreateScope("ServiceEndpointPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceEndpointPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serviceEndpointPolicyName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceEndpointPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionCollection.cs index 3e38ee724b27..206944a5e666 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string serviceEndpointPolicyDefinitionName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName} + /// + /// + /// Operation Id + /// ServiceEndpointPolicyDefinitions_Get + /// + /// + /// + /// The name of the service endpoint policy definition name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceEndpointPolicyDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceEndpointPolicyDefinitionName, nameof(serviceEndpointPolicyDefinitionName)); + + using var scope = _serviceEndpointPolicyDefinitionClientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceEndpointPolicyDefinitionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceEndpointPolicyDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceEndpointPolicyDefinitionResource(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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName} + /// + /// + /// Operation Id + /// ServiceEndpointPolicyDefinitions_Get + /// + /// + /// + /// The name of the service endpoint policy definition name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceEndpointPolicyDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceEndpointPolicyDefinitionName, nameof(serviceEndpointPolicyDefinitionName)); + + using var scope = _serviceEndpointPolicyDefinitionClientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceEndpointPolicyDefinitionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceEndpointPolicyDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceEndpointPolicyDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetCollection.cs index 6ea043dfe6c1..92de5e9eccee 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string subnetName, string expand = null, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + /// + /// + /// Operation Id + /// Subnets_Get + /// + /// + /// + /// The name of the subnet. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string subnetName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); + + using var scope = _subnetClientDiagnostics.CreateScope("SubnetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subnetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subnetName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubnetResource(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.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + /// + /// + /// Operation Id + /// Subnets_Get + /// + /// + /// + /// The name of the subnet. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string subnetName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); + + using var scope = _subnetClientDiagnostics.CreateScope("SubnetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subnetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subnetName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubnetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubscriptionNetworkManagerConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubscriptionNetworkManagerConnectionCollection.cs index 4ed5834b7633..a7a304b54923 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubscriptionNetworkManagerConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubscriptionNetworkManagerConnectionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string networkManagerConnectionName, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName} + /// + /// + /// Operation Id + /// SubscriptionNetworkManagerConnections_Get + /// + /// + /// + /// Name for the network manager connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkManagerConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkManagerConnectionName, nameof(networkManagerConnectionName)); + + using var scope = _subscriptionNetworkManagerConnectionClientDiagnostics.CreateScope("SubscriptionNetworkManagerConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionNetworkManagerConnectionRestClient.GetAsync(Id.SubscriptionId, networkManagerConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionNetworkManagerConnectionResource(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}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName} + /// + /// + /// Operation Id + /// SubscriptionNetworkManagerConnections_Get + /// + /// + /// + /// Name for the network manager connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkManagerConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkManagerConnectionName, nameof(networkManagerConnectionName)); + + using var scope = _subscriptionNetworkManagerConnectionClientDiagnostics.CreateScope("SubscriptionNetworkManagerConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionNetworkManagerConnectionRestClient.Get(Id.SubscriptionId, networkManagerConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionNetworkManagerConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteCollection.cs index 7388a6fb0b79..1bd926a1607f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string siteName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName} + /// + /// + /// Operation Id + /// VirtualApplianceSites_Get + /// + /// + /// + /// The name of the site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _virtualApplianceSiteClientDiagnostics.CreateScope("VirtualApplianceSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualApplianceSiteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualApplianceSiteResource(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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName} + /// + /// + /// Operation Id + /// VirtualApplianceSites_Get + /// + /// + /// + /// The name of the site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _virtualApplianceSiteClientDiagnostics.CreateScope("VirtualApplianceSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualApplianceSiteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualApplianceSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubCollection.cs index c36b84242702..6ff743e1bb45 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualHubName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName} + /// + /// + /// Operation Id + /// VirtualHubs_Get + /// + /// + /// + /// The name of the VirtualHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualHubName, nameof(virtualHubName)); + + using var scope = _virtualHubClientDiagnostics.CreateScope("VirtualHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualHubName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualHubResource(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.Network/virtualHubs/{virtualHubName} + /// + /// + /// Operation Id + /// VirtualHubs_Get + /// + /// + /// + /// The name of the VirtualHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualHubName, nameof(virtualHubName)); + + using var scope = _virtualHubClientDiagnostics.CreateScope("VirtualHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualHubName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Collection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Collection.cs index 5bd54317eef8..4d9191dd212d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Collection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Collection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string routeTableName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName} + /// + /// + /// Operation Id + /// VirtualHubRouteTableV2s_Get + /// + /// + /// + /// The name of the VirtualHubRouteTableV2. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string routeTableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeTableName, nameof(routeTableName)); + + using var scope = _virtualHubRouteTableV2ClientDiagnostics.CreateScope("VirtualHubRouteTableV2Collection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualHubRouteTableV2RestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeTableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualHubRouteTableV2Resource(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.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName} + /// + /// + /// Operation Id + /// VirtualHubRouteTableV2s_Get + /// + /// + /// + /// The name of the VirtualHubRouteTableV2. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string routeTableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(routeTableName, nameof(routeTableName)); + + using var scope = _virtualHubRouteTableV2ClientDiagnostics.CreateScope("VirtualHubRouteTableV2Collection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualHubRouteTableV2RestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeTableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualHubRouteTableV2Resource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkCollection.cs index 9ca36ad773f2..f396d35a34b1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string virtualNetworkName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// The name of the virtual network. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var scope = _virtualNetworkClientDiagnostics.CreateScope("VirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkResource(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.Network/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// The name of the virtual network. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var scope = _virtualNetworkClientDiagnostics.CreateScope("VirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayCollection.cs index 5fb1c092b3eb..129b60cef428 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualNetworkGatewayName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName} + /// + /// + /// Operation Id + /// VirtualNetworkGateways_Get + /// + /// + /// + /// The name of the virtual network gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkGatewayName, nameof(virtualNetworkGatewayName)); + + using var scope = _virtualNetworkGatewayClientDiagnostics.CreateScope("VirtualNetworkGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualNetworkGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkGatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkGatewayResource(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.Network/virtualNetworkGateways/{virtualNetworkGatewayName} + /// + /// + /// Operation Id + /// VirtualNetworkGateways_Get + /// + /// + /// + /// The name of the virtual network gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkGatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkGatewayName, nameof(virtualNetworkGatewayName)); + + using var scope = _virtualNetworkGatewayClientDiagnostics.CreateScope("VirtualNetworkGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualNetworkGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkGatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionCollection.cs index 1b0de95f54fb..72f4ad98612d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualNetworkGatewayConnectionName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName} + /// + /// + /// Operation Id + /// VirtualNetworkGatewayConnections_Get + /// + /// + /// + /// The name of the virtual network gateway connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkGatewayConnectionName, nameof(virtualNetworkGatewayConnectionName)); + + using var scope = _virtualNetworkGatewayConnectionClientDiagnostics.CreateScope("VirtualNetworkGatewayConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualNetworkGatewayConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkGatewayConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkGatewayConnectionResource(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.Network/connections/{virtualNetworkGatewayConnectionName} + /// + /// + /// Operation Id + /// VirtualNetworkGatewayConnections_Get + /// + /// + /// + /// The name of the virtual network gateway connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkGatewayConnectionName, nameof(virtualNetworkGatewayConnectionName)); + + using var scope = _virtualNetworkGatewayConnectionClientDiagnostics.CreateScope("VirtualNetworkGatewayConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualNetworkGatewayConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkGatewayConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkGatewayConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleCollection.cs index 1d05ebc30a01..3c103c970b89 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string natRuleName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkGatewayNatRules_Get + /// + /// + /// + /// The name of the nat rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string natRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(natRuleName, nameof(natRuleName)); + + using var scope = _virtualNetworkGatewayNatRuleClientDiagnostics.CreateScope("VirtualNetworkGatewayNatRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualNetworkGatewayNatRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, natRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkGatewayNatRuleResource(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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkGatewayNatRules_Get + /// + /// + /// + /// The name of the nat rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string natRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(natRuleName, nameof(natRuleName)); + + using var scope = _virtualNetworkGatewayNatRuleClientDiagnostics.CreateScope("VirtualNetworkGatewayNatRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualNetworkGatewayNatRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, natRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkGatewayNatRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringCollection.cs index ac2a2939f57e..79cde4456967 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string virtualNetworkPeeringName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName} + /// + /// + /// Operation Id + /// VirtualNetworkPeerings_Get + /// + /// + /// + /// The name of the virtual network peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkPeeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkPeeringName, nameof(virtualNetworkPeeringName)); + + using var scope = _virtualNetworkPeeringClientDiagnostics.CreateScope("VirtualNetworkPeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualNetworkPeeringRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkPeeringName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkPeeringResource(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.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName} + /// + /// + /// Operation Id + /// VirtualNetworkPeerings_Get + /// + /// + /// + /// The name of the virtual network peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkPeeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkPeeringName, nameof(virtualNetworkPeeringName)); + + using var scope = _virtualNetworkPeeringClientDiagnostics.CreateScope("VirtualNetworkPeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualNetworkPeeringRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkPeeringName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkPeeringResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapCollection.cs index 448ced5e9b2b..98e3498b1a23 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string tapName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName} + /// + /// + /// Operation Id + /// VirtualNetworkTaps_Get + /// + /// + /// + /// The name of virtual network tap. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tapName, nameof(tapName)); + + using var scope = _virtualNetworkTapClientDiagnostics.CreateScope("VirtualNetworkTapCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualNetworkTapRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, tapName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkTapResource(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.Network/virtualNetworkTaps/{tapName} + /// + /// + /// Operation Id + /// VirtualNetworkTaps_Get + /// + /// + /// + /// The name of virtual network tap. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tapName, nameof(tapName)); + + using var scope = _virtualNetworkTapClientDiagnostics.CreateScope("VirtualNetworkTapCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualNetworkTapRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, tapName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkTapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterCollection.cs index b0e0eebda143..354610f32f03 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string virtualRouterName, string expand = n } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName} + /// + /// + /// Operation Id + /// VirtualRouters_Get + /// + /// + /// + /// The name of the Virtual Router. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualRouterName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualRouterName, nameof(virtualRouterName)); + + using var scope = _virtualRouterClientDiagnostics.CreateScope("VirtualRouterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualRouterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualRouterName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualRouterResource(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.Network/virtualRouters/{virtualRouterName} + /// + /// + /// Operation Id + /// VirtualRouters_Get + /// + /// + /// + /// The name of the Virtual Router. + /// Expands referenced resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualRouterName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualRouterName, nameof(virtualRouterName)); + + using var scope = _virtualRouterClientDiagnostics.CreateScope("VirtualRouterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualRouterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualRouterName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualRouterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringCollection.cs index 01107386dbfd..d692d9b5fa34 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string peeringName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName} + /// + /// + /// Operation Id + /// VirtualRouterPeerings_Get + /// + /// + /// + /// The name of the Virtual Router Peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string peeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); + + using var scope = _virtualRouterPeeringClientDiagnostics.CreateScope("VirtualRouterPeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualRouterPeeringRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualRouterPeeringResource(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.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName} + /// + /// + /// Operation Id + /// VirtualRouterPeerings_Get + /// + /// + /// + /// The name of the Virtual Router Peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string peeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); + + using var scope = _virtualRouterPeeringClientDiagnostics.CreateScope("VirtualRouterPeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualRouterPeeringRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualRouterPeeringResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWanCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWanCollection.cs index d18893e2ed15..7d4d8d9978b2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWanCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWanCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualWanName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName} + /// + /// + /// Operation Id + /// VirtualWans_Get + /// + /// + /// + /// The name of the VirtualWAN being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualWanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualWanName, nameof(virtualWanName)); + + using var scope = _virtualWanClientDiagnostics.CreateScope("VirtualWanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualWanRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualWanName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualWanResource(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.Network/virtualWans/{VirtualWANName} + /// + /// + /// Operation Id + /// VirtualWans_Get + /// + /// + /// + /// The name of the VirtualWAN being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualWanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualWanName, nameof(virtualWanName)); + + using var scope = _virtualWanClientDiagnostics.CreateScope("VirtualWanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualWanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualWanName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualWanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionCollection.cs index 2d5dfc5827c2..bc098373602b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string connectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName} + /// + /// + /// Operation Id + /// VpnConnections_Get + /// + /// + /// + /// The name of the vpn connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _vpnConnectionClientDiagnostics.CreateScope("VpnConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vpnConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnConnectionResource(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.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName} + /// + /// + /// Operation Id + /// VpnConnections_Get + /// + /// + /// + /// The name of the vpn connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); + + using var scope = _vpnConnectionClientDiagnostics.CreateScope("VpnConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vpnConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayCollection.cs index 3cf66fba6339..cd0cb4119241 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string gatewayName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName} + /// + /// + /// Operation Id + /// VpnGateways_Get + /// + /// + /// + /// The name of the gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _vpnGatewayClientDiagnostics.CreateScope("VpnGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vpnGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, gatewayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnGatewayResource(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.Network/vpnGateways/{gatewayName} + /// + /// + /// Operation Id + /// VpnGateways_Get + /// + /// + /// + /// The name of the gateway. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gatewayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName)); + + using var scope = _vpnGatewayClientDiagnostics.CreateScope("VpnGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vpnGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, gatewayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnGatewayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleCollection.cs index 4480eb205d01..6f9edfb20ae4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string natRuleName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName} + /// + /// + /// Operation Id + /// NatRules_Get + /// + /// + /// + /// The name of the nat rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string natRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(natRuleName, nameof(natRuleName)); + + using var scope = _vpnGatewayNatRuleNatRulesClientDiagnostics.CreateScope("VpnGatewayNatRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vpnGatewayNatRuleNatRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, natRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnGatewayNatRuleResource(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.Network/vpnGateways/{gatewayName}/natRules/{natRuleName} + /// + /// + /// Operation Id + /// NatRules_Get + /// + /// + /// + /// The name of the nat rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string natRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(natRuleName, nameof(natRuleName)); + + using var scope = _vpnGatewayNatRuleNatRulesClientDiagnostics.CreateScope("VpnGatewayNatRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vpnGatewayNatRuleNatRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, natRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnGatewayNatRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationCollection.cs index 3e8a8e51ae36..3b48ebfa7eae 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string vpnServerConfigurationName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName} + /// + /// + /// Operation Id + /// VpnServerConfigurations_Get + /// + /// + /// + /// The name of the VpnServerConfiguration being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vpnServerConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vpnServerConfigurationName, nameof(vpnServerConfigurationName)); + + using var scope = _vpnServerConfigurationClientDiagnostics.CreateScope("VpnServerConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vpnServerConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vpnServerConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnServerConfigurationResource(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.Network/vpnServerConfigurations/{vpnServerConfigurationName} + /// + /// + /// Operation Id + /// VpnServerConfigurations_Get + /// + /// + /// + /// The name of the VpnServerConfiguration being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vpnServerConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vpnServerConfigurationName, nameof(vpnServerConfigurationName)); + + using var scope = _vpnServerConfigurationClientDiagnostics.CreateScope("VpnServerConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vpnServerConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vpnServerConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnServerConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationPolicyGroupCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationPolicyGroupCollection.cs index e04527cdce13..3458235f80cb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationPolicyGroupCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationPolicyGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string configurationPolicyGroupName, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName} + /// + /// + /// Operation Id + /// ConfigurationPolicyGroups_Get + /// + /// + /// + /// The name of the ConfigurationPolicyGroup being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationPolicyGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationPolicyGroupName, nameof(configurationPolicyGroupName)); + + using var scope = _vpnServerConfigurationPolicyGroupConfigurationPolicyGroupsClientDiagnostics.CreateScope("VpnServerConfigurationPolicyGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vpnServerConfigurationPolicyGroupConfigurationPolicyGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationPolicyGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnServerConfigurationPolicyGroupResource(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.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName} + /// + /// + /// Operation Id + /// ConfigurationPolicyGroups_Get + /// + /// + /// + /// The name of the ConfigurationPolicyGroup being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationPolicyGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationPolicyGroupName, nameof(configurationPolicyGroupName)); + + using var scope = _vpnServerConfigurationPolicyGroupConfigurationPolicyGroupsClientDiagnostics.CreateScope("VpnServerConfigurationPolicyGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vpnServerConfigurationPolicyGroupConfigurationPolicyGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationPolicyGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnServerConfigurationPolicyGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteCollection.cs index 9038378d7377..695635cb2bf4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string vpnSiteName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName} + /// + /// + /// Operation Id + /// VpnSites_Get + /// + /// + /// + /// The name of the VpnSite being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vpnSiteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vpnSiteName, nameof(vpnSiteName)); + + using var scope = _vpnSiteClientDiagnostics.CreateScope("VpnSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vpnSiteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vpnSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnSiteResource(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.Network/vpnSites/{vpnSiteName} + /// + /// + /// Operation Id + /// VpnSites_Get + /// + /// + /// + /// The name of the VpnSite being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vpnSiteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vpnSiteName, nameof(vpnSiteName)); + + using var scope = _vpnSiteClientDiagnostics.CreateScope("VpnSiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vpnSiteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vpnSiteName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkCollection.cs index 0ff4db0b7564..f5c7bbfbc3bb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string vpnSiteLinkName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName} + /// + /// + /// Operation Id + /// VpnSiteLinks_Get + /// + /// + /// + /// The name of the VpnSiteLink being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vpnSiteLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vpnSiteLinkName, nameof(vpnSiteLinkName)); + + using var scope = _vpnSiteLinkClientDiagnostics.CreateScope("VpnSiteLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vpnSiteLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vpnSiteLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnSiteLinkResource(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.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName} + /// + /// + /// Operation Id + /// VpnSiteLinks_Get + /// + /// + /// + /// The name of the VpnSiteLink being retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vpnSiteLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vpnSiteLinkName, nameof(vpnSiteLinkName)); + + using var scope = _vpnSiteLinkClientDiagnostics.CreateScope("VpnSiteLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vpnSiteLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vpnSiteLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnSiteLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkConnectionCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkConnectionCollection.cs index 1255abc1e66e..0b3f37375eb0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkConnectionCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkConnectionCollection.cs @@ -246,6 +246,80 @@ public virtual Response Exists(string linkConnectionName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName} + /// + /// + /// Operation Id + /// VpnSiteLinkConnections_Get + /// + /// + /// + /// The name of the vpn connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string linkConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkConnectionName, nameof(linkConnectionName)); + + using var scope = _vpnSiteLinkConnectionClientDiagnostics.CreateScope("VpnSiteLinkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vpnSiteLinkConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnSiteLinkConnectionResource(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.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName} + /// + /// + /// Operation Id + /// VpnSiteLinkConnections_Get + /// + /// + /// + /// The name of the vpn connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkConnectionName, nameof(linkConnectionName)); + + using var scope = _vpnSiteLinkConnectionClientDiagnostics.CreateScope("VpnSiteLinkConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vpnSiteLinkConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VpnSiteLinkConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyCollection.cs index 0bd92ff916a4..b75427a64fba 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string policyName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// WebApplicationFirewallPolicies_Get + /// + /// + /// + /// The name of the policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _webApplicationFirewallPolicyClientDiagnostics.CreateScope("WebApplicationFirewallPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _webApplicationFirewallPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebApplicationFirewallPolicyResource(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.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// WebApplicationFirewallPolicies_Get + /// + /// + /// + /// The name of the policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _webApplicationFirewallPolicyClientDiagnostics.CreateScope("WebApplicationFirewallPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webApplicationFirewallPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WebApplicationFirewallPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudAgentPoolCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudAgentPoolCollection.cs index 93fa3abaab55..3f0380ea28db 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudAgentPoolCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudAgentPoolCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetKubernetesClusterAgentPool() Console.WriteLine($"Succeeded: {result}"); } + // Get Kubernetes cluster agent pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetKubernetesClusterAgentPool() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/AgentPools_Get.json + // this example is just showing the usage of "AgentPools_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 NetworkCloudKubernetesClusterResource created on azure + // for more information of creating NetworkCloudKubernetesClusterResource, please refer to the document of NetworkCloudKubernetesClusterResource + string subscriptionId = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + string kubernetesClusterName = "kubernetesClusterName"; + ResourceIdentifier networkCloudKubernetesClusterResourceId = NetworkCloudKubernetesClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, kubernetesClusterName); + NetworkCloudKubernetesClusterResource networkCloudKubernetesCluster = client.GetNetworkCloudKubernetesClusterResource(networkCloudKubernetesClusterResourceId); + + // get the collection of this NetworkCloudAgentPoolResource + NetworkCloudAgentPoolCollection collection = networkCloudKubernetesCluster.GetNetworkCloudAgentPools(); + + // invoke the operation + string agentPoolName = "agentPoolName"; + NullableResponse response = await collection.GetIfExistsAsync(agentPoolName); + NetworkCloudAgentPoolResource 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 + NetworkCloudAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update Kubernetes cluster agent pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBareMetalMachineCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBareMetalMachineCollection.cs index a042defcb64e..38e1911a545b 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBareMetalMachineCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBareMetalMachineCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_GetBareMetalMachine() Console.WriteLine($"Succeeded: {result}"); } + + // Get bare metal machine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBareMetalMachine() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/BareMetalMachines_Get.json + // this example is just showing the usage of "BareMetalMachines_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudBareMetalMachineResource + NetworkCloudBareMetalMachineCollection collection = resourceGroupResource.GetNetworkCloudBareMetalMachines(); + + // invoke the operation + string bareMetalMachineName = "bareMetalMachineName"; + NullableResponse response = await collection.GetIfExistsAsync(bareMetalMachineName); + NetworkCloudBareMetalMachineResource 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 + NetworkCloudBareMetalMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBareMetalMachineKeySetCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBareMetalMachineKeySetCollection.cs index 676f3a972762..c9fd06622672 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBareMetalMachineKeySetCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBareMetalMachineKeySetCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetBareMetalMachineKeySetOfCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get bare metal machine key set of cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBareMetalMachineKeySetOfCluster() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/BareMetalMachineKeySets_Get.json + // this example is just showing the usage of "BareMetalMachineKeySets_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 NetworkCloudClusterResource created on azure + // for more information of creating NetworkCloudClusterResource, please refer to the document of NetworkCloudClusterResource + string subscriptionId = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + string clusterName = "clusterName"; + ResourceIdentifier networkCloudClusterResourceId = NetworkCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + NetworkCloudClusterResource networkCloudCluster = client.GetNetworkCloudClusterResource(networkCloudClusterResourceId); + + // get the collection of this NetworkCloudBareMetalMachineKeySetResource + NetworkCloudBareMetalMachineKeySetCollection collection = networkCloudCluster.GetNetworkCloudBareMetalMachineKeySets(); + + // invoke the operation + string bareMetalMachineKeySetName = "bareMetalMachineKeySetName"; + NullableResponse response = await collection.GetIfExistsAsync(bareMetalMachineKeySetName); + NetworkCloudBareMetalMachineKeySetResource 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 + NetworkCloudBareMetalMachineKeySetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update bare metal machine key set of cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBmcKeySetCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBmcKeySetCollection.cs index 8c352cb9eb1c..686de8195457 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBmcKeySetCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudBmcKeySetCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetBaseboardManagementControllerKeySetOfCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get baseboard management controller key set of cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBaseboardManagementControllerKeySetOfCluster() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/BmcKeySets_Get.json + // this example is just showing the usage of "BmcKeySets_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 NetworkCloudClusterResource created on azure + // for more information of creating NetworkCloudClusterResource, please refer to the document of NetworkCloudClusterResource + string subscriptionId = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + string clusterName = "clusterName"; + ResourceIdentifier networkCloudClusterResourceId = NetworkCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + NetworkCloudClusterResource networkCloudCluster = client.GetNetworkCloudClusterResource(networkCloudClusterResourceId); + + // get the collection of this NetworkCloudBmcKeySetResource + NetworkCloudBmcKeySetCollection collection = networkCloudCluster.GetNetworkCloudBmcKeySets(); + + // invoke the operation + string bmcKeySetName = "bmcKeySetName"; + NullableResponse response = await collection.GetIfExistsAsync(bmcKeySetName); + NetworkCloudBmcKeySetResource 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 + NetworkCloudBmcKeySetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update baseboard management controller key set of cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudCloudServicesNetworkCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudCloudServicesNetworkCollection.cs index becc41138aee..d18dd955274a 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudCloudServicesNetworkCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudCloudServicesNetworkCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetCloudServicesNetwork() Console.WriteLine($"Succeeded: {result}"); } + // Get cloud services network + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCloudServicesNetwork() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/CloudServicesNetworks_Get.json + // this example is just showing the usage of "CloudServicesNetworks_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudCloudServicesNetworkResource + NetworkCloudCloudServicesNetworkCollection collection = resourceGroupResource.GetNetworkCloudCloudServicesNetworks(); + + // invoke the operation + string cloudServicesNetworkName = "cloudServicesNetworkName"; + NullableResponse response = await collection.GetIfExistsAsync(cloudServicesNetworkName); + NetworkCloudCloudServicesNetworkResource 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 + NetworkCloudCloudServicesNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update cloud services network [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterCollection.cs index 95baa9780992..8c0fdbdfbdd7 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCluster() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/Clusters_Get.json + // this example is just showing the usage of "Clusters_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudClusterResource + NetworkCloudClusterCollection collection = resourceGroupResource.GetNetworkCloudClusters(); + + // invoke the operation + string clusterName = "clusterName"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + NetworkCloudClusterResource 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 + NetworkCloudClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterManagerCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterManagerCollection.cs index 3eb53d0751ac..ff9676c90f78 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterManagerCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterManagerCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetClusterManager() Console.WriteLine($"Succeeded: {result}"); } + // Get cluster manager + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetClusterManager() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/ClusterManagers_Get.json + // this example is just showing the usage of "ClusterManagers_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudClusterManagerResource + NetworkCloudClusterManagerCollection collection = resourceGroupResource.GetNetworkCloudClusterManagers(); + + // invoke the operation + string clusterManagerName = "clusterManagerName"; + NullableResponse response = await collection.GetIfExistsAsync(clusterManagerName); + NetworkCloudClusterManagerResource 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 + NetworkCloudClusterManagerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update cluster manager [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterMetricsConfigurationCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterMetricsConfigurationCollection.cs index 2ae86d731a57..99c0906e5459 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterMetricsConfigurationCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudClusterMetricsConfigurationCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetMetricsConfigurationOfCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get metrics configuration of cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMetricsConfigurationOfCluster() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/ClusterMetricsConfigurations_Get.json + // this example is just showing the usage of "MetricsConfigurations_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 NetworkCloudClusterResource created on azure + // for more information of creating NetworkCloudClusterResource, please refer to the document of NetworkCloudClusterResource + string subscriptionId = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + string clusterName = "clusterName"; + ResourceIdentifier networkCloudClusterResourceId = NetworkCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + NetworkCloudClusterResource networkCloudCluster = client.GetNetworkCloudClusterResource(networkCloudClusterResourceId); + + // get the collection of this NetworkCloudClusterMetricsConfigurationResource + NetworkCloudClusterMetricsConfigurationCollection collection = networkCloudCluster.GetNetworkCloudClusterMetricsConfigurations(); + + // invoke the operation + string metricsConfigurationName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(metricsConfigurationName); + NetworkCloudClusterMetricsConfigurationResource 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 + NetworkCloudClusterMetricsConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update metrics configuration of cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudKubernetesClusterCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudKubernetesClusterCollection.cs index a1d6075eccfd..0a595b202389 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudKubernetesClusterCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudKubernetesClusterCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetKubernetesCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get Kubernetes cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetKubernetesCluster() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/KubernetesClusters_Get.json + // this example is just showing the usage of "KubernetesClusters_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudKubernetesClusterResource + NetworkCloudKubernetesClusterCollection collection = resourceGroupResource.GetNetworkCloudKubernetesClusters(); + + // invoke the operation + string kubernetesClusterName = "kubernetesClusterName"; + NullableResponse response = await collection.GetIfExistsAsync(kubernetesClusterName); + NetworkCloudKubernetesClusterResource 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 + NetworkCloudKubernetesClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update Kubernetes cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudL2NetworkCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudL2NetworkCollection.cs index d27d9a3cfbca..70f314a588ba 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudL2NetworkCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudL2NetworkCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetL2Network() Console.WriteLine($"Succeeded: {result}"); } + // Get L2 network + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetL2Network() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/L2Networks_Get.json + // this example is just showing the usage of "L2Networks_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudL2NetworkResource + NetworkCloudL2NetworkCollection collection = resourceGroupResource.GetNetworkCloudL2Networks(); + + // invoke the operation + string l2NetworkName = "l2NetworkName"; + NullableResponse response = await collection.GetIfExistsAsync(l2NetworkName); + NetworkCloudL2NetworkResource 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 + NetworkCloudL2NetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update L2 network [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudL3NetworkCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudL3NetworkCollection.cs index 9eb543b3378b..bd34ec0bbb43 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudL3NetworkCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudL3NetworkCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetL3network() Console.WriteLine($"Succeeded: {result}"); } + // Get L3network + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetL3network() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/L3Networks_Get.json + // this example is just showing the usage of "L3Networks_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudL3NetworkResource + NetworkCloudL3NetworkCollection collection = resourceGroupResource.GetNetworkCloudL3Networks(); + + // invoke the operation + string l3NetworkName = "l3NetworkName"; + NullableResponse response = await collection.GetIfExistsAsync(l3NetworkName); + NetworkCloudL3NetworkResource 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 + NetworkCloudL3NetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update L3 network [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudRackCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudRackCollection.cs index cea245a25a06..644e00c4732c 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudRackCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudRackCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_GetRack() Console.WriteLine($"Succeeded: {result}"); } + + // Get rack + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRack() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/Racks_Get.json + // this example is just showing the usage of "Racks_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudRackResource + NetworkCloudRackCollection collection = resourceGroupResource.GetNetworkCloudRacks(); + + // invoke the operation + string rackName = "rackName"; + NullableResponse response = await collection.GetIfExistsAsync(rackName); + NetworkCloudRackResource 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 + NetworkCloudRackData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudRackSkuCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudRackSkuCollection.cs index 7c7116166e43..ef960680fc86 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudRackSkuCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudRackSkuCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_GetRackSKUResource() Console.WriteLine($"Succeeded: {result}"); } + + // Get rack SKU resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRackSKUResource() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/RackSkus_Get.json + // this example is just showing the usage of "RackSkus_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "123e4567-e89b-12d3-a456-426655440000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this NetworkCloudRackSkuResource + NetworkCloudRackSkuCollection collection = subscriptionResource.GetNetworkCloudRackSkus(); + + // invoke the operation + string rackSkuName = "rackSkuName"; + NullableResponse response = await collection.GetIfExistsAsync(rackSkuName); + NetworkCloudRackSkuResource 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 + NetworkCloudRackSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudStorageApplianceCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudStorageApplianceCollection.cs index 4659ebbe2a23..195a6a7471ff 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudStorageApplianceCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudStorageApplianceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_GetStorageAppliance() Console.WriteLine($"Succeeded: {result}"); } + + // Get storage appliance + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetStorageAppliance() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/StorageAppliances_Get.json + // this example is just showing the usage of "StorageAppliances_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudStorageApplianceResource + NetworkCloudStorageApplianceCollection collection = resourceGroupResource.GetNetworkCloudStorageAppliances(); + + // invoke the operation + string storageApplianceName = "storageApplianceName"; + NullableResponse response = await collection.GetIfExistsAsync(storageApplianceName); + NetworkCloudStorageApplianceResource 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 + NetworkCloudStorageApplianceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudTrunkedNetworkCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudTrunkedNetworkCollection.cs index 45ea9aa912ab..373ab9264848 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudTrunkedNetworkCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudTrunkedNetworkCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetTrunkedNetwork() Console.WriteLine($"Succeeded: {result}"); } + // Get Trunked network + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTrunkedNetwork() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/TrunkedNetworks_Get.json + // this example is just showing the usage of "TrunkedNetworks_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudTrunkedNetworkResource + NetworkCloudTrunkedNetworkCollection collection = resourceGroupResource.GetNetworkCloudTrunkedNetworks(); + + // invoke the operation + string trunkedNetworkName = "trunkedNetworkName"; + NullableResponse response = await collection.GetIfExistsAsync(trunkedNetworkName); + NetworkCloudTrunkedNetworkResource 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 + NetworkCloudTrunkedNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update trunked network [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVirtualMachineCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVirtualMachineCollection.cs index 7b130bf5a6d8..74c55fd6e385 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVirtualMachineCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVirtualMachineCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + // Get virtual machine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachine() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/VirtualMachines_Get.json + // this example is just showing the usage of "VirtualMachines_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudVirtualMachineResource + NetworkCloudVirtualMachineCollection collection = resourceGroupResource.GetNetworkCloudVirtualMachines(); + + // invoke the operation + string virtualMachineName = "virtualMachineName"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineName); + NetworkCloudVirtualMachineResource 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 + NetworkCloudVirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update virtual machine [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVirtualMachineConsoleCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVirtualMachineConsoleCollection.cs index 651e68e6427c..f9abcf34832f 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVirtualMachineConsoleCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVirtualMachineConsoleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetVirtualMachineConsole() Console.WriteLine($"Succeeded: {result}"); } + // Get virtual machine console + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachineConsole() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/Consoles_Get.json + // this example is just showing the usage of "Consoles_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 NetworkCloudVirtualMachineResource created on azure + // for more information of creating NetworkCloudVirtualMachineResource, please refer to the document of NetworkCloudVirtualMachineResource + string subscriptionId = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + string virtualMachineName = "virtualMachineName"; + ResourceIdentifier networkCloudVirtualMachineResourceId = NetworkCloudVirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineName); + NetworkCloudVirtualMachineResource networkCloudVirtualMachine = client.GetNetworkCloudVirtualMachineResource(networkCloudVirtualMachineResourceId); + + // get the collection of this NetworkCloudVirtualMachineConsoleResource + NetworkCloudVirtualMachineConsoleCollection collection = networkCloudVirtualMachine.GetNetworkCloudVirtualMachineConsoles(); + + // invoke the operation + string consoleName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(consoleName); + NetworkCloudVirtualMachineConsoleResource 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 + NetworkCloudVirtualMachineConsoleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update virtual machine console [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVolumeCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVolumeCollection.cs index 1d633c396804..7270665ceacf 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVolumeCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/samples/Generated/Samples/Sample_NetworkCloudVolumeCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetVolume() Console.WriteLine($"Succeeded: {result}"); } + // Get volume + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVolume() + { + // Generated from example definition: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2023-07-01/examples/Volumes_Get.json + // this example is just showing the usage of "Volumes_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 = "123e4567-e89b-12d3-a456-426655440000"; + string resourceGroupName = "resourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkCloudVolumeResource + NetworkCloudVolumeCollection collection = resourceGroupResource.GetNetworkCloudVolumes(); + + // invoke the operation + string volumeName = "volumeName"; + NullableResponse response = await collection.GetIfExistsAsync(volumeName); + NetworkCloudVolumeResource 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 + NetworkCloudVolumeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update volume [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudAgentPoolCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudAgentPoolCollection.cs index 4839c4980424..a4eb00392b6d 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudAgentPoolCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudAgentPoolCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string agentPoolName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// AgentPools_Get + /// + /// + /// + /// The name of the Kubernetes cluster agent pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _networkCloudAgentPoolAgentPoolsClientDiagnostics.CreateScope("NetworkCloudAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudAgentPoolResource(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.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// AgentPools_Get + /// + /// + /// + /// The name of the Kubernetes cluster agent pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _networkCloudAgentPoolAgentPoolsClientDiagnostics.CreateScope("NetworkCloudAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudAgentPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineCollection.cs index b3b1efbf9f5b..bed175267793 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string bareMetalMachineName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName} + /// + /// + /// Operation Id + /// BareMetalMachines_Get + /// + /// + /// + /// The name of the bare metal machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string bareMetalMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bareMetalMachineName, nameof(bareMetalMachineName)); + + using var scope = _networkCloudBareMetalMachineBareMetalMachinesClientDiagnostics.CreateScope("NetworkCloudBareMetalMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudBareMetalMachineBareMetalMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, bareMetalMachineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudBareMetalMachineResource(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.NetworkCloud/bareMetalMachines/{bareMetalMachineName} + /// + /// + /// Operation Id + /// BareMetalMachines_Get + /// + /// + /// + /// The name of the bare metal machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string bareMetalMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bareMetalMachineName, nameof(bareMetalMachineName)); + + using var scope = _networkCloudBareMetalMachineBareMetalMachinesClientDiagnostics.CreateScope("NetworkCloudBareMetalMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudBareMetalMachineBareMetalMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, bareMetalMachineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudBareMetalMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineKeySetCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineKeySetCollection.cs index 4e7a7bb6b8f9..aa34bb75f30a 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineKeySetCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineKeySetCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string bareMetalMachineKeySetName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName} + /// + /// + /// Operation Id + /// BareMetalMachineKeySets_Get + /// + /// + /// + /// The name of the bare metal machine key set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string bareMetalMachineKeySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bareMetalMachineKeySetName, nameof(bareMetalMachineKeySetName)); + + using var scope = _networkCloudBareMetalMachineKeySetBareMetalMachineKeySetsClientDiagnostics.CreateScope("NetworkCloudBareMetalMachineKeySetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudBareMetalMachineKeySetBareMetalMachineKeySetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, bareMetalMachineKeySetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudBareMetalMachineKeySetResource(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.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName} + /// + /// + /// Operation Id + /// BareMetalMachineKeySets_Get + /// + /// + /// + /// The name of the bare metal machine key set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string bareMetalMachineKeySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bareMetalMachineKeySetName, nameof(bareMetalMachineKeySetName)); + + using var scope = _networkCloudBareMetalMachineKeySetBareMetalMachineKeySetsClientDiagnostics.CreateScope("NetworkCloudBareMetalMachineKeySetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudBareMetalMachineKeySetBareMetalMachineKeySetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, bareMetalMachineKeySetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudBareMetalMachineKeySetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBmcKeySetCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBmcKeySetCollection.cs index e8b8ea3e2344..d0bbb02ef85b 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBmcKeySetCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBmcKeySetCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string bmcKeySetName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName} + /// + /// + /// Operation Id + /// BmcKeySets_Get + /// + /// + /// + /// The name of the baseboard management controller key set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string bmcKeySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bmcKeySetName, nameof(bmcKeySetName)); + + using var scope = _networkCloudBmcKeySetBmcKeySetsClientDiagnostics.CreateScope("NetworkCloudBmcKeySetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudBmcKeySetBmcKeySetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, bmcKeySetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudBmcKeySetResource(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.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName} + /// + /// + /// Operation Id + /// BmcKeySets_Get + /// + /// + /// + /// The name of the baseboard management controller key set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string bmcKeySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bmcKeySetName, nameof(bmcKeySetName)); + + using var scope = _networkCloudBmcKeySetBmcKeySetsClientDiagnostics.CreateScope("NetworkCloudBmcKeySetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudBmcKeySetBmcKeySetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, bmcKeySetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudBmcKeySetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudCloudServicesNetworkCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudCloudServicesNetworkCollection.cs index f9c0299a710e..693ccae7384a 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudCloudServicesNetworkCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudCloudServicesNetworkCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string cloudServicesNetworkName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName} + /// + /// + /// Operation Id + /// CloudServicesNetworks_Get + /// + /// + /// + /// The name of the cloud services network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string cloudServicesNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudServicesNetworkName, nameof(cloudServicesNetworkName)); + + using var scope = _networkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics.CreateScope("NetworkCloudCloudServicesNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudCloudServicesNetworkCloudServicesNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, cloudServicesNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudCloudServicesNetworkResource(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.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName} + /// + /// + /// Operation Id + /// CloudServicesNetworks_Get + /// + /// + /// + /// The name of the cloud services network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string cloudServicesNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudServicesNetworkName, nameof(cloudServicesNetworkName)); + + using var scope = _networkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics.CreateScope("NetworkCloudCloudServicesNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudCloudServicesNetworkCloudServicesNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, cloudServicesNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudCloudServicesNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterCollection.cs index 43db573e08d9..fa820c26e421 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _networkCloudClusterClustersClientDiagnostics.CreateScope("NetworkCloudClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudClusterResource(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.NetworkCloud/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _networkCloudClusterClustersClientDiagnostics.CreateScope("NetworkCloudClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterManagerCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterManagerCollection.cs index 1b88fa445d09..55a340b194bd 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterManagerCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterManagerCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterManagerName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName} + /// + /// + /// Operation Id + /// ClusterManagers_Get + /// + /// + /// + /// The name of the cluster manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterManagerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterManagerName, nameof(clusterManagerName)); + + using var scope = _networkCloudClusterManagerClusterManagersClientDiagnostics.CreateScope("NetworkCloudClusterManagerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudClusterManagerClusterManagersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterManagerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudClusterManagerResource(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.NetworkCloud/clusterManagers/{clusterManagerName} + /// + /// + /// Operation Id + /// ClusterManagers_Get + /// + /// + /// + /// The name of the cluster manager. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterManagerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterManagerName, nameof(clusterManagerName)); + + using var scope = _networkCloudClusterManagerClusterManagersClientDiagnostics.CreateScope("NetworkCloudClusterManagerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudClusterManagerClusterManagersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterManagerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudClusterManagerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterMetricsConfigurationCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterMetricsConfigurationCollection.cs index 3dcc345d3ff5..08ea14aa2672 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterMetricsConfigurationCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterMetricsConfigurationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string metricsConfigurationName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName} + /// + /// + /// Operation Id + /// MetricsConfigurations_Get + /// + /// + /// + /// The name of the metrics configuration for the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string metricsConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(metricsConfigurationName, nameof(metricsConfigurationName)); + + using var scope = _networkCloudClusterMetricsConfigurationMetricsConfigurationsClientDiagnostics.CreateScope("NetworkCloudClusterMetricsConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudClusterMetricsConfigurationMetricsConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, metricsConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudClusterMetricsConfigurationResource(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.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName} + /// + /// + /// Operation Id + /// MetricsConfigurations_Get + /// + /// + /// + /// The name of the metrics configuration for the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string metricsConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(metricsConfigurationName, nameof(metricsConfigurationName)); + + using var scope = _networkCloudClusterMetricsConfigurationMetricsConfigurationsClientDiagnostics.CreateScope("NetworkCloudClusterMetricsConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudClusterMetricsConfigurationMetricsConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, metricsConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudClusterMetricsConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterCollection.cs index 93938ac3cdf7..cf1e2b94a5dd 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string kubernetesClusterName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName} + /// + /// + /// Operation Id + /// KubernetesClusters_Get + /// + /// + /// + /// The name of the Kubernetes cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string kubernetesClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(kubernetesClusterName, nameof(kubernetesClusterName)); + + using var scope = _networkCloudKubernetesClusterKubernetesClustersClientDiagnostics.CreateScope("NetworkCloudKubernetesClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudKubernetesClusterKubernetesClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, kubernetesClusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudKubernetesClusterResource(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.NetworkCloud/kubernetesClusters/{kubernetesClusterName} + /// + /// + /// Operation Id + /// KubernetesClusters_Get + /// + /// + /// + /// The name of the Kubernetes cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string kubernetesClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(kubernetesClusterName, nameof(kubernetesClusterName)); + + using var scope = _networkCloudKubernetesClusterKubernetesClustersClientDiagnostics.CreateScope("NetworkCloudKubernetesClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudKubernetesClusterKubernetesClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, kubernetesClusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudKubernetesClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL2NetworkCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL2NetworkCollection.cs index 9f9aae447741..108dc6bec446 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL2NetworkCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL2NetworkCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string l2NetworkName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName} + /// + /// + /// Operation Id + /// L2Networks_Get + /// + /// + /// + /// The name of the L2 network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string l2NetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(l2NetworkName, nameof(l2NetworkName)); + + using var scope = _networkCloudL2NetworkL2NetworksClientDiagnostics.CreateScope("NetworkCloudL2NetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudL2NetworkL2NetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, l2NetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudL2NetworkResource(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.NetworkCloud/l2Networks/{l2NetworkName} + /// + /// + /// Operation Id + /// L2Networks_Get + /// + /// + /// + /// The name of the L2 network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string l2NetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(l2NetworkName, nameof(l2NetworkName)); + + using var scope = _networkCloudL2NetworkL2NetworksClientDiagnostics.CreateScope("NetworkCloudL2NetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudL2NetworkL2NetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, l2NetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudL2NetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL3NetworkCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL3NetworkCollection.cs index 15051596c345..24b97c5a150b 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL3NetworkCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL3NetworkCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string l3NetworkName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName} + /// + /// + /// Operation Id + /// L3Networks_Get + /// + /// + /// + /// The name of the L3 network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string l3NetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(l3NetworkName, nameof(l3NetworkName)); + + using var scope = _networkCloudL3NetworkL3NetworksClientDiagnostics.CreateScope("NetworkCloudL3NetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudL3NetworkL3NetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, l3NetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudL3NetworkResource(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.NetworkCloud/l3Networks/{l3NetworkName} + /// + /// + /// Operation Id + /// L3Networks_Get + /// + /// + /// + /// The name of the L3 network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string l3NetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(l3NetworkName, nameof(l3NetworkName)); + + using var scope = _networkCloudL3NetworkL3NetworksClientDiagnostics.CreateScope("NetworkCloudL3NetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudL3NetworkL3NetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, l3NetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudL3NetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackCollection.cs index fb7f6f08a236..196211e6ebfc 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string rackName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName} + /// + /// + /// Operation Id + /// Racks_Get + /// + /// + /// + /// The name of the rack. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string rackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rackName, nameof(rackName)); + + using var scope = _networkCloudRackRacksClientDiagnostics.CreateScope("NetworkCloudRackCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudRackRacksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, rackName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudRackResource(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.NetworkCloud/racks/{rackName} + /// + /// + /// Operation Id + /// Racks_Get + /// + /// + /// + /// The name of the rack. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string rackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rackName, nameof(rackName)); + + using var scope = _networkCloudRackRacksClientDiagnostics.CreateScope("NetworkCloudRackCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudRackRacksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, rackName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudRackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackSkuCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackSkuCollection.cs index ccc9ce94c2e1..ae6836cd97ae 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackSkuCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackSkuCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string rackSkuName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus/{rackSkuName} + /// + /// + /// Operation Id + /// RackSkus_Get + /// + /// + /// + /// The name of the rack SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string rackSkuName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rackSkuName, nameof(rackSkuName)); + + using var scope = _networkCloudRackSkuRackSkusClientDiagnostics.CreateScope("NetworkCloudRackSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudRackSkuRackSkusRestClient.GetAsync(Id.SubscriptionId, rackSkuName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudRackSkuResource(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}/providers/Microsoft.NetworkCloud/rackSkus/{rackSkuName} + /// + /// + /// Operation Id + /// RackSkus_Get + /// + /// + /// + /// The name of the rack SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string rackSkuName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rackSkuName, nameof(rackSkuName)); + + using var scope = _networkCloudRackSkuRackSkusClientDiagnostics.CreateScope("NetworkCloudRackSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudRackSkuRackSkusRestClient.Get(Id.SubscriptionId, rackSkuName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudRackSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudStorageApplianceCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudStorageApplianceCollection.cs index 2aba63be7faa..c79e9fa814f8 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudStorageApplianceCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudStorageApplianceCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string storageApplianceName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName} + /// + /// + /// Operation Id + /// StorageAppliances_Get + /// + /// + /// + /// The name of the storage appliance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageApplianceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageApplianceName, nameof(storageApplianceName)); + + using var scope = _networkCloudStorageApplianceStorageAppliancesClientDiagnostics.CreateScope("NetworkCloudStorageApplianceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudStorageApplianceStorageAppliancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, storageApplianceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudStorageApplianceResource(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.NetworkCloud/storageAppliances/{storageApplianceName} + /// + /// + /// Operation Id + /// StorageAppliances_Get + /// + /// + /// + /// The name of the storage appliance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageApplianceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageApplianceName, nameof(storageApplianceName)); + + using var scope = _networkCloudStorageApplianceStorageAppliancesClientDiagnostics.CreateScope("NetworkCloudStorageApplianceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudStorageApplianceStorageAppliancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, storageApplianceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudStorageApplianceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudTrunkedNetworkCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudTrunkedNetworkCollection.cs index f0fa62ec9585..d9aef6c69a88 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudTrunkedNetworkCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudTrunkedNetworkCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string trunkedNetworkName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName} + /// + /// + /// Operation Id + /// TrunkedNetworks_Get + /// + /// + /// + /// The name of the trunked network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string trunkedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trunkedNetworkName, nameof(trunkedNetworkName)); + + using var scope = _networkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics.CreateScope("NetworkCloudTrunkedNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudTrunkedNetworkTrunkedNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, trunkedNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudTrunkedNetworkResource(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.NetworkCloud/trunkedNetworks/{trunkedNetworkName} + /// + /// + /// Operation Id + /// TrunkedNetworks_Get + /// + /// + /// + /// The name of the trunked network. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string trunkedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trunkedNetworkName, nameof(trunkedNetworkName)); + + using var scope = _networkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics.CreateScope("NetworkCloudTrunkedNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudTrunkedNetworkTrunkedNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, trunkedNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudTrunkedNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineCollection.cs index 22142eea6446..57503d4f257a 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualMachineName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); + + using var scope = _networkCloudVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("NetworkCloudVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudVirtualMachineVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudVirtualMachineResource(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.NetworkCloud/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); + + using var scope = _networkCloudVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("NetworkCloudVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineConsoleCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineConsoleCollection.cs index a7508b59aade..9d6e28008c1c 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineConsoleCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineConsoleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string consoleName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName} + /// + /// + /// Operation Id + /// Consoles_Get + /// + /// + /// + /// The name of the virtual machine console. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string consoleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(consoleName, nameof(consoleName)); + + using var scope = _networkCloudVirtualMachineConsoleConsolesClientDiagnostics.CreateScope("NetworkCloudVirtualMachineConsoleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudVirtualMachineConsoleConsolesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, consoleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudVirtualMachineConsoleResource(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.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName} + /// + /// + /// Operation Id + /// Consoles_Get + /// + /// + /// + /// The name of the virtual machine console. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string consoleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(consoleName, nameof(consoleName)); + + using var scope = _networkCloudVirtualMachineConsoleConsolesClientDiagnostics.CreateScope("NetworkCloudVirtualMachineConsoleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudVirtualMachineConsoleConsolesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, consoleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudVirtualMachineConsoleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVolumeCollection.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVolumeCollection.cs index 8e55c4705b7d..6fefc802be21 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVolumeCollection.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVolumeCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string volumeName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName} + /// + /// + /// Operation Id + /// Volumes_Get + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using var scope = _networkCloudVolumeVolumesClientDiagnostics.CreateScope("NetworkCloudVolumeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkCloudVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudVolumeResource(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.NetworkCloud/volumes/{volumeName} + /// + /// + /// Operation Id + /// Volumes_Get + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using var scope = _networkCloudVolumeVolumesClientDiagnostics.CreateScope("NetworkCloudVolumeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkCloudVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, volumeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkCloudVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/samples/Generated/Samples/Sample_AzureTrafficCollectorCollection.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/samples/Generated/Samples/Sample_AzureTrafficCollectorCollection.cs index 39a7760ee0a8..857f9f27b686 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/samples/Generated/Samples/Sample_AzureTrafficCollectorCollection.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/samples/Generated/Samples/Sample_AzureTrafficCollectorCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetTrafficCollector() Console.WriteLine($"Succeeded: {result}"); } + // Get Traffic Collector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTrafficCollector() + { + // Generated from example definition: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-11-01/examples/AzureTrafficCollectorGet.json + // this example is just showing the usage of "AzureTrafficCollectors_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureTrafficCollectorResource + AzureTrafficCollectorCollection collection = resourceGroupResource.GetAzureTrafficCollectors(); + + // invoke the operation + string azureTrafficCollectorName = "atc"; + NullableResponse response = await collection.GetIfExistsAsync(azureTrafficCollectorName); + AzureTrafficCollectorResource 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 + AzureTrafficCollectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a traffic collector [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/samples/Generated/Samples/Sample_CollectorPolicyCollection.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/samples/Generated/Samples/Sample_CollectorPolicyCollection.cs index 0284102693ab..caa47aa7ff80 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/samples/Generated/Samples/Sample_CollectorPolicyCollection.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/samples/Generated/Samples/Sample_CollectorPolicyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetCollectionPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get Collection Policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCollectionPolicy() + { + // Generated from example definition: specification/networkfunction/resource-manager/Microsoft.NetworkFunction/stable/2022-11-01/examples/CollectorPolicyGet.json + // this example is just showing the usage of "CollectorPolicies_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 AzureTrafficCollectorResource created on azure + // for more information of creating AzureTrafficCollectorResource, please refer to the document of AzureTrafficCollectorResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string azureTrafficCollectorName = "atc"; + ResourceIdentifier azureTrafficCollectorResourceId = AzureTrafficCollectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureTrafficCollectorName); + AzureTrafficCollectorResource azureTrafficCollector = client.GetAzureTrafficCollectorResource(azureTrafficCollectorResourceId); + + // get the collection of this CollectorPolicyResource + CollectorPolicyCollection collection = azureTrafficCollector.GetCollectorPolicies(); + + // invoke the operation + string collectorPolicyName = "cp1"; + NullableResponse response = await collection.GetIfExistsAsync(collectorPolicyName); + CollectorPolicyResource 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 + CollectorPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a collection policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorCollection.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorCollection.cs index e32d22514e54..8bce87fa0573 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorCollection.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string azureTrafficCollectorName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName} + /// + /// + /// Operation Id + /// AzureTrafficCollectors_Get + /// + /// + /// + /// Azure Traffic Collector name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureTrafficCollectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureTrafficCollectorName, nameof(azureTrafficCollectorName)); + + using var scope = _azureTrafficCollectorClientDiagnostics.CreateScope("AzureTrafficCollectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _azureTrafficCollectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureTrafficCollectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureTrafficCollectorResource(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.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName} + /// + /// + /// Operation Id + /// AzureTrafficCollectors_Get + /// + /// + /// + /// Azure Traffic Collector name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureTrafficCollectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureTrafficCollectorName, nameof(azureTrafficCollectorName)); + + using var scope = _azureTrafficCollectorClientDiagnostics.CreateScope("AzureTrafficCollectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _azureTrafficCollectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureTrafficCollectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureTrafficCollectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/CollectorPolicyCollection.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/CollectorPolicyCollection.cs index 40b77ca922d0..6de6cc6ac679 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/CollectorPolicyCollection.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/CollectorPolicyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string collectorPolicyName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName} + /// + /// + /// Operation Id + /// CollectorPolicies_Get + /// + /// + /// + /// Collector Policy Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string collectorPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(collectorPolicyName, nameof(collectorPolicyName)); + + using var scope = _collectorPolicyClientDiagnostics.CreateScope("CollectorPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _collectorPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, collectorPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CollectorPolicyResource(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.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName} + /// + /// + /// Operation Id + /// CollectorPolicies_Get + /// + /// + /// + /// Collector Policy Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string collectorPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(collectorPolicyName, nameof(collectorPolicyName)); + + using var scope = _collectorPolicyClientDiagnostics.CreateScope("CollectorPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _collectorPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, collectorPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CollectorPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/samples/Generated/Samples/Sample_NewRelicMonitorResourceCollection.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/samples/Generated/Samples/Sample_NewRelicMonitorResourceCollection.cs index 4c0de65fcd3d..f3542bd92753 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/samples/Generated/Samples/Sample_NewRelicMonitorResourceCollection.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/samples/Generated/Samples/Sample_NewRelicMonitorResourceCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_MonitorsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // Monitors_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MonitorsGetMaximumSetGen() + { + // Generated from example definition: specification/newrelic/resource-manager/NewRelic.Observability/stable/2022-07-01/examples/Monitors_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Monitors_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 = "hfmjmpyqgezxkp"; + string resourceGroupName = "rgNewRelic"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NewRelicMonitorResource + NewRelicMonitorResourceCollection collection = resourceGroupResource.GetNewRelicMonitorResources(); + + // invoke the operation + string monitorName = "cdlymktqw"; + NullableResponse response = await collection.GetIfExistsAsync(monitorName); + NewRelicMonitorResource 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 + NewRelicMonitorResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Monitors_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/samples/Generated/Samples/Sample_NewRelicObservabilityTagRuleCollection.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/samples/Generated/Samples/Sample_NewRelicObservabilityTagRuleCollection.cs index 903815a7cc80..6fd4efe32512 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/samples/Generated/Samples/Sample_NewRelicObservabilityTagRuleCollection.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/samples/Generated/Samples/Sample_NewRelicObservabilityTagRuleCollection.cs @@ -158,6 +158,49 @@ public async Task Exists_TagRulesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // TagRules_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TagRulesGetMaximumSetGen() + { + // Generated from example definition: specification/newrelic/resource-manager/NewRelic.Observability/stable/2022-07-01/examples/TagRules_Get_MaximumSet_Gen.json + // this example is just showing the usage of "TagRules_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 NewRelicMonitorResource created on azure + // for more information of creating NewRelicMonitorResource, please refer to the document of NewRelicMonitorResource + string subscriptionId = "ddqonpqwjr"; + string resourceGroupName = "rgopenapi"; + string monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + ResourceIdentifier newRelicMonitorResourceId = NewRelicMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + NewRelicMonitorResource newRelicMonitorResource = client.GetNewRelicMonitorResource(newRelicMonitorResourceId); + + // get the collection of this NewRelicObservabilityTagRuleResource + NewRelicObservabilityTagRuleCollection collection = newRelicMonitorResource.GetNewRelicObservabilityTagRules(); + + // invoke the operation + string ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + NullableResponse response = await collection.GetIfExistsAsync(ruleSetName); + NewRelicObservabilityTagRuleResource 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 + NewRelicObservabilityTagRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TagRules_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -224,6 +267,49 @@ public async Task Exists_TagRulesGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // TagRules_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TagRulesGetMinimumSetGen() + { + // Generated from example definition: specification/newrelic/resource-manager/NewRelic.Observability/stable/2022-07-01/examples/TagRules_Get_MinimumSet_Gen.json + // this example is just showing the usage of "TagRules_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 NewRelicMonitorResource created on azure + // for more information of creating NewRelicMonitorResource, please refer to the document of NewRelicMonitorResource + string subscriptionId = "ddqonpqwjr"; + string resourceGroupName = "rgopenapi"; + string monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + ResourceIdentifier newRelicMonitorResourceId = NewRelicMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + NewRelicMonitorResource newRelicMonitorResource = client.GetNewRelicMonitorResource(newRelicMonitorResourceId); + + // get the collection of this NewRelicObservabilityTagRuleResource + NewRelicObservabilityTagRuleCollection collection = newRelicMonitorResource.GetNewRelicObservabilityTagRules(); + + // invoke the operation + string ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + NullableResponse response = await collection.GetIfExistsAsync(ruleSetName); + NewRelicObservabilityTagRuleResource 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 + NewRelicObservabilityTagRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TagRules_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResourceCollection.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResourceCollection.cs index 660abc91b6f5..ee25149a77ee 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResourceCollection.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string monitorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Name of the Monitors 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 monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _newRelicMonitorResourceMonitorsClientDiagnostics.CreateScope("NewRelicMonitorResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _newRelicMonitorResourceMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NewRelicMonitorResource(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/NewRelic.Observability/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Name of the Monitors resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _newRelicMonitorResourceMonitorsClientDiagnostics.CreateScope("NewRelicMonitorResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _newRelicMonitorResourceMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NewRelicMonitorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicObservabilityTagRuleCollection.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicObservabilityTagRuleCollection.cs index 6c6bea5edeba..adf1f4d13581 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicObservabilityTagRuleCollection.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicObservabilityTagRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleSetName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName} + /// + /// + /// Operation Id + /// TagRules_Get + /// + /// + /// + /// Name of the TagRule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _newRelicObservabilityTagRuleTagRulesClientDiagnostics.CreateScope("NewRelicObservabilityTagRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _newRelicObservabilityTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NewRelicObservabilityTagRuleResource(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/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName} + /// + /// + /// Operation Id + /// TagRules_Get + /// + /// + /// + /// Name of the TagRule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _newRelicObservabilityTagRuleTagRulesClientDiagnostics.CreateScope("NewRelicObservabilityTagRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _newRelicObservabilityTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NewRelicObservabilityTagRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxCertificateCollection.cs b/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxCertificateCollection.cs index 87cc8e929252..f89223854812 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxCertificateCollection.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxCertificateCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_CertificatesGet() Console.WriteLine($"Succeeded: {result}"); } + // Certificates_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CertificatesGet() + { + // Generated from example definition: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2022-08-01/examples/Certificates_Get.json + // this example is just showing the usage of "Certificates_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 NginxDeploymentResource created on azure + // for more information of creating NginxDeploymentResource, please refer to the document of NginxDeploymentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string deploymentName = "myDeployment"; + ResourceIdentifier nginxDeploymentResourceId = NginxDeploymentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deploymentName); + NginxDeploymentResource nginxDeployment = client.GetNginxDeploymentResource(nginxDeploymentResourceId); + + // get the collection of this NginxCertificateResource + NginxCertificateCollection collection = nginxDeployment.GetNginxCertificates(); + + // invoke the operation + string certificateName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(certificateName); + NginxCertificateResource 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 + NginxCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Certificates_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxConfigurationCollection.cs b/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxConfigurationCollection.cs index a5ebbc9f1bcb..cd831d9d4996 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxConfigurationCollection.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxConfigurationCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ConfigurationsGet() Console.WriteLine($"Succeeded: {result}"); } + // Configurations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConfigurationsGet() + { + // Generated from example definition: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2022-08-01/examples/Configurations_Get.json + // this example is just showing the usage of "Configurations_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 NginxDeploymentResource created on azure + // for more information of creating NginxDeploymentResource, please refer to the document of NginxDeploymentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string deploymentName = "myDeployment"; + ResourceIdentifier nginxDeploymentResourceId = NginxDeploymentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deploymentName); + NginxDeploymentResource nginxDeployment = client.GetNginxDeploymentResource(nginxDeploymentResourceId); + + // get the collection of this NginxConfigurationResource + NginxConfigurationCollection collection = nginxDeployment.GetNginxConfigurations(); + + // invoke the operation + string configurationName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + NginxConfigurationResource 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 + NginxConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Configurations_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxDeploymentCollection.cs b/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxDeploymentCollection.cs index e113395847ab..391bb247d221 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxDeploymentCollection.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/samples/Generated/Samples/Sample_NginxDeploymentCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_DeploymentsGet() Console.WriteLine($"Succeeded: {result}"); } + // Deployments_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DeploymentsGet() + { + // Generated from example definition: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2022-08-01/examples/Deployments_Get.json + // this example is just showing the usage of "Deployments_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NginxDeploymentResource + NginxDeploymentCollection collection = resourceGroupResource.GetNginxDeployments(); + + // invoke the operation + string deploymentName = "myDeployment"; + NullableResponse response = await collection.GetIfExistsAsync(deploymentName); + NginxDeploymentResource 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 + NginxDeploymentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Deployments_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxCertificateCollection.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxCertificateCollection.cs index b538ed05ace6..6867b6a7a5c2 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxCertificateCollection.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// The name of certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _nginxCertificateCertificatesClientDiagnostics.CreateScope("NginxCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _nginxCertificateCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NginxCertificateResource(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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// The name of certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _nginxCertificateCertificatesClientDiagnostics.CreateScope("NginxCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _nginxCertificateCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NginxCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxConfigurationCollection.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxConfigurationCollection.cs index 2ff3b94f227d..c2fcb6862503 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxConfigurationCollection.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxConfigurationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of configuration, only 'default' is supported value due to the singleton of Nginx conf. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _nginxConfigurationConfigurationsClientDiagnostics.CreateScope("NginxConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _nginxConfigurationConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NginxConfigurationResource(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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of configuration, only 'default' is supported value due to the singleton of Nginx conf. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _nginxConfigurationConfigurationsClientDiagnostics.CreateScope("NginxConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _nginxConfigurationConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NginxConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentCollection.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentCollection.cs index 3136ac6bb464..1209360b3366 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentCollection.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string deploymentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The name of targeted Nginx deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _nginxDeploymentDeploymentsClientDiagnostics.CreateScope("NginxDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _nginxDeploymentDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NginxDeploymentResource(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/Nginx.NginxPlus/nginxDeployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The name of targeted Nginx deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _nginxDeploymentDeploymentsClientDiagnostics.CreateScope("NginxDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _nginxDeploymentDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, deploymentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NginxDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleCollection.cs index de7556ce65de..28f2ce470f62 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubAuthorizationRuleCollection.cs @@ -130,6 +130,50 @@ public async Task Exists_NotificationHubAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + // NotificationHubAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NotificationHubAuthorizationRuleGet() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubAuthorizationRuleGet.json + // this example is just showing the usage of "NotificationHubs_GetAuthorizationRule" 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 NotificationHubResource created on azure + // for more information of creating NotificationHubResource, please refer to the document of NotificationHubResource + string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; + string resourceGroupName = "5ktrial"; + string namespaceName = "nh-sdk-ns"; + string notificationHubName = "nh-sdk-hub"; + ResourceIdentifier notificationHubResourceId = NotificationHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, notificationHubName); + NotificationHubResource notificationHub = client.GetNotificationHubResource(notificationHubResourceId); + + // get the collection of this NotificationHubAuthorizationRuleResource + NotificationHubAuthorizationRuleCollection collection = notificationHub.GetNotificationHubAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "DefaultListenSharedAccessSignature"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + NotificationHubAuthorizationRuleResource 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 + NotificationHubAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NotificationHubAuthorizationRuleListAll [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubCollection.cs index 091f4fe4998c..ae3fa5514098 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_NotificationHubGet() Console.WriteLine($"Succeeded: {result}"); } + // NotificationHubGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NotificationHubGet() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/NotificationHubs/NotificationHubGet.json + // this example is just showing the usage of "NotificationHubs_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 NotificationHubNamespaceResource created on azure + // for more information of creating NotificationHubNamespaceResource, please refer to the document of NotificationHubNamespaceResource + string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; + string resourceGroupName = "5ktrial"; + string namespaceName = "nh-sdk-ns"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this NotificationHubResource + NotificationHubCollection collection = notificationHubNamespace.GetNotificationHubs(); + + // invoke the operation + string notificationHubName = "nh-sdk-hub"; + NullableResponse response = await collection.GetIfExistsAsync(notificationHubName); + NotificationHubResource 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 + NotificationHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NotificationHubListByNameSpace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleCollection.cs index 33546f188fe9..156a6cedbbd2 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceAuthorizationRuleCollection.cs @@ -127,6 +127,49 @@ public async Task Exists_NameSpaceAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + // NameSpaceAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpaceAuthorizationRuleGet() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceAuthorizationRuleGet.json + // this example is just showing the usage of "Namespaces_GetAuthorizationRule" 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 NotificationHubNamespaceResource created on azure + // for more information of creating NotificationHubNamespaceResource, please refer to the document of NotificationHubNamespaceResource + string subscriptionId = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; + string resourceGroupName = "5ktrial"; + string namespaceName = "nh-sdk-ns"; + ResourceIdentifier notificationHubNamespaceResourceId = NotificationHubNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + NotificationHubNamespaceResource notificationHubNamespace = client.GetNotificationHubNamespaceResource(notificationHubNamespaceResourceId); + + // get the collection of this NotificationHubNamespaceAuthorizationRuleResource + NotificationHubNamespaceAuthorizationRuleCollection collection = notificationHubNamespace.GetNotificationHubNamespaceAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "RootManageSharedAccessKey"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + NotificationHubNamespaceAuthorizationRuleResource 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 + NotificationHubAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NameSpaceAuthorizationRuleListAll [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceCollection.cs index 12c6f23d9904..b55481d30189 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/samples/Generated/Samples/Sample_NotificationHubNamespaceCollection.cs @@ -130,6 +130,48 @@ public async Task Exists_NameSpaceGet() Console.WriteLine($"Succeeded: {result}"); } + // NameSpaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpaceGet() + { + // Generated from example definition: specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/NHNameSpaceGet.json + // this example is just showing the usage of "Namespaces_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 = "29cfa613-cbbc-4512-b1d6-1b3a92c7fa40"; + string resourceGroupName = "5ktrial"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NotificationHubNamespaceResource + NotificationHubNamespaceCollection collection = resourceGroupResource.GetNotificationHubNamespaces(); + + // invoke the operation + string namespaceName = "nh-sdk-ns"; + NullableResponse response = await collection.GetIfExistsAsync(namespaceName); + NotificationHubNamespaceResource 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 + NotificationHubNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NameSpaceListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs index c8f9c2734a25..cc21e8115a40 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubAuthorizationRuleResource(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.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NotificationHubs_GetAuthorizationRule + /// + /// + /// + /// authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _notificationHubAuthorizationRuleNotificationHubsClientDiagnostics.CreateScope("NotificationHubAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _notificationHubAuthorizationRuleNotificationHubsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubCollection.cs index 4d61267b1bd1..84635db0d66f 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string notificationHubName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// + /// + /// Operation Id + /// NotificationHubs_Get + /// + /// + /// + /// The notification hub name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string notificationHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); + + using var scope = _notificationHubClientDiagnostics.CreateScope("NotificationHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _notificationHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationHubName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubResource(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.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// + /// + /// Operation Id + /// NotificationHubs_Get + /// + /// + /// + /// The notification hub name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string notificationHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(notificationHubName, nameof(notificationHubName)); + + using var scope = _notificationHubClientDiagnostics.CreateScope("NotificationHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _notificationHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationHubName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs index 1483d8339a07..29fcbc92d4f2 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// Authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(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.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// Authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _notificationHubNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _notificationHubNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceCollection.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceCollection.cs index 3a12720ac0cf..920c00b6ac58 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceCollection.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string namespaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _notificationHubNamespaceNamespacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubNamespaceResource(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.NotificationHubs/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _notificationHubNamespaceNamespacesClientDiagnostics.CreateScope("NotificationHubNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _notificationHubNamespaceNamespacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationHubNamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/EnergyServiceCollection.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/EnergyServiceCollection.cs index ac022dea38a0..9d5f8a11d416 100644 --- a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/EnergyServiceCollection.cs +++ b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/EnergyServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices/{resourceName} + /// + /// + /// Operation Id + /// EnergyServices_Get + /// + /// + /// + /// The resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _energyServiceClientDiagnostics.CreateScope("EnergyServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _energyServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EnergyServiceResource(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.OpenEnergyPlatform/energyServices/{resourceName} + /// + /// + /// Operation Id + /// EnergyServices_Get + /// + /// + /// + /// The resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _energyServiceClientDiagnostics.CreateScope("EnergyServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _energyServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EnergyServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_LogAnalyticsQueryCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_LogAnalyticsQueryCollection.cs index 42840925977e..3a865fd154b2 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_LogAnalyticsQueryCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_LogAnalyticsQueryCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_QueryGet() Console.WriteLine($"Succeeded: {result}"); } + // QueryGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QueryGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPackQueriesGet.json + // this example is just showing the usage of "Queries_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 LogAnalyticsQueryPackResource created on azure + // for more information of creating LogAnalyticsQueryPackResource, please refer to the document of LogAnalyticsQueryPackResource + string subscriptionId = "86dc51d3-92ed-4d7e-947a-775ea79b4918"; + string resourceGroupName = "my-resource-group"; + string queryPackName = "my-querypack"; + ResourceIdentifier logAnalyticsQueryPackResourceId = LogAnalyticsQueryPackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, queryPackName); + LogAnalyticsQueryPackResource logAnalyticsQueryPack = client.GetLogAnalyticsQueryPackResource(logAnalyticsQueryPackResourceId); + + // get the collection of this LogAnalyticsQueryResource + LogAnalyticsQueryCollection collection = logAnalyticsQueryPack.GetLogAnalyticsQueries(); + + // invoke the operation + string id = "a449f8af-8e64-4b3a-9b16-5a7165ff98c4"; + NullableResponse response = await collection.GetIfExistsAsync(id); + LogAnalyticsQueryResource 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 + LogAnalyticsQueryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QueryPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_LogAnalyticsQueryPackCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_LogAnalyticsQueryPackCollection.cs index 261f94db5b16..d4e30f5239d2 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_LogAnalyticsQueryPackCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_LogAnalyticsQueryPackCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_QueryPackGet() Console.WriteLine($"Succeeded: {result}"); } + // QueryPackGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QueryPackGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksGet.json + // this example is just showing the usage of "QueryPacks_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 = "86dc51d3-92ed-4d7e-947a-775ea79b4919"; + string resourceGroupName = "my-resource-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LogAnalyticsQueryPackResource + LogAnalyticsQueryPackCollection collection = resourceGroupResource.GetLogAnalyticsQueryPacks(); + + // invoke the operation + string queryPackName = "my-querypack"; + NullableResponse response = await collection.GetIfExistsAsync(queryPackName); + LogAnalyticsQueryPackResource 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 + LogAnalyticsQueryPackData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QueryPackCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsClusterCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsClusterCollection.cs index 671661875cd7..f4f7f92ce434 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsClusterCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsClusterCollection.cs @@ -165,5 +165,47 @@ public async Task Exists_ClustersGet() Console.WriteLine($"Succeeded: {result}"); } + + // ClustersGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ClustersGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2021-06-01/examples/ClustersGet.json + // this example is just showing the usage of "Clusters_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-00000000000"; + string resourceGroupName = "oiautorest6685"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OperationalInsightsClusterResource + OperationalInsightsClusterCollection collection = resourceGroupResource.GetOperationalInsightsClusters(); + + // invoke the operation + string clusterName = "oiautorest6685"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + OperationalInsightsClusterResource 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 + OperationalInsightsClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsDataExportCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsDataExportCollection.cs index 1eb88de1860d..9e7fb64332bb 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsDataExportCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsDataExportCollection.cs @@ -163,5 +163,48 @@ public async Task Exists_DataExportGet() Console.WriteLine($"Succeeded: {result}"); } + + // DataExportGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataExportGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/DataExportGet.json + // this example is just showing the usage of "DataExports_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 OperationalInsightsWorkspaceResource created on azure + // for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource + string subscriptionId = "00000000-0000-0000-0000-00000000000"; + string resourceGroupName = "RgTest1"; + string workspaceName = "DeWnTest1234"; + ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId); + + // get the collection of this OperationalInsightsDataExportResource + OperationalInsightsDataExportCollection collection = operationalInsightsWorkspace.GetOperationalInsightsDataExports(); + + // invoke the operation + string dataExportName = "export1"; + NullableResponse response = await collection.GetIfExistsAsync(dataExportName); + OperationalInsightsDataExportResource 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 + OperationalInsightsDataExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsDataSourceCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsDataSourceCollection.cs index 930c0572cb47..3f527c955112 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsDataSourceCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsDataSourceCollection.cs @@ -125,6 +125,49 @@ public async Task Exists_DataSourcesGet() Console.WriteLine($"Succeeded: {result}"); } + // DataSourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataSourcesGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/DataSourcesGet.json + // this example is just showing the usage of "DataSources_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 OperationalInsightsWorkspaceResource created on azure + // for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource + string subscriptionId = "00000000-0000-0000-0000-00000000000"; + string resourceGroupName = "OIAutoRest5123"; + string workspaceName = "AzTest9724"; + ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId); + + // get the collection of this OperationalInsightsDataSourceResource + OperationalInsightsDataSourceCollection collection = operationalInsightsWorkspace.GetOperationalInsightsDataSources(); + + // invoke the operation + string dataSourceName = "AzTestDS774"; + NullableResponse response = await collection.GetIfExistsAsync(dataSourceName); + OperationalInsightsDataSourceResource 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 + OperationalInsightsDataSourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DataSourcesListByWorkspace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsLinkedServiceCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsLinkedServiceCollection.cs index 5cce79877f00..92544eb0703f 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsLinkedServiceCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsLinkedServiceCollection.cs @@ -123,6 +123,49 @@ public async Task Exists_LinkedServicesGet() Console.WriteLine($"Succeeded: {result}"); } + // LinkedServicesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LinkedServicesGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/LinkedServicesGet.json + // this example is just showing the usage of "LinkedServices_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 OperationalInsightsWorkspaceResource created on azure + // for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource + string subscriptionId = "00000000-0000-0000-0000-00000000000"; + string resourceGroupName = "mms-eus"; + string workspaceName = "TestLinkWS"; + ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId); + + // get the collection of this OperationalInsightsLinkedServiceResource + OperationalInsightsLinkedServiceCollection collection = operationalInsightsWorkspace.GetOperationalInsightsLinkedServices(); + + // invoke the operation + string linkedServiceName = "Cluster"; + NullableResponse response = await collection.GetIfExistsAsync(linkedServiceName); + OperationalInsightsLinkedServiceResource 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 + OperationalInsightsLinkedServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // LinkedServicesListByWorkspace [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsLinkedStorageAccountsCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsLinkedStorageAccountsCollection.cs index 9923f58c61c5..5d659593fcee 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsLinkedStorageAccountsCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsLinkedStorageAccountsCollection.cs @@ -127,6 +127,49 @@ public async Task Exists_LinkedStorageAccountsGet() Console.WriteLine($"Succeeded: {result}"); } + // LinkedStorageAccountsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LinkedStorageAccountsGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/LinkedStorageAccountsGet.json + // this example is just showing the usage of "LinkedStorageAccounts_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 OperationalInsightsWorkspaceResource created on azure + // for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource + string subscriptionId = "00000000-0000-0000-0000-00000000000"; + string resourceGroupName = "mms-eus"; + string workspaceName = "testLinkStorageAccountsWS"; + ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId); + + // get the collection of this OperationalInsightsLinkedStorageAccountsResource + OperationalInsightsLinkedStorageAccountsCollection collection = operationalInsightsWorkspace.GetAllOperationalInsightsLinkedStorageAccounts(); + + // invoke the operation + OperationalInsightsDataSourceType dataSourceType = OperationalInsightsDataSourceType.CustomLogs; + NullableResponse response = await collection.GetIfExistsAsync(dataSourceType); + OperationalInsightsLinkedStorageAccountsResource 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 + OperationalInsightsLinkedStorageAccountsData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets list of linked storage accounts on a workspace. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsSavedSearchCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsSavedSearchCollection.cs index faefb9979fc6..04a2ec7f7902 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsSavedSearchCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsSavedSearchCollection.cs @@ -130,6 +130,49 @@ public async Task Exists_SavedSearchesGet() Console.WriteLine($"Succeeded: {result}"); } + // SavedSearchesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SavedSearchesGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesSavedSearchesGet.json + // this example is just showing the usage of "SavedSearches_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 OperationalInsightsWorkspaceResource created on azure + // for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource + string subscriptionId = "00000000-0000-0000-0000-00000000000"; + string resourceGroupName = "TestRG"; + string workspaceName = "TestWS"; + ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId); + + // get the collection of this OperationalInsightsSavedSearchResource + OperationalInsightsSavedSearchCollection collection = operationalInsightsWorkspace.GetOperationalInsightsSavedSearches(); + + // invoke the operation + string savedSearchId = "00000000-0000-0000-0000-00000000000"; + NullableResponse response = await collection.GetIfExistsAsync(savedSearchId); + OperationalInsightsSavedSearchResource 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 + OperationalInsightsSavedSearchData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SavedSearchesList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsTableCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsTableCollection.cs index a538160b24a0..af21d082c51e 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsTableCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsTableCollection.cs @@ -173,5 +173,48 @@ public async Task Exists_TablesGet() Console.WriteLine($"Succeeded: {result}"); } + + // TablesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TablesGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2022-10-01/examples/TablesGet.json + // this example is just showing the usage of "Tables_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 OperationalInsightsWorkspaceResource created on azure + // for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource + string subscriptionId = "00000000-0000-0000-0000-00000000000"; + string resourceGroupName = "oiautorest6685"; + string workspaceName = "oiautorest6685"; + ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId); + + // get the collection of this OperationalInsightsTableResource + OperationalInsightsTableCollection collection = operationalInsightsWorkspace.GetOperationalInsightsTables(); + + // invoke the operation + string tableName = "table1_SRCH"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + OperationalInsightsTableResource 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 + OperationalInsightsTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsWorkspaceCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsWorkspaceCollection.cs index 889bde0afaae..8d6439e57f72 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsWorkspaceCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_OperationalInsightsWorkspaceCollection.cs @@ -162,5 +162,47 @@ public async Task Exists_WorkspaceGet() Console.WriteLine($"Succeeded: {result}"); } + + // WorkspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkspaceGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2022-10-01/examples/WorkspacesGet.json + // this example is just showing the usage of "Workspaces_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-00000000000"; + string resourceGroupName = "oiautorest6685"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OperationalInsightsWorkspaceResource + OperationalInsightsWorkspaceCollection collection = resourceGroupResource.GetOperationalInsightsWorkspaces(); + + // invoke the operation + string workspaceName = "oiautorest6685"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + OperationalInsightsWorkspaceResource 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 + OperationalInsightsWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_StorageInsightCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_StorageInsightCollection.cs index b864097cc61e..00be124c66e1 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_StorageInsightCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/samples/Generated/Samples/Sample_StorageInsightCollection.cs @@ -132,6 +132,49 @@ public async Task Exists_StorageInsightsGet() Console.WriteLine($"Succeeded: {result}"); } + // StorageInsightsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageInsightsGet() + { + // Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/StorageInsightsGet.json + // this example is just showing the usage of "StorageInsightConfigs_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 OperationalInsightsWorkspaceResource created on azure + // for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource + string subscriptionId = "00000000-0000-0000-0000-00000000000"; + string resourceGroupName = "OIAutoRest5123"; + string workspaceName = "aztest5048"; + ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId); + + // get the collection of this StorageInsightResource + StorageInsightCollection collection = operationalInsightsWorkspace.GetStorageInsights(); + + // invoke the operation + string storageInsightName = "AzTestSI1110"; + NullableResponse response = await collection.GetIfExistsAsync(storageInsightName); + StorageInsightResource 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 + StorageInsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageInsightsList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryCollection.cs index 9abad8704c26..978d1c69b280 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string id, CancellationToken cancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName}/queries/{id} + /// + /// + /// Operation Id + /// Queries_Get + /// + /// + /// + /// The id of a specific query defined in the Log Analytics QueryPack. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _logAnalyticsQueryQueriesClientDiagnostics.CreateScope("LogAnalyticsQueryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logAnalyticsQueryQueriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogAnalyticsQueryResource(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.OperationalInsights/queryPacks/{queryPackName}/queries/{id} + /// + /// + /// Operation Id + /// Queries_Get + /// + /// + /// + /// The id of a specific query defined in the Log Analytics QueryPack. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _logAnalyticsQueryQueriesClientDiagnostics.CreateScope("LogAnalyticsQueryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logAnalyticsQueryQueriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogAnalyticsQueryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackCollection.cs index d3d8631ace25..16a15b7711d2 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string queryPackName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName} + /// + /// + /// Operation Id + /// QueryPacks_Get + /// + /// + /// + /// The name of the Log Analytics QueryPack 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 queryPackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queryPackName, nameof(queryPackName)); + + using var scope = _logAnalyticsQueryPackQueryPacksClientDiagnostics.CreateScope("LogAnalyticsQueryPackCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logAnalyticsQueryPackQueryPacksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, queryPackName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogAnalyticsQueryPackResource(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.OperationalInsights/queryPacks/{queryPackName} + /// + /// + /// Operation Id + /// QueryPacks_Get + /// + /// + /// + /// The name of the Log Analytics QueryPack resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string queryPackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queryPackName, nameof(queryPackName)); + + using var scope = _logAnalyticsQueryPackQueryPacksClientDiagnostics.CreateScope("LogAnalyticsQueryPackCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logAnalyticsQueryPackQueryPacksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, queryPackName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogAnalyticsQueryPackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsClusterCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsClusterCollection.cs index a6692b7bd363..0aebe44aaa87 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsClusterCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the Log Analytics Cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _operationalInsightsClusterClustersClientDiagnostics.CreateScope("OperationalInsightsClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalInsightsClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsClusterResource(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.OperationalInsights/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the Log Analytics Cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _operationalInsightsClusterClustersClientDiagnostics.CreateScope("OperationalInsightsClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalInsightsClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataExportCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataExportCollection.cs index 3fc5d300521f..58176a200894 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataExportCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataExportCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string dataExportName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName} + /// + /// + /// Operation Id + /// DataExports_Get + /// + /// + /// + /// The data export rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataExportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataExportName, nameof(dataExportName)); + + using var scope = _operationalInsightsDataExportDataExportsClientDiagnostics.CreateScope("OperationalInsightsDataExportCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalInsightsDataExportDataExportsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataExportName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsDataExportResource(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.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName} + /// + /// + /// Operation Id + /// DataExports_Get + /// + /// + /// + /// The data export rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataExportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataExportName, nameof(dataExportName)); + + using var scope = _operationalInsightsDataExportDataExportsClientDiagnostics.CreateScope("OperationalInsightsDataExportCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalInsightsDataExportDataExportsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataExportName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsDataExportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataSourceCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataSourceCollection.cs index 06a716088be1..e0679db4a9f6 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataSourceCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataSourceCollection.cs @@ -330,5 +330,79 @@ public virtual Response Exists(string dataSourceName, CancellationToken ca throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName} + /// + /// + /// Operation Id + /// DataSources_Get + /// + /// + /// + /// Name of the datasource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataSourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataSourceName, nameof(dataSourceName)); + + using var scope = _operationalInsightsDataSourceDataSourcesClientDiagnostics.CreateScope("OperationalInsightsDataSourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalInsightsDataSourceDataSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataSourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsDataSourceResource(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.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName} + /// + /// + /// Operation Id + /// DataSources_Get + /// + /// + /// + /// Name of the datasource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataSourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataSourceName, nameof(dataSourceName)); + + using var scope = _operationalInsightsDataSourceDataSourcesClientDiagnostics.CreateScope("OperationalInsightsDataSourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalInsightsDataSourceDataSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataSourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsDataSourceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedServiceCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedServiceCollection.cs index 60338f3797f1..5b8715949936 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedServiceCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedServiceCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string linkedServiceName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName} + /// + /// + /// Operation Id + /// LinkedServices_Get + /// + /// + /// + /// Name of the linked service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string linkedServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkedServiceName, nameof(linkedServiceName)); + + using var scope = _operationalInsightsLinkedServiceLinkedServicesClientDiagnostics.CreateScope("OperationalInsightsLinkedServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalInsightsLinkedServiceLinkedServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkedServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsLinkedServiceResource(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.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName} + /// + /// + /// Operation Id + /// LinkedServices_Get + /// + /// + /// + /// Name of the linked service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkedServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkedServiceName, nameof(linkedServiceName)); + + using var scope = _operationalInsightsLinkedServiceLinkedServicesClientDiagnostics.CreateScope("OperationalInsightsLinkedServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalInsightsLinkedServiceLinkedServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkedServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsLinkedServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedStorageAccountsCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedStorageAccountsCollection.cs index 5525b3d07c59..493b5d137d86 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedStorageAccountsCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedStorageAccountsCollection.cs @@ -302,6 +302,72 @@ public virtual Response Exists(OperationalInsightsDataSourceType dataSourc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType} + /// + /// + /// Operation Id + /// LinkedStorageAccounts_Get + /// + /// + /// + /// Linked storage accounts type. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(OperationalInsightsDataSourceType dataSourceType, CancellationToken cancellationToken = default) + { + using var scope = _operationalInsightsLinkedStorageAccountsLinkedStorageAccountsClientDiagnostics.CreateScope("OperationalInsightsLinkedStorageAccountsCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalInsightsLinkedStorageAccountsLinkedStorageAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataSourceType, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsLinkedStorageAccountsResource(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.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType} + /// + /// + /// Operation Id + /// LinkedStorageAccounts_Get + /// + /// + /// + /// Linked storage accounts type. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(OperationalInsightsDataSourceType dataSourceType, CancellationToken cancellationToken = default) + { + using var scope = _operationalInsightsLinkedStorageAccountsLinkedStorageAccountsClientDiagnostics.CreateScope("OperationalInsightsLinkedStorageAccountsCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalInsightsLinkedStorageAccountsLinkedStorageAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataSourceType, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsLinkedStorageAccountsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsSavedSearchCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsSavedSearchCollection.cs index 6143c4c1fc5a..4d41aa519a15 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsSavedSearchCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsSavedSearchCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string savedSearchId, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId} + /// + /// + /// Operation Id + /// SavedSearches_Get + /// + /// + /// + /// The id of the saved search. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string savedSearchId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savedSearchId, nameof(savedSearchId)); + + using var scope = _operationalInsightsSavedSearchSavedSearchesClientDiagnostics.CreateScope("OperationalInsightsSavedSearchCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalInsightsSavedSearchSavedSearchesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, savedSearchId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsSavedSearchResource(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.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId} + /// + /// + /// Operation Id + /// SavedSearches_Get + /// + /// + /// + /// The id of the saved search. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string savedSearchId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savedSearchId, nameof(savedSearchId)); + + using var scope = _operationalInsightsSavedSearchSavedSearchesClientDiagnostics.CreateScope("OperationalInsightsSavedSearchCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalInsightsSavedSearchSavedSearchesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, savedSearchId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsSavedSearchResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsTableCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsTableCollection.cs index 355486f1c990..43e1b7702c31 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsTableCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsTableCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string tableName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName} + /// + /// + /// Operation Id + /// Tables_Get + /// + /// + /// + /// The name of the table. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _operationalInsightsTableTablesClientDiagnostics.CreateScope("OperationalInsightsTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalInsightsTableTablesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsTableResource(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.OperationalInsights/workspaces/{workspaceName}/tables/{tableName} + /// + /// + /// Operation Id + /// Tables_Get + /// + /// + /// + /// The name of the table. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _operationalInsightsTableTablesClientDiagnostics.CreateScope("OperationalInsightsTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalInsightsTableTablesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsTableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceCollection.cs index fb144e4cc4ca..b85193574f4e 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _operationalInsightsWorkspaceWorkspacesClientDiagnostics.CreateScope("OperationalInsightsWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _operationalInsightsWorkspaceWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsWorkspaceResource(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.OperationalInsights/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _operationalInsightsWorkspaceWorkspacesClientDiagnostics.CreateScope("OperationalInsightsWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _operationalInsightsWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OperationalInsightsWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/StorageInsightCollection.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/StorageInsightCollection.cs index c1177708e795..e8352d500f4b 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/StorageInsightCollection.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/StorageInsightCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string storageInsightName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName} + /// + /// + /// Operation Id + /// StorageInsightConfigs_Get + /// + /// + /// + /// Name of the storageInsightsConfigs 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 storageInsightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageInsightName, nameof(storageInsightName)); + + using var scope = _storageInsightStorageInsightConfigsClientDiagnostics.CreateScope("StorageInsightCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageInsightStorageInsightConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageInsightName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageInsightResource(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.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName} + /// + /// + /// Operation Id + /// StorageInsightConfigs_Get + /// + /// + /// + /// Name of the storageInsightsConfigs resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageInsightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageInsightName, nameof(storageInsightName)); + + using var scope = _storageInsightStorageInsightConfigsClientDiagnostics.CreateScope("StorageInsightCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageInsightStorageInsightConfigsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageInsightName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageInsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_AvailableGroundStationCollection.cs b/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_AvailableGroundStationCollection.cs index 69b44f9491c4..b728567d5624 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_AvailableGroundStationCollection.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_AvailableGroundStationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,5 +116,46 @@ public async Task Exists_GetGroundStation() Console.WriteLine($"Succeeded: {result}"); } + + // Get GroundStation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetGroundStation() + { + // Generated from example definition: specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/AvailableGroundStationGet.json + // this example is just showing the usage of "AvailableGroundStations_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "c1be1141-a7c9-4aac-9608-3c2e2f1152c3"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this AvailableGroundStationResource + AvailableGroundStationCollection collection = subscriptionResource.GetAvailableGroundStations(); + + // invoke the operation + string groundStationName = "EASTUS2_0"; + NullableResponse response = await collection.GetIfExistsAsync(groundStationName); + AvailableGroundStationResource 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 + AvailableGroundStationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalContactCollection.cs b/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalContactCollection.cs index 4aaae55fdc75..dea2bea9576b 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalContactCollection.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalContactCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetContact() Console.WriteLine($"Succeeded: {result}"); } + // Get Contact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContact() + { + // Generated from example definition: specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactGet.json + // this example is just showing the usage of "Contacts_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 OrbitalSpacecraftResource created on azure + // for more information of creating OrbitalSpacecraftResource, please refer to the document of OrbitalSpacecraftResource + string subscriptionId = "c1be1141-a7c9-4aac-9608-3c2e2f1152c3"; + string resourceGroupName = "contoso-Rgp"; + string spacecraftName = "CONTOSO_SAT"; + ResourceIdentifier orbitalSpacecraftResourceId = OrbitalSpacecraftResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spacecraftName); + OrbitalSpacecraftResource orbitalSpacecraft = client.GetOrbitalSpacecraftResource(orbitalSpacecraftResourceId); + + // get the collection of this OrbitalContactResource + OrbitalContactCollection collection = orbitalSpacecraft.GetOrbitalContacts(); + + // invoke the operation + string contactName = "contact1"; + NullableResponse response = await collection.GetIfExistsAsync(contactName); + OrbitalContactResource 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 + OrbitalContactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a contact [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalContactProfileCollection.cs b/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalContactProfileCollection.cs index b01bb296ad29..48d3e678bf18 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalContactProfileCollection.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalContactProfileCollection.cs @@ -85,6 +85,48 @@ public async Task Exists_GetAContactProfile() Console.WriteLine($"Succeeded: {result}"); } + // Get a contact profile + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAContactProfile() + { + // Generated from example definition: specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactProfileGet.json + // this example is just showing the usage of "ContactProfiles_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 = "c1be1141-a7c9-4aac-9608-3c2e2f1152c3"; + string resourceGroupName = "contoso-Rgp"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrbitalContactProfileResource + OrbitalContactProfileCollection collection = resourceGroupResource.GetOrbitalContactProfiles(); + + // invoke the operation + string contactProfileName = "CONTOSO-CP"; + NullableResponse response = await collection.GetIfExistsAsync(contactProfileName); + OrbitalContactProfileResource 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 + OrbitalContactProfileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a contact profile [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalSpacecraftCollection.cs b/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalSpacecraftCollection.cs index 96b463dabf47..f037b9950c1a 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalSpacecraftCollection.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/samples/Generated/Samples/Sample_OrbitalSpacecraftCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetSpacecraft() Console.WriteLine($"Succeeded: {result}"); } + // Get Spacecraft + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSpacecraft() + { + // Generated from example definition: specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/SpacecraftGet.json + // this example is just showing the usage of "Spacecrafts_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 = "c1be1141-a7c9-4aac-9608-3c2e2f1152c3"; + string resourceGroupName = "contoso-Rgp"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrbitalSpacecraftResource + OrbitalSpacecraftCollection collection = resourceGroupResource.GetOrbitalSpacecrafts(); + + // invoke the operation + string spacecraftName = "CONTOSO_SAT"; + NullableResponse response = await collection.GetIfExistsAsync(spacecraftName); + OrbitalSpacecraftResource 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 + OrbitalSpacecraftData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a spacecraft [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/AvailableGroundStationCollection.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/AvailableGroundStationCollection.cs index aaa3e3e0abdf..03d96b8a6e0f 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/AvailableGroundStationCollection.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/AvailableGroundStationCollection.cs @@ -242,5 +242,79 @@ public virtual Response Exists(string groundStationName, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName} + /// + /// + /// Operation Id + /// AvailableGroundStations_Get + /// + /// + /// + /// Ground Station name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groundStationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groundStationName, nameof(groundStationName)); + + using var scope = _availableGroundStationClientDiagnostics.CreateScope("AvailableGroundStationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _availableGroundStationRestClient.GetAsync(Id.SubscriptionId, groundStationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvailableGroundStationResource(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}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName} + /// + /// + /// Operation Id + /// AvailableGroundStations_Get + /// + /// + /// + /// Ground Station name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groundStationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groundStationName, nameof(groundStationName)); + + using var scope = _availableGroundStationClientDiagnostics.CreateScope("AvailableGroundStationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _availableGroundStationRestClient.Get(Id.SubscriptionId, groundStationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvailableGroundStationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactCollection.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactCollection.cs index 60c34ae1f347..c14acf343ac0 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactCollection.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string contactName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName} + /// + /// + /// Operation Id + /// Contacts_Get + /// + /// + /// + /// Contact name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string contactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(contactName, nameof(contactName)); + + using var scope = _orbitalContactContactsClientDiagnostics.CreateScope("OrbitalContactCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _orbitalContactContactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contactName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrbitalContactResource(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.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName} + /// + /// + /// Operation Id + /// Contacts_Get + /// + /// + /// + /// Contact name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string contactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(contactName, nameof(contactName)); + + using var scope = _orbitalContactContactsClientDiagnostics.CreateScope("OrbitalContactCollection.GetIfExists"); + scope.Start(); + try + { + var response = _orbitalContactContactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contactName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrbitalContactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactProfileCollection.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactProfileCollection.cs index ab1e063cb437..0d8ca3ce234b 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactProfileCollection.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactProfileCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string contactProfileName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName} + /// + /// + /// Operation Id + /// ContactProfiles_Get + /// + /// + /// + /// Contact Profile name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string contactProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(contactProfileName, nameof(contactProfileName)); + + using var scope = _orbitalContactProfileContactProfilesClientDiagnostics.CreateScope("OrbitalContactProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _orbitalContactProfileContactProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, contactProfileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrbitalContactProfileResource(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.Orbital/contactProfiles/{contactProfileName} + /// + /// + /// Operation Id + /// ContactProfiles_Get + /// + /// + /// + /// Contact Profile name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string contactProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(contactProfileName, nameof(contactProfileName)); + + using var scope = _orbitalContactProfileContactProfilesClientDiagnostics.CreateScope("OrbitalContactProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _orbitalContactProfileContactProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, contactProfileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrbitalContactProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftCollection.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftCollection.cs index 67af696f8fb1..5c6b5953e5e8 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftCollection.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string spacecraftName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName} + /// + /// + /// Operation Id + /// Spacecrafts_Get + /// + /// + /// + /// Spacecraft ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string spacecraftName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spacecraftName, nameof(spacecraftName)); + + using var scope = _orbitalSpacecraftSpacecraftsClientDiagnostics.CreateScope("OrbitalSpacecraftCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _orbitalSpacecraftSpacecraftsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, spacecraftName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrbitalSpacecraftResource(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.Orbital/spacecrafts/{spacecraftName} + /// + /// + /// Operation Id + /// Spacecrafts_Get + /// + /// + /// + /// Spacecraft ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string spacecraftName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spacecraftName, nameof(spacecraftName)); + + using var scope = _orbitalSpacecraftSpacecraftsClientDiagnostics.CreateScope("OrbitalSpacecraftCollection.GetIfExists"); + scope.Start(); + try + { + var response = _orbitalSpacecraftSpacecraftsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, spacecraftName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrbitalSpacecraftResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackCertificateObjectCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackCertificateObjectCollection.cs index 85e47d5a2b58..72793a2741a7 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackCertificateObjectCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackCertificateObjectCollection.cs @@ -150,6 +150,47 @@ public async Task Exists_CertificateObjectGlobalRulestackGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // CertificateObjectGlobalRulestack_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CertificateObjectGlobalRulestackGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/CertificateObjectGlobalRulestack_Get_MaximumSet_Gen.json + // this example is just showing the usage of "CertificateObjectGlobalRulestack_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "praval"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this GlobalRulestackCertificateObjectResource + GlobalRulestackCertificateObjectCollection collection = globalRulestack.GetGlobalRulestackCertificateObjects(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + GlobalRulestackCertificateObjectResource 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 + GlobalRulestackCertificateObjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CertificateObjectGlobalRulestack_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -212,6 +253,47 @@ public async Task Exists_CertificateObjectGlobalRulestackGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // CertificateObjectGlobalRulestack_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CertificateObjectGlobalRulestackGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/CertificateObjectGlobalRulestack_Get_MinimumSet_Gen.json + // this example is just showing the usage of "CertificateObjectGlobalRulestack_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "praval"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this GlobalRulestackCertificateObjectResource + GlobalRulestackCertificateObjectCollection collection = globalRulestack.GetGlobalRulestackCertificateObjects(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + GlobalRulestackCertificateObjectResource 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 + GlobalRulestackCertificateObjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CertificateObjectGlobalRulestack_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackCollection.cs index c7a5d50ff3d4..b3f656810018 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackCollection.cs @@ -143,6 +143,45 @@ public async Task Exists_GlobalRulestackGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // GlobalRulestack_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GlobalRulestackGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/GlobalRulestack_Get_MaximumSet_Gen.json + // this example is just showing the usage of "GlobalRulestack_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this GlobalRulestackResource + GlobalRulestackCollection collection = tenantResource.GetGlobalRulestacks(); + + // invoke the operation + string globalRulestackName = "praval"; + NullableResponse response = await collection.GetIfExistsAsync(globalRulestackName); + GlobalRulestackResource 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 + GlobalRulestackData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GlobalRulestack_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -201,6 +240,45 @@ public async Task Exists_GlobalRulestackGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // GlobalRulestack_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GlobalRulestackGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/GlobalRulestack_Get_MinimumSet_Gen.json + // this example is just showing the usage of "GlobalRulestack_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this GlobalRulestackResource + GlobalRulestackCollection collection = tenantResource.GetGlobalRulestacks(); + + // invoke the operation + string globalRulestackName = "praval"; + NullableResponse response = await collection.GetIfExistsAsync(globalRulestackName); + GlobalRulestackResource 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 + GlobalRulestackData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GlobalRulestack_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackFqdnCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackFqdnCollection.cs index 9c2de1e744cd..e8b1b1e40ab2 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackFqdnCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackFqdnCollection.cs @@ -149,6 +149,47 @@ public async Task Exists_FqdnListGlobalRulestackGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // FqdnListGlobalRulestack_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FqdnListGlobalRulestackGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/FqdnListGlobalRulestack_Get_MaximumSet_Gen.json + // this example is just showing the usage of "FqdnListGlobalRulestack_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "praval"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this GlobalRulestackFqdnResource + GlobalRulestackFqdnCollection collection = globalRulestack.GetGlobalRulestackFqdns(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + GlobalRulestackFqdnResource 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 + GlobalRulestackFqdnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FqdnListGlobalRulestack_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -211,6 +252,47 @@ public async Task Exists_FqdnListGlobalRulestackGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // FqdnListGlobalRulestack_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FqdnListGlobalRulestackGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/FqdnListGlobalRulestack_Get_MinimumSet_Gen.json + // this example is just showing the usage of "FqdnListGlobalRulestack_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "praval"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this GlobalRulestackFqdnResource + GlobalRulestackFqdnCollection collection = globalRulestack.GetGlobalRulestackFqdns(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + GlobalRulestackFqdnResource 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 + GlobalRulestackFqdnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FqdnListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackPrefixCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackPrefixCollection.cs index 7959c90f0e79..4deb13650e85 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackPrefixCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_GlobalRulestackPrefixCollection.cs @@ -149,6 +149,47 @@ public async Task Exists_PrefixListGlobalRulestackGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PrefixListGlobalRulestack_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrefixListGlobalRulestackGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/PrefixListGlobalRulestack_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PrefixListGlobalRulestack_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "praval"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this GlobalRulestackPrefixResource + GlobalRulestackPrefixCollection collection = globalRulestack.GetGlobalRulestackPrefixes(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + GlobalRulestackPrefixResource 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 + GlobalRulestackPrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrefixListGlobalRulestack_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -211,6 +252,47 @@ public async Task Exists_PrefixListGlobalRulestackGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PrefixListGlobalRulestack_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrefixListGlobalRulestackGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/PrefixListGlobalRulestack_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PrefixListGlobalRulestack_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "praval"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this GlobalRulestackPrefixResource + GlobalRulestackPrefixCollection collection = globalRulestack.GetGlobalRulestackPrefixes(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + GlobalRulestackPrefixResource 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 + GlobalRulestackPrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrefixListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackCertificateObjectCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackCertificateObjectCollection.cs index c84551b0b664..b9c1b0e9792b 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackCertificateObjectCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackCertificateObjectCollection.cs @@ -158,6 +158,49 @@ public async Task Exists_CertificateObjectLocalRulestackGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // CertificateObjectLocalRulestack_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CertificateObjectLocalRulestackGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/CertificateObjectLocalRulestack_Get_MaximumSet_Gen.json + // this example is just showing the usage of "CertificateObjectLocalRulestack_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 LocalRulestackResource created on azure + // for more information of creating LocalRulestackResource, please refer to the document of LocalRulestackResource + string subscriptionId = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "rgopenapi"; + string localRulestackName = "lrs1"; + ResourceIdentifier localRulestackResourceId = LocalRulestackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, localRulestackName); + LocalRulestackResource localRulestack = client.GetLocalRulestackResource(localRulestackResourceId); + + // get the collection of this LocalRulestackCertificateObjectResource + LocalRulestackCertificateObjectCollection collection = localRulestack.GetLocalRulestackCertificateObjects(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + LocalRulestackCertificateObjectResource 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 + LocalRulestackCertificateObjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CertificateObjectLocalRulestack_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -224,6 +267,49 @@ public async Task Exists_CertificateObjectLocalRulestackGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // CertificateObjectLocalRulestack_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CertificateObjectLocalRulestackGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/CertificateObjectLocalRulestack_Get_MinimumSet_Gen.json + // this example is just showing the usage of "CertificateObjectLocalRulestack_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 LocalRulestackResource created on azure + // for more information of creating LocalRulestackResource, please refer to the document of LocalRulestackResource + string subscriptionId = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "rgopenapi"; + string localRulestackName = "lrs1"; + ResourceIdentifier localRulestackResourceId = LocalRulestackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, localRulestackName); + LocalRulestackResource localRulestack = client.GetLocalRulestackResource(localRulestackResourceId); + + // get the collection of this LocalRulestackCertificateObjectResource + LocalRulestackCertificateObjectCollection collection = localRulestack.GetLocalRulestackCertificateObjects(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + LocalRulestackCertificateObjectResource 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 + LocalRulestackCertificateObjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CertificateObjectLocalRulestack_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackCollection.cs index 8d301492505f..c1b91491a4aa 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackCollection.cs @@ -156,6 +156,48 @@ public async Task Exists_LocalRulestacksGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // LocalRulestacks_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LocalRulestacksGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/LocalRulestacks_Get_MaximumSet_Gen.json + // this example is just showing the usage of "LocalRulestacks_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 = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocalRulestackResource + LocalRulestackCollection collection = resourceGroupResource.GetLocalRulestacks(); + + // invoke the operation + string localRulestackName = "lrs1"; + NullableResponse response = await collection.GetIfExistsAsync(localRulestackName); + LocalRulestackResource 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 + LocalRulestackData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // LocalRulestacks_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -220,6 +262,48 @@ public async Task Exists_LocalRulestacksGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // LocalRulestacks_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LocalRulestacksGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/LocalRulestacks_Get_MinimumSet_Gen.json + // this example is just showing the usage of "LocalRulestacks_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 = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocalRulestackResource + LocalRulestackCollection collection = resourceGroupResource.GetLocalRulestacks(); + + // invoke the operation + string localRulestackName = "lrs1"; + NullableResponse response = await collection.GetIfExistsAsync(localRulestackName); + LocalRulestackResource 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 + LocalRulestackData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // LocalRulestacks_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackFqdnCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackFqdnCollection.cs index 65a116db3776..b604264b999e 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackFqdnCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackFqdnCollection.cs @@ -157,6 +157,49 @@ public async Task Exists_FqdnListLocalRulestackGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // FqdnListLocalRulestack_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FqdnListLocalRulestackGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/FqdnListLocalRulestack_Get_MaximumSet_Gen.json + // this example is just showing the usage of "FqdnListLocalRulestack_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 LocalRulestackResource created on azure + // for more information of creating LocalRulestackResource, please refer to the document of LocalRulestackResource + string subscriptionId = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "rgopenapi"; + string localRulestackName = "lrs1"; + ResourceIdentifier localRulestackResourceId = LocalRulestackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, localRulestackName); + LocalRulestackResource localRulestack = client.GetLocalRulestackResource(localRulestackResourceId); + + // get the collection of this LocalRulestackFqdnResource + LocalRulestackFqdnCollection collection = localRulestack.GetLocalRulestackFqdns(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + LocalRulestackFqdnResource 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 + LocalRulestackFqdnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FqdnListLocalRulestack_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -223,6 +266,49 @@ public async Task Exists_FqdnListLocalRulestackGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // FqdnListLocalRulestack_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FqdnListLocalRulestackGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/FqdnListLocalRulestack_Get_MinimumSet_Gen.json + // this example is just showing the usage of "FqdnListLocalRulestack_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 LocalRulestackResource created on azure + // for more information of creating LocalRulestackResource, please refer to the document of LocalRulestackResource + string subscriptionId = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "rgopenapi"; + string localRulestackName = "lrs1"; + ResourceIdentifier localRulestackResourceId = LocalRulestackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, localRulestackName); + LocalRulestackResource localRulestack = client.GetLocalRulestackResource(localRulestackResourceId); + + // get the collection of this LocalRulestackFqdnResource + LocalRulestackFqdnCollection collection = localRulestack.GetLocalRulestackFqdns(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + LocalRulestackFqdnResource 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 + LocalRulestackFqdnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FqdnListLocalRulestack_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackPrefixCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackPrefixCollection.cs index 9928f3477280..d96bb4db9300 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackPrefixCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackPrefixCollection.cs @@ -157,6 +157,49 @@ public async Task Exists_PrefixListLocalRulestackGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PrefixListLocalRulestack_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrefixListLocalRulestackGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/PrefixListLocalRulestack_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PrefixListLocalRulestack_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 LocalRulestackResource created on azure + // for more information of creating LocalRulestackResource, please refer to the document of LocalRulestackResource + string subscriptionId = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "rgopenapi"; + string localRulestackName = "lrs1"; + ResourceIdentifier localRulestackResourceId = LocalRulestackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, localRulestackName); + LocalRulestackResource localRulestack = client.GetLocalRulestackResource(localRulestackResourceId); + + // get the collection of this LocalRulestackPrefixResource + LocalRulestackPrefixCollection collection = localRulestack.GetLocalRulestackPrefixes(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + LocalRulestackPrefixResource 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 + LocalRulestackPrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrefixListLocalRulestack_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -223,6 +266,49 @@ public async Task Exists_PrefixListLocalRulestackGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PrefixListLocalRulestack_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrefixListLocalRulestackGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/PrefixListLocalRulestack_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PrefixListLocalRulestack_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 LocalRulestackResource created on azure + // for more information of creating LocalRulestackResource, please refer to the document of LocalRulestackResource + string subscriptionId = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "rgopenapi"; + string localRulestackName = "lrs1"; + ResourceIdentifier localRulestackResourceId = LocalRulestackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, localRulestackName); + LocalRulestackResource localRulestack = client.GetLocalRulestackResource(localRulestackResourceId); + + // get the collection of this LocalRulestackPrefixResource + LocalRulestackPrefixCollection collection = localRulestack.GetLocalRulestackPrefixes(); + + // invoke the operation + string name = "armid1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + LocalRulestackPrefixResource 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 + LocalRulestackPrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrefixListLocalRulestack_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackRuleCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackRuleCollection.cs index 5052cabb37d7..6d954bc10c33 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackRuleCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_LocalRulestackRuleCollection.cs @@ -158,6 +158,49 @@ public async Task Exists_LocalRulesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // LocalRules_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LocalRulesGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/LocalRules_Get_MaximumSet_Gen.json + // this example is just showing the usage of "LocalRules_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 LocalRulestackResource created on azure + // for more information of creating LocalRulestackResource, please refer to the document of LocalRulestackResource + string subscriptionId = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "firewall-rg"; + string localRulestackName = "lrs1"; + ResourceIdentifier localRulestackResourceId = LocalRulestackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, localRulestackName); + LocalRulestackResource localRulestack = client.GetLocalRulestackResource(localRulestackResourceId); + + // get the collection of this LocalRulestackRuleResource + LocalRulestackRuleCollection collection = localRulestack.GetLocalRulestackRules(); + + // invoke the operation + string priority = "1"; + NullableResponse response = await collection.GetIfExistsAsync(priority); + LocalRulestackRuleResource 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 + LocalRulestackRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // LocalRules_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -224,6 +267,49 @@ public async Task Exists_LocalRulesGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // LocalRules_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LocalRulesGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/LocalRules_Get_MinimumSet_Gen.json + // this example is just showing the usage of "LocalRules_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 LocalRulestackResource created on azure + // for more information of creating LocalRulestackResource, please refer to the document of LocalRulestackResource + string subscriptionId = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "firewall-rg"; + string localRulestackName = "lrs1"; + ResourceIdentifier localRulestackResourceId = LocalRulestackResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, localRulestackName); + LocalRulestackResource localRulestack = client.GetLocalRulestackResource(localRulestackResourceId); + + // get the collection of this LocalRulestackRuleResource + LocalRulestackRuleCollection collection = localRulestack.GetLocalRulestackRules(); + + // invoke the operation + string priority = "1"; + NullableResponse response = await collection.GetIfExistsAsync(priority); + LocalRulestackRuleResource 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 + LocalRulestackRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // LocalRules_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PaloAltoNetworksFirewallCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PaloAltoNetworksFirewallCollection.cs index e721af6f81d1..b4c85c6db8c4 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PaloAltoNetworksFirewallCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PaloAltoNetworksFirewallCollection.cs @@ -156,6 +156,48 @@ public async Task Exists_FirewallsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // Firewalls_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FirewallsGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/Firewalls_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Firewalls_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 = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "firewall-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PaloAltoNetworksFirewallResource + PaloAltoNetworksFirewallCollection collection = resourceGroupResource.GetPaloAltoNetworksFirewalls(); + + // invoke the operation + string firewallName = "firewall1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallName); + PaloAltoNetworksFirewallResource 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 + PaloAltoNetworksFirewallData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Firewalls_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -220,6 +262,48 @@ public async Task Exists_FirewallsGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // Firewalls_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FirewallsGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/Firewalls_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Firewalls_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 = "2bf4a339-294d-4c25-b0b2-ef649e9f5c27"; + string resourceGroupName = "firewall-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PaloAltoNetworksFirewallResource + PaloAltoNetworksFirewallCollection collection = resourceGroupResource.GetPaloAltoNetworksFirewalls(); + + // invoke the operation + string firewallName = "firewall1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallName); + PaloAltoNetworksFirewallResource 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 + PaloAltoNetworksFirewallData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Firewalls_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PostRulestackRuleCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PostRulestackRuleCollection.cs index 83852300962d..50e9f901b54f 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PostRulestackRuleCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PostRulestackRuleCollection.cs @@ -150,6 +150,47 @@ public async Task Exists_PostRulesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PostRules_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PostRulesGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/PostRules_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PostRules_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "lrs1"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this PostRulestackRuleResource + PostRulestackRuleCollection collection = globalRulestack.GetPostRulestackRules(); + + // invoke the operation + string priority = "1"; + NullableResponse response = await collection.GetIfExistsAsync(priority); + PostRulestackRuleResource 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 + PostRulestackRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PostRules_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -212,6 +253,47 @@ public async Task Exists_PostRulesGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PostRules_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PostRulesGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/PostRules_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PostRules_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "lrs1"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this PostRulestackRuleResource + PostRulestackRuleCollection collection = globalRulestack.GetPostRulestackRules(); + + // invoke the operation + string priority = "1"; + NullableResponse response = await collection.GetIfExistsAsync(priority); + PostRulestackRuleResource 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 + PostRulestackRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PostRules_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PreRulestackRuleCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PreRulestackRuleCollection.cs index 3065f6b8f681..3c845bfc0777 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PreRulestackRuleCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/samples/Generated/Samples/Sample_PreRulestackRuleCollection.cs @@ -150,6 +150,47 @@ public async Task Exists_PreRulesGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PreRules_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PreRulesGetMaximumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/PreRules_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PreRules_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "lrs1"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this PreRulestackRuleResource + PreRulestackRuleCollection collection = globalRulestack.GetPreRulestackRules(); + + // invoke the operation + string priority = "1"; + NullableResponse response = await collection.GetIfExistsAsync(priority); + PreRulestackRuleResource 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 + PreRulestackRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PreRules_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -212,6 +253,47 @@ public async Task Exists_PreRulesGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // PreRules_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PreRulesGetMinimumSetGen() + { + // Generated from example definition: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2022-08-29/examples/PreRules_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PreRules_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 GlobalRulestackResource created on azure + // for more information of creating GlobalRulestackResource, please refer to the document of GlobalRulestackResource + string globalRulestackName = "lrs1"; + ResourceIdentifier globalRulestackResourceId = GlobalRulestackResource.CreateResourceIdentifier(globalRulestackName); + GlobalRulestackResource globalRulestack = client.GetGlobalRulestackResource(globalRulestackResourceId); + + // get the collection of this PreRulestackRuleResource + PreRulestackRuleCollection collection = globalRulestack.GetPreRulestackRules(); + + // invoke the operation + string priority = "1"; + NullableResponse response = await collection.GetIfExistsAsync(priority); + PreRulestackRuleResource 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 + PreRulestackRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PreRules_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCertificateObjectCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCertificateObjectCollection.cs index 1ee731216590..cd93d265d58f 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCertificateObjectCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCertificateObjectCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name} + /// + /// + /// Operation Id + /// CertificateObjectGlobalRulestack_Get + /// + /// + /// + /// certificate name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _globalRulestackCertificateObjectCertificateObjectGlobalRulestackClientDiagnostics.CreateScope("GlobalRulestackCertificateObjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _globalRulestackCertificateObjectCertificateObjectGlobalRulestackRestClient.GetAsync(Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalRulestackCertificateObjectResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name} + /// + /// + /// Operation Id + /// CertificateObjectGlobalRulestack_Get + /// + /// + /// + /// certificate name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _globalRulestackCertificateObjectCertificateObjectGlobalRulestackClientDiagnostics.CreateScope("GlobalRulestackCertificateObjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = _globalRulestackCertificateObjectCertificateObjectGlobalRulestackRestClient.Get(Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalRulestackCertificateObjectResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCollection.cs index 3567051ab891..5167253f5f6e 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string globalRulestackName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName} + /// + /// + /// Operation Id + /// GlobalRulestack_Get + /// + /// + /// + /// GlobalRulestack resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string globalRulestackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(globalRulestackName, nameof(globalRulestackName)); + + using var scope = _globalRulestackClientDiagnostics.CreateScope("GlobalRulestackCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _globalRulestackRestClient.GetAsync(globalRulestackName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalRulestackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName} + /// + /// + /// Operation Id + /// GlobalRulestack_Get + /// + /// + /// + /// GlobalRulestack resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string globalRulestackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(globalRulestackName, nameof(globalRulestackName)); + + using var scope = _globalRulestackClientDiagnostics.CreateScope("GlobalRulestackCollection.GetIfExists"); + scope.Start(); + try + { + var response = _globalRulestackRestClient.Get(globalRulestackName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalRulestackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackFqdnCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackFqdnCollection.cs index 9cafda2f3a5e..4ee578844028 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackFqdnCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackFqdnCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name} + /// + /// + /// Operation Id + /// FqdnListGlobalRulestack_Get + /// + /// + /// + /// fqdn list name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _globalRulestackFqdnFqdnListGlobalRulestackClientDiagnostics.CreateScope("GlobalRulestackFqdnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _globalRulestackFqdnFqdnListGlobalRulestackRestClient.GetAsync(Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalRulestackFqdnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name} + /// + /// + /// Operation Id + /// FqdnListGlobalRulestack_Get + /// + /// + /// + /// fqdn list name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _globalRulestackFqdnFqdnListGlobalRulestackClientDiagnostics.CreateScope("GlobalRulestackFqdnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _globalRulestackFqdnFqdnListGlobalRulestackRestClient.Get(Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalRulestackFqdnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackPrefixCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackPrefixCollection.cs index 8174dbc5fa7c..d703910c0998 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackPrefixCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackPrefixCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name} + /// + /// + /// Operation Id + /// PrefixListGlobalRulestack_Get + /// + /// + /// + /// Local Rule priority. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _globalRulestackPrefixPrefixListGlobalRulestackClientDiagnostics.CreateScope("GlobalRulestackPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _globalRulestackPrefixPrefixListGlobalRulestackRestClient.GetAsync(Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalRulestackPrefixResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name} + /// + /// + /// Operation Id + /// PrefixListGlobalRulestack_Get + /// + /// + /// + /// Local Rule priority. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _globalRulestackPrefixPrefixListGlobalRulestackClientDiagnostics.CreateScope("GlobalRulestackPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = _globalRulestackPrefixPrefixListGlobalRulestackRestClient.Get(Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GlobalRulestackPrefixResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCertificateObjectCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCertificateObjectCollection.cs index 4e5799112615..1fb9d0d4283d 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCertificateObjectCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCertificateObjectCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name} + /// + /// + /// Operation Id + /// CertificateObjectLocalRulestack_Get + /// + /// + /// + /// certificate name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _localRulestackCertificateObjectCertificateObjectLocalRulestackClientDiagnostics.CreateScope("LocalRulestackCertificateObjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _localRulestackCertificateObjectCertificateObjectLocalRulestackRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackCertificateObjectResource(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/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name} + /// + /// + /// Operation Id + /// CertificateObjectLocalRulestack_Get + /// + /// + /// + /// certificate name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _localRulestackCertificateObjectCertificateObjectLocalRulestackClientDiagnostics.CreateScope("LocalRulestackCertificateObjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = _localRulestackCertificateObjectCertificateObjectLocalRulestackRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackCertificateObjectResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCollection.cs index 2e6c20337f39..91cc1c7a86db 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string localRulestackName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName} + /// + /// + /// Operation Id + /// LocalRulestacks_Get + /// + /// + /// + /// LocalRulestack resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string localRulestackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(localRulestackName, nameof(localRulestackName)); + + using var scope = _localRulestackClientDiagnostics.CreateScope("LocalRulestackCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _localRulestackRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, localRulestackName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackResource(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/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName} + /// + /// + /// Operation Id + /// LocalRulestacks_Get + /// + /// + /// + /// LocalRulestack resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string localRulestackName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(localRulestackName, nameof(localRulestackName)); + + using var scope = _localRulestackClientDiagnostics.CreateScope("LocalRulestackCollection.GetIfExists"); + scope.Start(); + try + { + var response = _localRulestackRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, localRulestackName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackFqdnCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackFqdnCollection.cs index d5ec6e6844f7..889bc4f88357 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackFqdnCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackFqdnCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name} + /// + /// + /// Operation Id + /// FqdnListLocalRulestack_Get + /// + /// + /// + /// fqdn list name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _localRulestackFqdnFqdnListLocalRulestackClientDiagnostics.CreateScope("LocalRulestackFqdnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _localRulestackFqdnFqdnListLocalRulestackRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackFqdnResource(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/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name} + /// + /// + /// Operation Id + /// FqdnListLocalRulestack_Get + /// + /// + /// + /// fqdn list name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _localRulestackFqdnFqdnListLocalRulestackClientDiagnostics.CreateScope("LocalRulestackFqdnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _localRulestackFqdnFqdnListLocalRulestackRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackFqdnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackPrefixCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackPrefixCollection.cs index aa027b42d25d..5af442342640 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackPrefixCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackPrefixCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name} + /// + /// + /// Operation Id + /// PrefixListLocalRulestack_Get + /// + /// + /// + /// Local Rule priority. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _localRulestackPrefixPrefixListLocalRulestackClientDiagnostics.CreateScope("LocalRulestackPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _localRulestackPrefixPrefixListLocalRulestackRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackPrefixResource(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/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name} + /// + /// + /// Operation Id + /// PrefixListLocalRulestack_Get + /// + /// + /// + /// Local Rule priority. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _localRulestackPrefixPrefixListLocalRulestackClientDiagnostics.CreateScope("LocalRulestackPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = _localRulestackPrefixPrefixListLocalRulestackRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackPrefixResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackRuleCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackRuleCollection.cs index 541582c91a1e..4633c08e74bf 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackRuleCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string priority, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority} + /// + /// + /// Operation Id + /// LocalRules_Get + /// + /// + /// + /// Local Rule priority. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string priority, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(priority, nameof(priority)); + + using var scope = _localRulestackRuleLocalRulesClientDiagnostics.CreateScope("LocalRulestackRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _localRulestackRuleLocalRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, priority, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackRuleResource(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/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority} + /// + /// + /// Operation Id + /// LocalRules_Get + /// + /// + /// + /// Local Rule priority. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string priority, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(priority, nameof(priority)); + + using var scope = _localRulestackRuleLocalRulesClientDiagnostics.CreateScope("LocalRulestackRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _localRulestackRuleLocalRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, priority, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocalRulestackRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallCollection.cs index d4b00d517bd3..72739613a20b 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string firewallName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName} + /// + /// + /// Operation Id + /// Firewalls_Get + /// + /// + /// + /// Firewall resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallName, nameof(firewallName)); + + using var scope = _paloAltoNetworksFirewallFirewallsClientDiagnostics.CreateScope("PaloAltoNetworksFirewallCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _paloAltoNetworksFirewallFirewallsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, firewallName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PaloAltoNetworksFirewallResource(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/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName} + /// + /// + /// Operation Id + /// Firewalls_Get + /// + /// + /// + /// Firewall resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallName, nameof(firewallName)); + + using var scope = _paloAltoNetworksFirewallFirewallsClientDiagnostics.CreateScope("PaloAltoNetworksFirewallCollection.GetIfExists"); + scope.Start(); + try + { + var response = _paloAltoNetworksFirewallFirewallsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, firewallName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PaloAltoNetworksFirewallResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PostRulestackRuleCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PostRulestackRuleCollection.cs index 8f603142cb25..bd590feee6bd 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PostRulestackRuleCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PostRulestackRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string priority, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority} + /// + /// + /// Operation Id + /// PostRules_Get + /// + /// + /// + /// Post Rule priority. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string priority, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(priority, nameof(priority)); + + using var scope = _postRulestackRulePostRulesClientDiagnostics.CreateScope("PostRulestackRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postRulestackRulePostRulesRestClient.GetAsync(Id.Name, priority, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostRulestackRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority} + /// + /// + /// Operation Id + /// PostRules_Get + /// + /// + /// + /// Post Rule priority. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string priority, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(priority, nameof(priority)); + + using var scope = _postRulestackRulePostRulesClientDiagnostics.CreateScope("PostRulestackRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postRulestackRulePostRulesRestClient.Get(Id.Name, priority, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostRulestackRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PreRulestackRuleCollection.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PreRulestackRuleCollection.cs index 125d634de219..1332a74407b4 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PreRulestackRuleCollection.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PreRulestackRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string priority, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority} + /// + /// + /// Operation Id + /// PreRules_Get + /// + /// + /// + /// Pre Rule priority. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string priority, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(priority, nameof(priority)); + + using var scope = _preRulestackRulePreRulesClientDiagnostics.CreateScope("PreRulestackRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _preRulestackRulePreRulesRestClient.GetAsync(Id.Name, priority, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PreRulestackRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority} + /// + /// + /// Operation Id + /// PreRules_Get + /// + /// + /// + /// Pre Rule priority. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string priority, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(priority, nameof(priority)); + + using var scope = _preRulestackRulePreRulesClientDiagnostics.CreateScope("PreRulestackRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _preRulestackRulePreRulesRestClient.Get(Id.Name, priority, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PreRulestackRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_ConnectionMonitorTestCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_ConnectionMonitorTestCollection.cs index cdc35cb9325f..a2ec7fb48390 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_ConnectionMonitorTestCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_ConnectionMonitorTestCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetConnectionMonitorTest() Console.WriteLine($"Succeeded: {result}"); } + // Get Connection Monitor Test + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConnectionMonitorTest() + { + // Generated from example definition: specification/peering/resource-manager/Microsoft.Peering/stable/2022-10-01/examples/GetConnectionMonitorTest.json + // this example is just showing the usage of "ConnectionMonitorTests_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 PeeringServiceResource created on azure + // for more information of creating PeeringServiceResource, please refer to the document of PeeringServiceResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string peeringServiceName = "peeringServiceName"; + ResourceIdentifier peeringServiceResourceId = PeeringServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, peeringServiceName); + PeeringServiceResource peeringService = client.GetPeeringServiceResource(peeringServiceResourceId); + + // get the collection of this ConnectionMonitorTestResource + ConnectionMonitorTestCollection collection = peeringService.GetConnectionMonitorTests(); + + // invoke the operation + string connectionMonitorTestName = "connectionMonitorTestName"; + NullableResponse response = await collection.GetIfExistsAsync(connectionMonitorTestName); + ConnectionMonitorTestResource 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 + ConnectionMonitorTestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Connection Monitor Test [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeerAsnCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeerAsnCollection.cs index 528f4ea1bdab..1b89a85a413e 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeerAsnCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeerAsnCollection.cs @@ -81,6 +81,47 @@ public async Task Exists_GetAPeerASN() Console.WriteLine($"Succeeded: {result}"); } + // Get a peer ASN + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPeerASN() + { + // Generated from example definition: specification/peering/resource-manager/Microsoft.Peering/stable/2022-10-01/examples/GetPeerAsn.json + // this example is just showing the usage of "PeerAsns_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subId"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this PeerAsnResource + PeerAsnCollection collection = subscriptionResource.GetPeerAsns(); + + // invoke the operation + string peerAsnName = "peerAsnName"; + NullableResponse response = await collection.GetIfExistsAsync(peerAsnName); + PeerAsnResource 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 + PeerAsnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a peer ASN [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringCollection.cs index 08c2b2c995ac..c5c0b85c4d28 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetAPeering() Console.WriteLine($"Succeeded: {result}"); } + // Get a peering + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPeering() + { + // Generated from example definition: specification/peering/resource-manager/Microsoft.Peering/stable/2022-10-01/examples/GetPeering.json + // this example is just showing the usage of "Peerings_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 = "subId"; + string resourceGroupName = "rgName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PeeringResource + PeeringCollection collection = resourceGroupResource.GetPeerings(); + + // invoke the operation + string peeringName = "peeringName"; + NullableResponse response = await collection.GetIfExistsAsync(peeringName); + PeeringResource 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 + PeeringData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a direct peering [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringRegisteredAsnCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringRegisteredAsnCollection.cs index 9fa7df9653ca..47573f863e6b 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringRegisteredAsnCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringRegisteredAsnCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetARegisteredASNAssociatedWithThePeering() Console.WriteLine($"Succeeded: {result}"); } + // Get a registered ASN associated with the peering + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARegisteredASNAssociatedWithThePeering() + { + // Generated from example definition: specification/peering/resource-manager/Microsoft.Peering/stable/2022-10-01/examples/GetRegisteredAsn.json + // this example is just showing the usage of "RegisteredAsns_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 PeeringResource created on azure + // for more information of creating PeeringResource, please refer to the document of PeeringResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string peeringName = "peeringName"; + ResourceIdentifier peeringResourceId = PeeringResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, peeringName); + PeeringResource peering = client.GetPeeringResource(peeringResourceId); + + // get the collection of this PeeringRegisteredAsnResource + PeeringRegisteredAsnCollection collection = peering.GetPeeringRegisteredAsns(); + + // invoke the operation + string registeredAsnName = "registeredAsnName0"; + NullableResponse response = await collection.GetIfExistsAsync(registeredAsnName); + PeeringRegisteredAsnResource 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 + PeeringRegisteredAsnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a registered ASN for the peering [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringRegisteredPrefixCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringRegisteredPrefixCollection.cs index b23f01c545a1..335e516d5a31 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringRegisteredPrefixCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringRegisteredPrefixCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetARegisteredPrefixAssociatedWithThePeering() Console.WriteLine($"Succeeded: {result}"); } + // Get a registered prefix associated with the peering + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARegisteredPrefixAssociatedWithThePeering() + { + // Generated from example definition: specification/peering/resource-manager/Microsoft.Peering/stable/2022-10-01/examples/GetRegisteredPrefix.json + // this example is just showing the usage of "RegisteredPrefixes_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 PeeringResource created on azure + // for more information of creating PeeringResource, please refer to the document of PeeringResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string peeringName = "peeringName"; + ResourceIdentifier peeringResourceId = PeeringResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, peeringName); + PeeringResource peering = client.GetPeeringResource(peeringResourceId); + + // get the collection of this PeeringRegisteredPrefixResource + PeeringRegisteredPrefixCollection collection = peering.GetPeeringRegisteredPrefixes(); + + // invoke the operation + string registeredPrefixName = "registeredPrefixName"; + NullableResponse response = await collection.GetIfExistsAsync(registeredPrefixName); + PeeringRegisteredPrefixResource 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 + PeeringRegisteredPrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a registered prefix for the peering [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringServiceCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringServiceCollection.cs index 0181d72b3569..4902195325ba 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringServiceCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringServiceCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetAPeeringService() Console.WriteLine($"Succeeded: {result}"); } + // Get a peering service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPeeringService() + { + // Generated from example definition: specification/peering/resource-manager/Microsoft.Peering/stable/2022-10-01/examples/GetPeeringService.json + // this example is just showing the usage of "PeeringServices_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 = "subId"; + string resourceGroupName = "rgName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PeeringServiceResource + PeeringServiceCollection collection = resourceGroupResource.GetPeeringServices(); + + // invoke the operation + string peeringServiceName = "peeringServiceName"; + NullableResponse response = await collection.GetIfExistsAsync(peeringServiceName); + PeeringServiceResource 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 + PeeringServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a peering service [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringServicePrefixCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringServicePrefixCollection.cs index 36b0422bcb30..cf2405e9e195 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringServicePrefixCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/samples/Generated/Samples/Sample_PeeringServicePrefixCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetAPrefixAssociatedWithThePeeringService() Console.WriteLine($"Succeeded: {result}"); } + // Get a prefix associated with the peering service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrefixAssociatedWithThePeeringService() + { + // Generated from example definition: specification/peering/resource-manager/Microsoft.Peering/stable/2022-10-01/examples/GetPeeringServicePrefix.json + // this example is just showing the usage of "Prefixes_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 PeeringServiceResource created on azure + // for more information of creating PeeringServiceResource, please refer to the document of PeeringServiceResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string peeringServiceName = "peeringServiceName"; + ResourceIdentifier peeringServiceResourceId = PeeringServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, peeringServiceName); + PeeringServiceResource peeringService = client.GetPeeringServiceResource(peeringServiceResourceId); + + // get the collection of this PeeringServicePrefixResource + PeeringServicePrefixCollection collection = peeringService.GetPeeringServicePrefixes(); + + // invoke the operation + string prefixName = "peeringServicePrefixName"; + NullableResponse response = await collection.GetIfExistsAsync(prefixName); + PeeringServicePrefixResource 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 + PeeringServicePrefixData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a prefix for the peering service [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestCollection.cs index a74ae2ee2a6e..b0ae44b2fd50 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string connectionMonitorTestName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName} + /// + /// + /// Operation Id + /// ConnectionMonitorTests_Get + /// + /// + /// + /// The name of the connection monitor test. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectionMonitorTestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionMonitorTestName, nameof(connectionMonitorTestName)); + + using var scope = _connectionMonitorTestClientDiagnostics.CreateScope("ConnectionMonitorTestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _connectionMonitorTestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionMonitorTestName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectionMonitorTestResource(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.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName} + /// + /// + /// Operation Id + /// ConnectionMonitorTests_Get + /// + /// + /// + /// The name of the connection monitor test. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectionMonitorTestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectionMonitorTestName, nameof(connectionMonitorTestName)); + + using var scope = _connectionMonitorTestClientDiagnostics.CreateScope("ConnectionMonitorTestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _connectionMonitorTestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionMonitorTestName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectionMonitorTestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnCollection.cs index f3ddd051dfb1..4b38c3914443 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string peerAsnName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName} + /// + /// + /// Operation Id + /// PeerAsns_Get + /// + /// + /// + /// The peer ASN name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string peerAsnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peerAsnName, nameof(peerAsnName)); + + using var scope = _peerAsnClientDiagnostics.CreateScope("PeerAsnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _peerAsnRestClient.GetAsync(Id.SubscriptionId, peerAsnName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeerAsnResource(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}/providers/Microsoft.Peering/peerAsns/{peerAsnName} + /// + /// + /// Operation Id + /// PeerAsns_Get + /// + /// + /// + /// The peer ASN name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string peerAsnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peerAsnName, nameof(peerAsnName)); + + using var scope = _peerAsnClientDiagnostics.CreateScope("PeerAsnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _peerAsnRestClient.Get(Id.SubscriptionId, peerAsnName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeerAsnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringCollection.cs index 761501d57495..d3ae1c6b2f4e 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string peeringName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName} + /// + /// + /// Operation Id + /// Peerings_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string peeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); + + using var scope = _peeringClientDiagnostics.CreateScope("PeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _peeringRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, peeringName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringResource(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.Peering/peerings/{peeringName} + /// + /// + /// Operation Id + /// Peerings_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string peeringName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); + + using var scope = _peeringClientDiagnostics.CreateScope("PeeringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _peeringRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, peeringName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnCollection.cs index 5672491ef553..c3ec718adcca 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string registeredAsnName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName} + /// + /// + /// Operation Id + /// RegisteredAsns_Get + /// + /// + /// + /// The name of the registered ASN. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string registeredAsnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registeredAsnName, nameof(registeredAsnName)); + + using var scope = _peeringRegisteredAsnRegisteredAsnsClientDiagnostics.CreateScope("PeeringRegisteredAsnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _peeringRegisteredAsnRegisteredAsnsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, registeredAsnName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringRegisteredAsnResource(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.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName} + /// + /// + /// Operation Id + /// RegisteredAsns_Get + /// + /// + /// + /// The name of the registered ASN. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string registeredAsnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registeredAsnName, nameof(registeredAsnName)); + + using var scope = _peeringRegisteredAsnRegisteredAsnsClientDiagnostics.CreateScope("PeeringRegisteredAsnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _peeringRegisteredAsnRegisteredAsnsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, registeredAsnName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringRegisteredAsnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixCollection.cs index fe221869c299..c682b563c3bc 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string registeredPrefixName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName} + /// + /// + /// Operation Id + /// RegisteredPrefixes_Get + /// + /// + /// + /// The name of the registered prefix. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string registeredPrefixName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registeredPrefixName, nameof(registeredPrefixName)); + + using var scope = _peeringRegisteredPrefixRegisteredPrefixesClientDiagnostics.CreateScope("PeeringRegisteredPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _peeringRegisteredPrefixRegisteredPrefixesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, registeredPrefixName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringRegisteredPrefixResource(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.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName} + /// + /// + /// Operation Id + /// RegisteredPrefixes_Get + /// + /// + /// + /// The name of the registered prefix. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string registeredPrefixName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registeredPrefixName, nameof(registeredPrefixName)); + + using var scope = _peeringRegisteredPrefixRegisteredPrefixesClientDiagnostics.CreateScope("PeeringRegisteredPrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = _peeringRegisteredPrefixRegisteredPrefixesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, registeredPrefixName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringRegisteredPrefixResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceCollection.cs index c694bf6beaca..ce844bd631c2 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string peeringServiceName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName} + /// + /// + /// Operation Id + /// PeeringServices_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string peeringServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringServiceName, nameof(peeringServiceName)); + + using var scope = _peeringServiceClientDiagnostics.CreateScope("PeeringServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _peeringServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, peeringServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringServiceResource(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.Peering/peeringServices/{peeringServiceName} + /// + /// + /// Operation Id + /// PeeringServices_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string peeringServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(peeringServiceName, nameof(peeringServiceName)); + + using var scope = _peeringServiceClientDiagnostics.CreateScope("PeeringServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _peeringServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, peeringServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixCollection.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixCollection.cs index d2bf7b537da9..5f9c41e510cf 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixCollection.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string prefixName, string expand = null, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName} + /// + /// + /// Operation Id + /// Prefixes_Get + /// + /// + /// + /// The name of the prefix. + /// The properties to be expanded. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string prefixName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(prefixName, nameof(prefixName)); + + using var scope = _peeringServicePrefixPrefixesClientDiagnostics.CreateScope("PeeringServicePrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _peeringServicePrefixPrefixesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, prefixName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringServicePrefixResource(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.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName} + /// + /// + /// Operation Id + /// Prefixes_Get + /// + /// + /// + /// The name of the prefix. + /// The properties to be expanded. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string prefixName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(prefixName, nameof(prefixName)); + + using var scope = _peeringServicePrefixPrefixesClientDiagnostics.CreateScope("PeeringServicePrefixCollection.GetIfExists"); + scope.Start(); + try + { + var response = _peeringServicePrefixPrefixesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, prefixName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PeeringServicePrefixResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyAttestationCollection.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyAttestationCollection.cs index 226839dfd59d..bce9b7a3057d 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyAttestationCollection.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyAttestationCollection.cs @@ -200,5 +200,45 @@ public async Task Exists_GetAttestationAtIndividualResourceScope() Console.WriteLine($"Succeeded: {result}"); } + + // Get attestation at individual resource scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAttestationAtIndividualResourceScope() + { + // Generated from example definition: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_GetResourceScope.json + // this example is just showing the usage of "Attestations_GetAtResource" 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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this PolicyAttestationResource + string resourceId = "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + PolicyAttestationCollection collection = client.GetPolicyAttestations(scopeId); + + // invoke the operation + string attestationName = "790996e6-9871-4b1f-9cd9-ec42cd6ced1e"; + NullableResponse response = await collection.GetIfExistsAsync(attestationName); + PolicyAttestationResource 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 + PolicyAttestationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyMetadataCollection.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyMetadataCollection.cs index 45ead18e7f27..58ce67243ccf 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyMetadataCollection.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyMetadataCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -75,6 +76,45 @@ public async Task Exists_GetASinglePolicyMetadataResource() Console.WriteLine($"Succeeded: {result}"); } + // Get a single policy metadata resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASinglePolicyMetadataResource() + { + // Generated from example definition: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_GetResource.json + // this example is just showing the usage of "PolicyMetadata_GetResource" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this PolicyMetadataResource + PolicyMetadataCollection collection = tenantResource.GetAllPolicyMetadata(); + + // invoke the operation + string resourceName = "NIST_SP_800-53_R4_AC-2"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + PolicyMetadataResource 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 + PolicyMetadataData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get collection of policy metadata resources [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyRemediationCollection.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyRemediationCollection.cs index 67079900d7ee..8ba74662d6ae 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyRemediationCollection.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/samples/Generated/Samples/Sample_PolicyRemediationCollection.cs @@ -181,5 +181,45 @@ public async Task Exists_GetRemediationAtIndividualResourceScope() Console.WriteLine($"Succeeded: {result}"); } + + // Get remediation at individual resource scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRemediationAtIndividualResourceScope() + { + // Generated from example definition: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetResourceScope.json + // this example is just showing the usage of "Remediations_GetAtResource" 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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this PolicyRemediationResource + string resourceId = "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + PolicyRemediationCollection collection = client.GetPolicyRemediations(scopeId); + + // invoke the operation + string remediationName = "storageRemediation"; + NullableResponse response = await collection.GetIfExistsAsync(remediationName); + PolicyRemediationResource 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 + PolicyRemediationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyAttestationCollection.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyAttestationCollection.cs index fa987ecfaa2c..32a7b3dd2bfb 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyAttestationCollection.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyAttestationCollection.cs @@ -316,6 +316,80 @@ public virtual Response Exists(string attestationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName} + /// + /// + /// Operation Id + /// Attestations_GetAtResource + /// + /// + /// + /// The name of the attestation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string attestationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attestationName, nameof(attestationName)); + + using var scope = _policyAttestationAttestationsClientDiagnostics.CreateScope("PolicyAttestationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _policyAttestationAttestationsRestClient.GetAtResourceAsync(Id, attestationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyAttestationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName} + /// + /// + /// Operation Id + /// Attestations_GetAtResource + /// + /// + /// + /// The name of the attestation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string attestationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(attestationName, nameof(attestationName)); + + using var scope = _policyAttestationAttestationsClientDiagnostics.CreateScope("PolicyAttestationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _policyAttestationAttestationsRestClient.GetAtResource(Id, attestationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyAttestationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyMetadataCollection.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyMetadataCollection.cs index 637bc311e618..946d5c6716a4 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyMetadataCollection.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyMetadataCollection.cs @@ -241,6 +241,78 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.PolicyInsights/policyMetadata/{resourceName} + /// + /// + /// Operation Id + /// PolicyMetadata_GetResource + /// + /// + /// + /// The name of the policy metadata resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceName, nameof(resourceName)); + + using var scope = _policyMetadataPolicyMetadataClientDiagnostics.CreateScope("PolicyMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _policyMetadataPolicyMetadataRestClient.GetResourceAsync(resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.PolicyInsights/policyMetadata/{resourceName} + /// + /// + /// Operation Id + /// PolicyMetadata_GetResource + /// + /// + /// + /// The name of the policy metadata resource. + /// The cancellation token to use. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceName, nameof(resourceName)); + + using var scope = _policyMetadataPolicyMetadataClientDiagnostics.CreateScope("PolicyMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = _policyMetadataPolicyMetadataRestClient.GetResource(resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationCollection.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationCollection.cs index 6e55b13db4e3..00f1296ec0ed 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationCollection.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationCollection.cs @@ -316,6 +316,80 @@ public virtual Response Exists(string remediationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName} + /// + /// + /// Operation Id + /// Remediations_GetAtResource + /// + /// + /// + /// The name of the remediation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string remediationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(remediationName, nameof(remediationName)); + + using var scope = _policyRemediationRemediationsClientDiagnostics.CreateScope("PolicyRemediationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _policyRemediationRemediationsRestClient.GetAtResourceAsync(Id, remediationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyRemediationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName} + /// + /// + /// Operation Id + /// Remediations_GetAtResource + /// + /// + /// + /// The name of the remediation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string remediationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(remediationName, nameof(remediationName)); + + using var scope = _policyRemediationRemediationsClientDiagnostics.CreateScope("PolicyRemediationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _policyRemediationRemediationsRestClient.GetAtResource(Id, remediationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyRemediationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationCollection.cs index b1452f449c1a..d501300a495b 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_ConfigurationGet() Console.WriteLine($"Succeeded: {result}"); } + // ConfigurationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConfigurationGet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json + // this example is just showing the usage of "Configurations_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 PostgreSqlServerResource created on azure + // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId); + + // get the collection of this PostgreSqlConfigurationResource + PostgreSqlConfigurationCollection collection = postgreSqlServer.GetPostgreSqlConfigurations(); + + // invoke the operation + string configurationName = "array_nulls"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + PostgreSqlConfigurationResource 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 + PostgreSqlConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConfigurationList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseCollection.cs index 2b5b7fe205f5..df77a922afcd 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_DatabaseGet() Console.WriteLine($"Succeeded: {result}"); } + // DatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DatabaseGet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json + // this example is just showing the usage of "Databases_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 PostgreSqlServerResource created on azure + // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId); + + // get the collection of this PostgreSqlDatabaseResource + PostgreSqlDatabaseCollection collection = postgreSqlServer.GetPostgreSqlDatabases(); + + // invoke the operation + string databaseName = "db1"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + PostgreSqlDatabaseResource 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 + PostgreSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DatabaseList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleCollection.cs index 9acad1a3bb4f..d035f4fe79da 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_FirewallRuleGet() Console.WriteLine($"Succeeded: {result}"); } + // FirewallRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FirewallRuleGet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json + // this example is just showing the usage of "FirewallRules_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 PostgreSqlServerResource created on azure + // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId); + + // get the collection of this PostgreSqlFirewallRuleResource + PostgreSqlFirewallRuleCollection collection = postgreSqlServer.GetPostgreSqlFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + PostgreSqlFirewallRuleResource 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 + PostgreSqlFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FirewallRuleList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs index 6c4f9cbb456e..10b3224cbc60 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs @@ -126,6 +126,49 @@ public async Task Exists_ServerGet() Console.WriteLine($"Succeeded: {result}"); } + // ServerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServerGet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorGet.json + // this example is just showing the usage of "Administrators_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 PostgreSqlFlexibleServerResource created on azure + // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + string serverName = "pgtestsvc1"; + ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId); + + // get the collection of this PostgreSqlFlexibleServerActiveDirectoryAdministratorResource + PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerActiveDirectoryAdministrators(); + + // invoke the operation + string objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; + NullableResponse response = await collection.GetIfExistsAsync(objectId); + PostgreSqlFlexibleServerActiveDirectoryAdministratorResource 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 + PostgreSqlFlexibleServerActiveDirectoryAdministratorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AdministratorsListByServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupCollection.cs index 6f1dc8d67033..6de42a993b82 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetABackupForAServer() Console.WriteLine($"Succeeded: {result}"); } + // Get a backup for a server + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetABackupForAServer() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupGet.json + // this example is just showing the usage of "Backups_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 PostgreSqlFlexibleServerResource created on azure + // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "postgresqltestserver"; + ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId); + + // get the collection of this PostgreSqlFlexibleServerBackupResource + PostgreSqlFlexibleServerBackupCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerBackups(); + + // invoke the operation + string backupName = "daily_20210615T160516"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + PostgreSqlFlexibleServerBackupResource 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 + PostgreSqlFlexibleServerBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List backups for a server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs index 51fa2c1c2a41..741bb3799907 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs @@ -507,6 +507,48 @@ public async Task Exists_ServerGet() Console.WriteLine($"Succeeded: {result}"); } + // ServerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServerGet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGet.json + // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PostgreSqlFlexibleServerResource + PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers(); + + // invoke the operation + string serverName = "pgtestsvc1"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + PostgreSqlFlexibleServerResource 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 + PostgreSqlFlexibleServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ServerGetWithVnet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -571,6 +613,48 @@ public async Task Exists_ServerGetWithVnet() Console.WriteLine($"Succeeded: {result}"); } + // ServerGetWithVnet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServerGetWithVnet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGetWithVnet.json + // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PostgreSqlFlexibleServerResource + PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers(); + + // invoke the operation + string serverName = "pgtestsvc4"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + PostgreSqlFlexibleServerResource 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 + PostgreSqlFlexibleServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ServerListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationCollection.cs index fce6949afb5e..df45f8ae1bef 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ConfigurationGet() Console.WriteLine($"Succeeded: {result}"); } + // ConfigurationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConfigurationGet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationGet.json + // this example is just showing the usage of "Configurations_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 PostgreSqlFlexibleServerResource created on azure + // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + string serverName = "testserver"; + ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId); + + // get the collection of this PostgreSqlFlexibleServerConfigurationResource + PostgreSqlFlexibleServerConfigurationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerConfigurations(); + + // invoke the operation + string configurationName = "array_nulls"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + PostgreSqlFlexibleServerConfigurationResource 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 + PostgreSqlFlexibleServerConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a user configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseCollection.cs index 06adde43546c..dd93f5c2a570 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_GetADatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get a database + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabase() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseGet.json + // this example is just showing the usage of "Databases_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 PostgreSqlFlexibleServerResource created on azure + // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "testserver"; + ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId); + + // get the collection of this PostgreSqlFlexibleServerDatabaseResource + PostgreSqlFlexibleServerDatabaseCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerDatabases(); + + // invoke the operation + string databaseName = "db1"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + PostgreSqlFlexibleServerDatabaseResource 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 + PostgreSqlFlexibleServerDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List databases in a server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleCollection.cs index de5714383984..f6022e62063b 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_FirewallRuleList() Console.WriteLine($"Succeeded: {result}"); } + // FirewallRuleList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FirewallRuleList() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleGet.json + // this example is just showing the usage of "FirewallRules_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 PostgreSqlFlexibleServerResource created on azure + // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + string serverName = "testserver"; + ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId); + + // get the collection of this PostgreSqlFlexibleServerFirewallRuleResource + PostgreSqlFlexibleServerFirewallRuleCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + PostgreSqlFlexibleServerFirewallRuleResource 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 + PostgreSqlFlexibleServerFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FirewallRuleList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationCollection.cs index a2769c985b45..8823a39f5cf7 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_Sample() Console.WriteLine($"Succeeded: {result}"); } + // Sample + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_Sample() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationGet.json + // this example is just showing the usage of "ltrBackupOperations_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 PostgreSqlFlexibleServerResource created on azure + // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "rgLongTermRetention"; + string serverName = "pgsqlltrtestserver"; + ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId); + + // get the collection of this PostgreSqlLtrServerBackupOperationResource + PostgreSqlLtrServerBackupOperationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlLtrServerBackupOperations(); + + // invoke the operation + string backupName = "backup1"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + PostgreSqlLtrServerBackupOperationResource 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 + PostgreSqlLtrServerBackupOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Sample List of Long Tern Retention Operations by Flexible Server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationCollection.cs index f95efbe08309..60075b4c8a28 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationCollection.cs @@ -181,6 +181,49 @@ public async Task Exists_MigrationsGet() Console.WriteLine($"Succeeded: {result}"); } + // Migrations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MigrationsGet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Get.json + // this example is just showing the usage of "Migrations_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 PostgreSqlFlexibleServerResource created on azure + // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + string targetDbServerName = "testtarget"; + ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName); + PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId); + + // get the collection of this PostgreSqlMigrationResource + PostgreSqlMigrationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlMigrations(); + + // invoke the operation + string migrationName = "testmigration"; + NullableResponse response = await collection.GetIfExistsAsync(migrationName); + PostgreSqlMigrationResource 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 + PostgreSqlMigrationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Migrations_ListByTargetServer [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionCollection.cs index 3d6ac24429fa..309e4e4d284b 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 PostgreSqlServerResource created on azure + // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "test-svr"; + ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId); + + // get the collection of this PostgreSqlPrivateEndpointConnectionResource + PostgreSqlPrivateEndpointConnectionCollection collection = postgreSqlServer.GetPostgreSqlPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "private-endpoint-connection-name"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + PostgreSqlPrivateEndpointConnectionResource 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 + PostgreSqlPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a private endpoint connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResourceCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResourceCollection.cs index 2ad5a19787e9..6653939e5753 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResourceCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsAPrivateLinkResourceForPostgreSQL() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a private link resource for PostgreSQL. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAPrivateLinkResourceForPostgreSQL() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json + // this example is just showing the usage of "PrivateLinkResources_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 PostgreSqlServerResource created on azure + // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "test-svr"; + ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId); + + // get the collection of this PostgreSqlPrivateLinkResource + PostgreSqlPrivateLinkResourceCollection collection = postgreSqlServer.GetPostgreSqlPrivateLinkResources(); + + // invoke the operation + string groupName = "plr"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + PostgreSqlPrivateLinkResource 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 + PostgreSqlPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerCollection.cs index 74fbe57fcddd..d817dd9d241d 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerCollection.cs @@ -281,6 +281,48 @@ public async Task Exists_ServerGet() Console.WriteLine($"Succeeded: {result}"); } + // ServerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServerGet() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json + // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PostgreSqlServerResource + PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers(); + + // invoke the operation + string serverName = "pgtestsvc1"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + PostgreSqlServerResource 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 + PostgreSqlServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ServerListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyCollection.cs index 7aadc6043331..205088bc7a28 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetThePostgreSQLServerKey() Console.WriteLine($"Succeeded: {result}"); } + // Get the PostgreSQL Server key + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetThePostgreSQLServerKey() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json + // this example is just showing the usage of "ServerKeys_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 PostgreSqlServerResource created on azure + // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + string serverName = "testserver"; + ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId); + + // get the collection of this PostgreSqlServerKeyResource + PostgreSqlServerKeyCollection collection = postgreSqlServer.GetPostgreSqlServerKeys(); + + // invoke the operation + string keyName = "someVault_someKey_01234567890123456789012345678901"; + NullableResponse response = await collection.GetIfExistsAsync(keyName); + PostgreSqlServerKeyResource 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 + PostgreSqlServerKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a PostgreSQL Server key [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyCollection.cs index fe2ade8a83d3..f3b1626c04aa 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAServerSThreatDetectionPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a server's threat detection policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerSThreatDetectionPolicy() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json + // this example is just showing the usage of "ServerSecurityAlertPolicies_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 PostgreSqlServerResource created on azure + // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "securityalert-4799"; + string serverName = "securityalert-6440"; + ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId); + + // get the collection of this PostgreSqlServerSecurityAlertPolicyResource + PostgreSqlServerSecurityAlertPolicyCollection collection = postgreSqlServer.GetPostgreSqlServerSecurityAlertPolicies(); + + // invoke the operation + PostgreSqlSecurityAlertPolicyName securityAlertPolicyName = PostgreSqlSecurityAlertPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(securityAlertPolicyName); + PostgreSqlServerSecurityAlertPolicyResource 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 + PostgreSqlServerSecurityAlertPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a server's threat detection policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleCollection.cs index 9a77a4760dff..bb3ab2da5093 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetsAVirtualNetworkRule() Console.WriteLine($"Succeeded: {result}"); } + // Gets a virtual network rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAVirtualNetworkRule() + { + // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json + // this example is just showing the usage of "VirtualNetworkRules_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 PostgreSqlServerResource created on azure + // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string serverName = "vnet-test-svr"; + ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId); + + // get the collection of this PostgreSqlVirtualNetworkRuleResource + PostgreSqlVirtualNetworkRuleCollection collection = postgreSqlServer.GetPostgreSqlVirtualNetworkRules(); + + // invoke the operation + string virtualNetworkRuleName = "vnet-firewall-rule"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkRuleName); + PostgreSqlVirtualNetworkRuleResource 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 + PostgreSqlVirtualNetworkRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a virtual network rule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlConfigurationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlConfigurationCollection.cs index a739d51ef870..2da43b31ca06 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlConfigurationCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlConfigurationCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the server configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _postgreSqlConfigurationConfigurationsClientDiagnostics.CreateScope("PostgreSqlConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlConfigurationConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlConfigurationResource(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.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the server configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _postgreSqlConfigurationConfigurationsClientDiagnostics.CreateScope("PostgreSqlConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlConfigurationConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlDatabaseCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlDatabaseCollection.cs index 9e1a923418e7..81ced14ce5a2 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlDatabaseCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlDatabaseCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _postgreSqlDatabaseDatabasesClientDiagnostics.CreateScope("PostgreSqlDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlDatabaseDatabasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlDatabaseResource(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.DBforPostgreSQL/servers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _postgreSqlDatabaseDatabasesClientDiagnostics.CreateScope("PostgreSqlDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlDatabaseDatabasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlFirewallRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlFirewallRuleCollection.cs index 4c7d99a995d9..a61073c8ec8d 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlFirewallRuleCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlFirewallRuleCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the server firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _postgreSqlFirewallRuleFirewallRulesClientDiagnostics.CreateScope("PostgreSqlFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFirewallRuleResource(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.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the server firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _postgreSqlFirewallRuleFirewallRulesClientDiagnostics.CreateScope("PostgreSqlFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateEndpointConnectionCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateEndpointConnectionCollection.cs index 863c1c96b239..779ab3fda81f 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateEndpointConnectionCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _postgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("PostgreSqlPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlPrivateEndpointConnectionResource(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.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _postgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("PostgreSqlPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateLinkResourceCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateLinkResourceCollection.cs index e4c55de7a964..57db7b3b5f92 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateLinkResourceCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _postgreSqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("PostgreSqlPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlPrivateLinkResource(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.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _postgreSqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("PostgreSqlPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerCollection.cs index b4f888e0ceca..020920c4a388 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerCollection.cs @@ -379,6 +379,80 @@ public virtual Response Exists(string serverName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _postgreSqlServerServersClientDiagnostics.CreateScope("PostgreSqlServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlServerServersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlServerResource(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.DBforPostgreSQL/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _postgreSqlServerServersClientDiagnostics.CreateScope("PostgreSqlServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlServerServersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerKeyCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerKeyCollection.cs index 443ee58db063..eab7b5d09a13 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerKeyCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerKeyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string keyName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName} + /// + /// + /// Operation Id + /// ServerKeys_Get + /// + /// + /// + /// The name of the PostgreSQL Server key to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _postgreSqlServerKeyServerKeysClientDiagnostics.CreateScope("PostgreSqlServerKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlServerKeyServerKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlServerKeyResource(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.DBforPostgreSQL/servers/{serverName}/keys/{keyName} + /// + /// + /// Operation Id + /// ServerKeys_Get + /// + /// + /// + /// The name of the PostgreSQL Server key to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _postgreSqlServerKeyServerKeysClientDiagnostics.CreateScope("PostgreSqlServerKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlServerKeyServerKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlServerKeyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerSecurityAlertPolicyCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerSecurityAlertPolicyCollection.cs index 017e15e226ff..7cbf8dae2fe2 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerSecurityAlertPolicyCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerSecurityAlertPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(PostgreSqlSecurityAlertPolicyName securityA } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ServerSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PostgreSqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _postgreSqlServerSecurityAlertPolicyServerSecurityAlertPoliciesClientDiagnostics.CreateScope("PostgreSqlServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlServerSecurityAlertPolicyServerSecurityAlertPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlServerSecurityAlertPolicyResource(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.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ServerSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PostgreSqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _postgreSqlServerSecurityAlertPolicyServerSecurityAlertPoliciesClientDiagnostics.CreateScope("PostgreSqlServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlServerSecurityAlertPolicyServerSecurityAlertPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlServerSecurityAlertPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlVirtualNetworkRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlVirtualNetworkRuleCollection.cs index be5408c50898..2d395259aaa6 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlVirtualNetworkRuleCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlVirtualNetworkRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string virtualNetworkRuleName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkRules_Get + /// + /// + /// + /// The name of the virtual network rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkRuleName, nameof(virtualNetworkRuleName)); + + using var scope = _postgreSqlVirtualNetworkRuleVirtualNetworkRulesClientDiagnostics.CreateScope("PostgreSqlVirtualNetworkRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlVirtualNetworkRuleVirtualNetworkRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlVirtualNetworkRuleResource(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.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkRules_Get + /// + /// + /// + /// The name of the virtual network rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkRuleName, nameof(virtualNetworkRuleName)); + + using var scope = _postgreSqlVirtualNetworkRuleVirtualNetworkRulesClientDiagnostics.CreateScope("PostgreSqlVirtualNetworkRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlVirtualNetworkRuleVirtualNetworkRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlVirtualNetworkRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs index b66509328a18..9ce2dd2506e4 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string objectId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId} + /// + /// + /// Operation Id + /// Administrators_Get + /// + /// + /// + /// Guid of the objectId for the administrator. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string objectId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(objectId, nameof(objectId)); + + using var scope = _postgreSqlFlexibleServerActiveDirectoryAdministratorAdministratorsClientDiagnostics.CreateScope("PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlFlexibleServerActiveDirectoryAdministratorAdministratorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, objectId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerActiveDirectoryAdministratorResource(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.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId} + /// + /// + /// Operation Id + /// Administrators_Get + /// + /// + /// + /// Guid of the objectId for the administrator. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string objectId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(objectId, nameof(objectId)); + + using var scope = _postgreSqlFlexibleServerActiveDirectoryAdministratorAdministratorsClientDiagnostics.CreateScope("PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlFlexibleServerActiveDirectoryAdministratorAdministratorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, objectId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerActiveDirectoryAdministratorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerBackupCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerBackupCollection.cs index b670d82860f1..67074e0a2e4c 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerBackupCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerBackupCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName} + /// + /// + /// Operation Id + /// Backups_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _postgreSqlFlexibleServerBackupBackupsClientDiagnostics.CreateScope("PostgreSqlFlexibleServerBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlFlexibleServerBackupBackupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerBackupResource(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.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName} + /// + /// + /// Operation Id + /// Backups_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _postgreSqlFlexibleServerBackupBackupsClientDiagnostics.CreateScope("PostgreSqlFlexibleServerBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlFlexibleServerBackupBackupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerCollection.cs index 1b1daee7c60d..bca8ee41b778 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerCollection.cs @@ -380,6 +380,80 @@ public virtual Response Exists(string serverName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _postgreSqlFlexibleServerServersClientDiagnostics.CreateScope("PostgreSqlFlexibleServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlFlexibleServerServersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerResource(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.DBforPostgreSQL/flexibleServers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _postgreSqlFlexibleServerServersClientDiagnostics.CreateScope("PostgreSqlFlexibleServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlFlexibleServerServersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serverName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerConfigurationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerConfigurationCollection.cs index 91b84114cb52..1e45493d9fef 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerConfigurationCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerConfigurationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the server configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _postgreSqlFlexibleServerConfigurationConfigurationsClientDiagnostics.CreateScope("PostgreSqlFlexibleServerConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlFlexibleServerConfigurationConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerConfigurationResource(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.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the server configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _postgreSqlFlexibleServerConfigurationConfigurationsClientDiagnostics.CreateScope("PostgreSqlFlexibleServerConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlFlexibleServerConfigurationConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerDatabaseCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerDatabaseCollection.cs index db8a740af27c..04931f5853ac 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerDatabaseCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerDatabaseCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _postgreSqlFlexibleServerDatabaseDatabasesClientDiagnostics.CreateScope("PostgreSqlFlexibleServerDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlFlexibleServerDatabaseDatabasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerDatabaseResource(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.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _postgreSqlFlexibleServerDatabaseDatabasesClientDiagnostics.CreateScope("PostgreSqlFlexibleServerDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlFlexibleServerDatabaseDatabasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerFirewallRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerFirewallRuleCollection.cs index 4027345ab8f3..7ec72c0fd6fd 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerFirewallRuleCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerFirewallRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the server firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _postgreSqlFlexibleServerFirewallRuleFirewallRulesClientDiagnostics.CreateScope("PostgreSqlFlexibleServerFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlFlexibleServerFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerFirewallRuleResource(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.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the server firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _postgreSqlFlexibleServerFirewallRuleFirewallRulesClientDiagnostics.CreateScope("PostgreSqlFlexibleServerFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlFlexibleServerFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlFlexibleServerFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlLtrServerBackupOperationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlLtrServerBackupOperationCollection.cs index af4af87def95..abfedaeb3679 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlLtrServerBackupOperationCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlLtrServerBackupOperationCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName} + /// + /// + /// Operation Id + /// ltrBackupOperations_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _postgreSqlLtrServerBackupOperationltrBackupOperationsClientDiagnostics.CreateScope("PostgreSqlLtrServerBackupOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlLtrServerBackupOperationltrBackupOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlLtrServerBackupOperationResource(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.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName} + /// + /// + /// Operation Id + /// ltrBackupOperations_Get + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _postgreSqlLtrServerBackupOperationltrBackupOperationsClientDiagnostics.CreateScope("PostgreSqlLtrServerBackupOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlLtrServerBackupOperationltrBackupOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlLtrServerBackupOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlMigrationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlMigrationCollection.cs index dab3a3dd8f66..19ae85fbb038 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlMigrationCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlMigrationCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string migrationName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName} + /// + /// + /// Operation Id + /// Migrations_Get + /// + /// + /// + /// The name of the migration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string migrationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(migrationName, nameof(migrationName)); + + using var scope = _postgreSqlMigrationMigrationsClientDiagnostics.CreateScope("PostgreSqlMigrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _postgreSqlMigrationMigrationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, migrationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlMigrationResource(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.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName} + /// + /// + /// Operation Id + /// Migrations_Get + /// + /// + /// + /// The name of the migration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string migrationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(migrationName, nameof(migrationName)); + + using var scope = _postgreSqlMigrationMigrationsClientDiagnostics.CreateScope("PostgreSqlMigrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _postgreSqlMigrationMigrationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, migrationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PostgreSqlMigrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/samples/Generated/Samples/Sample_AutoScaleVCoreCollection.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/samples/Generated/Samples/Sample_AutoScaleVCoreCollection.cs index 84e266acf478..06c5b77c328a 100644 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/samples/Generated/Samples/Sample_AutoScaleVCoreCollection.cs +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/samples/Generated/Samples/Sample_AutoScaleVCoreCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetDetailsOfAnAutoScaleVCore() Console.WriteLine($"Succeeded: {result}"); } + // Get details of an auto scale v-core + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsOfAnAutoScaleVCore() + { + // Generated from example definition: specification/powerbidedicated/resource-manager/Microsoft.PowerBIdedicated/stable/2021-01-01/examples/getAutoScaleVCore.json + // this example is just showing the usage of "AutoScaleVCores_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 = "613192d7-503f-477a-9cfe-4efc3ee2bd60"; + string resourceGroupName = "TestRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AutoScaleVCoreResource + AutoScaleVCoreCollection collection = resourceGroupResource.GetAutoScaleVCores(); + + // invoke the operation + string vcoreName = "testvcore"; + NullableResponse response = await collection.GetIfExistsAsync(vcoreName); + AutoScaleVCoreResource 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 + AutoScaleVCoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create auto scale v-core [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/samples/Generated/Samples/Sample_DedicatedCapacityCollection.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/samples/Generated/Samples/Sample_DedicatedCapacityCollection.cs index 864e99e225e2..f956b2c5599a 100644 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/samples/Generated/Samples/Sample_DedicatedCapacityCollection.cs +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/samples/Generated/Samples/Sample_DedicatedCapacityCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetDetailsOfACapacity() Console.WriteLine($"Succeeded: {result}"); } + // Get details of a capacity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsOfACapacity() + { + // Generated from example definition: specification/powerbidedicated/resource-manager/Microsoft.PowerBIdedicated/stable/2021-01-01/examples/getCapacity.json + // this example is just showing the usage of "Capacities_GetDetails" 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 = "613192d7-503f-477a-9cfe-4efc3ee2bd60"; + string resourceGroupName = "TestRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DedicatedCapacityResource + DedicatedCapacityCollection collection = resourceGroupResource.GetDedicatedCapacities(); + + // invoke the operation + string dedicatedCapacityName = "azsdktest"; + NullableResponse response = await collection.GetIfExistsAsync(dedicatedCapacityName); + DedicatedCapacityResource 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 + DedicatedCapacityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create capacity [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/AutoScaleVCoreCollection.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/AutoScaleVCoreCollection.cs index 5714f9779cd4..123d1431a5ff 100644 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/AutoScaleVCoreCollection.cs +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/AutoScaleVCoreCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string vcoreName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/autoScaleVCores/{vcoreName} + /// + /// + /// Operation Id + /// AutoScaleVCores_Get + /// + /// + /// + /// The name of the auto scale v-core. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vcoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vcoreName, nameof(vcoreName)); + + using var scope = _autoScaleVCoreClientDiagnostics.CreateScope("AutoScaleVCoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _autoScaleVCoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vcoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutoScaleVCoreResource(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.PowerBIDedicated/autoScaleVCores/{vcoreName} + /// + /// + /// Operation Id + /// AutoScaleVCores_Get + /// + /// + /// + /// The name of the auto scale v-core. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vcoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vcoreName, nameof(vcoreName)); + + using var scope = _autoScaleVCoreClientDiagnostics.CreateScope("AutoScaleVCoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _autoScaleVCoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vcoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutoScaleVCoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/DedicatedCapacityCollection.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/DedicatedCapacityCollection.cs index 40b99b992c0f..b8d01948f2b1 100644 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/DedicatedCapacityCollection.cs +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/DedicatedCapacityCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string dedicatedCapacityName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName} + /// + /// + /// Operation Id + /// Capacities_GetDetails + /// + /// + /// + /// The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dedicatedCapacityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dedicatedCapacityName, nameof(dedicatedCapacityName)); + + using var scope = _dedicatedCapacityCapacitiesClientDiagnostics.CreateScope("DedicatedCapacityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dedicatedCapacityCapacitiesRestClient.GetDetailsAsync(Id.SubscriptionId, Id.ResourceGroupName, dedicatedCapacityName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DedicatedCapacityResource(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.PowerBIDedicated/capacities/{dedicatedCapacityName} + /// + /// + /// Operation Id + /// Capacities_GetDetails + /// + /// + /// + /// The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dedicatedCapacityName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dedicatedCapacityName, nameof(dedicatedCapacityName)); + + using var scope = _dedicatedCapacityCapacitiesClientDiagnostics.CreateScope("DedicatedCapacityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dedicatedCapacityCapacitiesRestClient.GetDetails(Id.SubscriptionId, Id.ResourceGroupName, dedicatedCapacityName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DedicatedCapacityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/PrivateDnsZoneCollection.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/PrivateDnsZoneCollection.cs index 27c8be280119..4927d9b27293 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/PrivateDnsZoneCollection.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/PrivateDnsZoneCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string privateZoneName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName} + /// + /// + /// Operation Id + /// PrivateZones_Get + /// + /// + /// + /// The name of the Private DNS zone (without a terminating dot). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateZoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateZoneName, nameof(privateZoneName)); + + using var scope = _privateDnsZonePrivateZonesClientDiagnostics.CreateScope("PrivateDnsZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _privateDnsZonePrivateZonesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateZoneName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateDnsZoneResource(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.Network/privateDnsZones/{privateZoneName} + /// + /// + /// Operation Id + /// PrivateZones_Get + /// + /// + /// + /// The name of the Private DNS zone (without a terminating dot). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateZoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateZoneName, nameof(privateZoneName)); + + using var scope = _privateDnsZonePrivateZonesClientDiagnostics.CreateScope("PrivateDnsZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = _privateDnsZonePrivateZonesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateZoneName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateDnsZoneResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkCollection.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkCollection.cs index 6d33865ab884..5ed73fb94a7e 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkCollection.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string virtualNetworkLinkName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName} + /// + /// + /// Operation Id + /// VirtualNetworkLinks_Get + /// + /// + /// + /// The name of the virtual network link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkLinkName, nameof(virtualNetworkLinkName)); + + using var scope = _virtualNetworkLinkClientDiagnostics.CreateScope("VirtualNetworkLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualNetworkLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkLinkResource(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.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName} + /// + /// + /// Operation Id + /// VirtualNetworkLinks_Get + /// + /// + /// + /// The name of the virtual network link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkLinkName, nameof(virtualNetworkLinkName)); + + using var scope = _virtualNetworkLinkClientDiagnostics.CreateScope("VirtualNetworkLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualNetworkLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_CustomRolloutCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_CustomRolloutCollection.cs index 742eb90eab3e..4f57e08dfb6f 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_CustomRolloutCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_CustomRolloutCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_CustomRolloutsGet() Console.WriteLine($"Succeeded: {result}"); } + // CustomRollouts_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CustomRolloutsGet() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/CustomRollouts_Get.json + // this example is just showing the usage of "CustomRollouts_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 ProviderRegistrationResource created on azure + // for more information of creating ProviderRegistrationResource, please refer to the document of ProviderRegistrationResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + string providerNamespace = "Microsoft.Contoso"; + ResourceIdentifier providerRegistrationResourceId = ProviderRegistrationResource.CreateResourceIdentifier(subscriptionId, providerNamespace); + ProviderRegistrationResource providerRegistration = client.GetProviderRegistrationResource(providerRegistrationResourceId); + + // get the collection of this CustomRolloutResource + CustomRolloutCollection collection = providerRegistration.GetCustomRollouts(); + + // invoke the operation + string rolloutName = "canaryTesting99"; + NullableResponse response = await collection.GetIfExistsAsync(rolloutName); + CustomRolloutResource 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 + CustomRolloutData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CustomRollouts_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_DefaultRolloutCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_DefaultRolloutCollection.cs index 514d14c17a82..139ddb999981 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_DefaultRolloutCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_DefaultRolloutCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_DefaultRolloutsGet() Console.WriteLine($"Succeeded: {result}"); } + // DefaultRollouts_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DefaultRolloutsGet() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/DefaultRollouts_Get.json + // this example is just showing the usage of "DefaultRollouts_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 ProviderRegistrationResource created on azure + // for more information of creating ProviderRegistrationResource, please refer to the document of ProviderRegistrationResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + string providerNamespace = "Microsoft.Contoso"; + ResourceIdentifier providerRegistrationResourceId = ProviderRegistrationResource.CreateResourceIdentifier(subscriptionId, providerNamespace); + ProviderRegistrationResource providerRegistration = client.GetProviderRegistrationResource(providerRegistrationResourceId); + + // get the collection of this DefaultRolloutResource + DefaultRolloutCollection collection = providerRegistration.GetDefaultRollouts(); + + // invoke the operation + string rolloutName = "2020week10"; + NullableResponse response = await collection.GetIfExistsAsync(rolloutName); + DefaultRolloutResource 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 + DefaultRolloutData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DefaultRollouts_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeFirstSkuCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeFirstSkuCollection.cs index ab61b25bdf65..87a17984fac2 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeFirstSkuCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeFirstSkuCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_SkusGetNestedResourceTypeFirst() Console.WriteLine($"Succeeded: {result}"); } + // Skus_GetNestedResourceTypeFirst + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SkusGetNestedResourceTypeFirst() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/Skus_GetNestedResourceTypeFirst.json + // this example is just showing the usage of "Skus_GetNestedResourceTypeFirst" 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 ResourceTypeRegistrationResource created on azure + // for more information of creating ResourceTypeRegistrationResource, please refer to the document of ResourceTypeRegistrationResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + string providerNamespace = "Microsoft.Contoso"; + string resourceType = "testResourceType"; + ResourceIdentifier resourceTypeRegistrationResourceId = ResourceTypeRegistrationResource.CreateResourceIdentifier(subscriptionId, providerNamespace, resourceType); + ResourceTypeRegistrationResource resourceTypeRegistration = client.GetResourceTypeRegistrationResource(resourceTypeRegistrationResourceId); + + // get the collection of this NestedResourceTypeFirstSkuResource + string nestedResourceTypeFirst = "nestedResourceTypeFirst"; + NestedResourceTypeFirstSkuCollection collection = resourceTypeRegistration.GetNestedResourceTypeFirstSkus(nestedResourceTypeFirst); + + // invoke the operation + string sku = "testSku"; + NullableResponse response = await collection.GetIfExistsAsync(sku); + NestedResourceTypeFirstSkuResource 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 + ResourceTypeSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Skus_CreateOrUpdateNestedResourceTypeFirst [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeSecondSkuCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeSecondSkuCollection.cs index c10b5b5bd3ba..5b25e59a75bb 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeSecondSkuCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeSecondSkuCollection.cs @@ -88,6 +88,51 @@ public async Task Exists_SkusGetNestedResourceTypeSecond() Console.WriteLine($"Succeeded: {result}"); } + // Skus_GetNestedResourceTypeSecond + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SkusGetNestedResourceTypeSecond() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/Skus_GetNestedResourceTypeSecond.json + // this example is just showing the usage of "Skus_GetNestedResourceTypeSecond" 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 ResourceTypeRegistrationResource created on azure + // for more information of creating ResourceTypeRegistrationResource, please refer to the document of ResourceTypeRegistrationResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + string providerNamespace = "Microsoft.Contoso"; + string resourceType = "testResourceType"; + ResourceIdentifier resourceTypeRegistrationResourceId = ResourceTypeRegistrationResource.CreateResourceIdentifier(subscriptionId, providerNamespace, resourceType); + ResourceTypeRegistrationResource resourceTypeRegistration = client.GetResourceTypeRegistrationResource(resourceTypeRegistrationResourceId); + + // get the collection of this NestedResourceTypeSecondSkuResource + string nestedResourceTypeFirst = "nestedResourceTypeFirst"; + string nestedResourceTypeSecond = "nestedResourceTypeSecond"; + NestedResourceTypeSecondSkuCollection collection = resourceTypeRegistration.GetNestedResourceTypeSecondSkus(nestedResourceTypeFirst, nestedResourceTypeSecond); + + // invoke the operation + string sku = "testSku"; + NullableResponse response = await collection.GetIfExistsAsync(sku); + NestedResourceTypeSecondSkuResource 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 + ResourceTypeSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Skus_CreateOrUpdateNestedResourceTypeSecond [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeThirdSkuCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeThirdSkuCollection.cs index 93d8e52981f2..096c0bcffbfe 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeThirdSkuCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NestedResourceTypeThirdSkuCollection.cs @@ -90,6 +90,52 @@ public async Task Exists_SkusGetNestedResourceTypeThird() Console.WriteLine($"Succeeded: {result}"); } + // Skus_GetNestedResourceTypeThird + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SkusGetNestedResourceTypeThird() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/Skus_GetNestedResourceTypeThird.json + // this example is just showing the usage of "Skus_GetNestedResourceTypeThird" 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 ResourceTypeRegistrationResource created on azure + // for more information of creating ResourceTypeRegistrationResource, please refer to the document of ResourceTypeRegistrationResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + string providerNamespace = "Microsoft.Contoso"; + string resourceType = "testResourceType"; + ResourceIdentifier resourceTypeRegistrationResourceId = ResourceTypeRegistrationResource.CreateResourceIdentifier(subscriptionId, providerNamespace, resourceType); + ResourceTypeRegistrationResource resourceTypeRegistration = client.GetResourceTypeRegistrationResource(resourceTypeRegistrationResourceId); + + // get the collection of this NestedResourceTypeThirdSkuResource + string nestedResourceTypeFirst = "nestedResourceTypeFirst"; + string nestedResourceTypeSecond = "nestedResourceTypeSecond"; + string nestedResourceTypeThird = "nestedResourceTypeThird"; + NestedResourceTypeThirdSkuCollection collection = resourceTypeRegistration.GetNestedResourceTypeThirdSkus(nestedResourceTypeFirst, nestedResourceTypeSecond, nestedResourceTypeThird); + + // invoke the operation + string sku = "testSku"; + NullableResponse response = await collection.GetIfExistsAsync(sku); + NestedResourceTypeThirdSkuResource 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 + ResourceTypeSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Skus_CreateOrUpdateNestedResourceTypeThird [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NotificationRegistrationCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NotificationRegistrationCollection.cs index 4554440dd5d5..ac9822dbfb48 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NotificationRegistrationCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_NotificationRegistrationCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_NotificationRegistrationsGet() Console.WriteLine($"Succeeded: {result}"); } + // NotificationRegistrations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NotificationRegistrationsGet() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/NotificationRegistrations_Get.json + // this example is just showing the usage of "NotificationRegistrations_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 ProviderRegistrationResource created on azure + // for more information of creating ProviderRegistrationResource, please refer to the document of ProviderRegistrationResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + string providerNamespace = "Microsoft.Contoso"; + ResourceIdentifier providerRegistrationResourceId = ProviderRegistrationResource.CreateResourceIdentifier(subscriptionId, providerNamespace); + ProviderRegistrationResource providerRegistration = client.GetProviderRegistrationResource(providerRegistrationResourceId); + + // get the collection of this NotificationRegistrationResource + NotificationRegistrationCollection collection = providerRegistration.GetNotificationRegistrations(); + + // invoke the operation + string notificationRegistrationName = "fooNotificationRegistration"; + NullableResponse response = await collection.GetIfExistsAsync(notificationRegistrationName); + NotificationRegistrationResource 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 + NotificationRegistrationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NotificationRegistrations_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ProviderRegistrationCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ProviderRegistrationCollection.cs index 311744b95670..6a9baed5aa02 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ProviderRegistrationCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ProviderRegistrationCollection.cs @@ -81,6 +81,47 @@ public async Task Exists_ProviderRegistrationsGet() Console.WriteLine($"Succeeded: {result}"); } + // ProviderRegistrations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProviderRegistrationsGet() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/ProviderRegistrations_Get.json + // this example is just showing the usage of "ProviderRegistrations_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ProviderRegistrationResource + ProviderRegistrationCollection collection = subscriptionResource.GetProviderRegistrations(); + + // invoke the operation + string providerNamespace = "Microsoft.Contoso"; + NullableResponse response = await collection.GetIfExistsAsync(providerNamespace); + ProviderRegistrationResource 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 + ProviderRegistrationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ProviderRegistrations_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ResourceTypeRegistrationCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ResourceTypeRegistrationCollection.cs index 684b76dc9a2d..8407b9d181c8 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ResourceTypeRegistrationCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ResourceTypeRegistrationCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_ResourceTypeRegistrationsGet() Console.WriteLine($"Succeeded: {result}"); } + // ResourceTypeRegistrations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ResourceTypeRegistrationsGet() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/ResourceTypeRegistrations_Get.json + // this example is just showing the usage of "ResourceTypeRegistrations_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 ProviderRegistrationResource created on azure + // for more information of creating ProviderRegistrationResource, please refer to the document of ProviderRegistrationResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + string providerNamespace = "Microsoft.Contoso"; + ResourceIdentifier providerRegistrationResourceId = ProviderRegistrationResource.CreateResourceIdentifier(subscriptionId, providerNamespace); + ProviderRegistrationResource providerRegistration = client.GetProviderRegistrationResource(providerRegistrationResourceId); + + // get the collection of this ResourceTypeRegistrationResource + ResourceTypeRegistrationCollection collection = providerRegistration.GetResourceTypeRegistrations(); + + // invoke the operation + string resourceType = "employees"; + NullableResponse response = await collection.GetIfExistsAsync(resourceType); + ResourceTypeRegistrationResource 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 + ResourceTypeRegistrationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ResourceTypeRegistrations_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ResourceTypeSkuCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ResourceTypeSkuCollection.cs index 4bb133289831..bcbd6cfba80e 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ResourceTypeSkuCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/samples/Generated/Samples/Sample_ResourceTypeSkuCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_SkusGet() Console.WriteLine($"Succeeded: {result}"); } + // Skus_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SkusGet() + { + // Generated from example definition: specification/providerhub/resource-manager/Microsoft.ProviderHub/stable/2020-11-20/examples/Skus_Get.json + // this example is just showing the usage of "Skus_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 ResourceTypeRegistrationResource created on azure + // for more information of creating ResourceTypeRegistrationResource, please refer to the document of ResourceTypeRegistrationResource + string subscriptionId = "ab7a8701-f7ef-471a-a2f4-d0ebbf494f77"; + string providerNamespace = "Microsoft.Contoso"; + string resourceType = "testResourceType"; + ResourceIdentifier resourceTypeRegistrationResourceId = ResourceTypeRegistrationResource.CreateResourceIdentifier(subscriptionId, providerNamespace, resourceType); + ResourceTypeRegistrationResource resourceTypeRegistration = client.GetResourceTypeRegistrationResource(resourceTypeRegistrationResourceId); + + // get the collection of this ResourceTypeSkuResource + ResourceTypeSkuCollection collection = resourceTypeRegistration.GetResourceTypeSkus(); + + // invoke the operation + string sku = "testSku"; + NullableResponse response = await collection.GetIfExistsAsync(sku); + ResourceTypeSkuResource 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 + ResourceTypeSkuData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Skus_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/CustomRolloutCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/CustomRolloutCollection.cs index f96bf93038a4..64a6dbaa7cf2 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/CustomRolloutCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/CustomRolloutCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string rolloutName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/customRollouts/{rolloutName} + /// + /// + /// Operation Id + /// CustomRollouts_Get + /// + /// + /// + /// The rollout name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string rolloutName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rolloutName, nameof(rolloutName)); + + using var scope = _customRolloutClientDiagnostics.CreateScope("CustomRolloutCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _customRolloutRestClient.GetAsync(Id.SubscriptionId, Id.Name, rolloutName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomRolloutResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/customRollouts/{rolloutName} + /// + /// + /// Operation Id + /// CustomRollouts_Get + /// + /// + /// + /// The rollout name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string rolloutName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rolloutName, nameof(rolloutName)); + + using var scope = _customRolloutClientDiagnostics.CreateScope("CustomRolloutCollection.GetIfExists"); + scope.Start(); + try + { + var response = _customRolloutRestClient.Get(Id.SubscriptionId, Id.Name, rolloutName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomRolloutResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/DefaultRolloutCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/DefaultRolloutCollection.cs index 0c1a8ed8bdc3..371fd3a87d48 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/DefaultRolloutCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/DefaultRolloutCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string rolloutName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/defaultRollouts/{rolloutName} + /// + /// + /// Operation Id + /// DefaultRollouts_Get + /// + /// + /// + /// The rollout name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string rolloutName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rolloutName, nameof(rolloutName)); + + using var scope = _defaultRolloutClientDiagnostics.CreateScope("DefaultRolloutCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _defaultRolloutRestClient.GetAsync(Id.SubscriptionId, Id.Name, rolloutName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DefaultRolloutResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/defaultRollouts/{rolloutName} + /// + /// + /// Operation Id + /// DefaultRollouts_Get + /// + /// + /// + /// The rollout name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string rolloutName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(rolloutName, nameof(rolloutName)); + + using var scope = _defaultRolloutClientDiagnostics.CreateScope("DefaultRolloutCollection.GetIfExists"); + scope.Start(); + try + { + var response = _defaultRolloutRestClient.Get(Id.SubscriptionId, Id.Name, rolloutName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DefaultRolloutResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeFirstSkuCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeFirstSkuCollection.cs index e154c7048d97..36c4ae616286 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeFirstSkuCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeFirstSkuCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string sku, CancellationToken cancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku} + /// + /// + /// Operation Id + /// Skus_GetNestedResourceTypeFirst + /// + /// + /// + /// The SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sku, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sku, nameof(sku)); + + using var scope = _nestedResourceTypeFirstSkuSkusClientDiagnostics.CreateScope("NestedResourceTypeFirstSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _nestedResourceTypeFirstSkuSkusRestClient.GetNestedResourceTypeFirstAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, _nestedResourceTypeFirst, sku, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NestedResourceTypeFirstSkuResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku} + /// + /// + /// Operation Id + /// Skus_GetNestedResourceTypeFirst + /// + /// + /// + /// The SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sku, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sku, nameof(sku)); + + using var scope = _nestedResourceTypeFirstSkuSkusClientDiagnostics.CreateScope("NestedResourceTypeFirstSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _nestedResourceTypeFirstSkuSkusRestClient.GetNestedResourceTypeFirst(Id.SubscriptionId, Id.Parent.Name, Id.Name, _nestedResourceTypeFirst, sku, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NestedResourceTypeFirstSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeSecondSkuCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeSecondSkuCollection.cs index 3a3ad02d5e7c..43c6182a788f 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeSecondSkuCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeSecondSkuCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string sku, CancellationToken cancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/resourcetypeRegistrations/{nestedResourceTypeSecond}/skus/{sku} + /// + /// + /// Operation Id + /// Skus_GetNestedResourceTypeSecond + /// + /// + /// + /// The SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sku, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sku, nameof(sku)); + + using var scope = _nestedResourceTypeSecondSkuSkusClientDiagnostics.CreateScope("NestedResourceTypeSecondSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _nestedResourceTypeSecondSkuSkusRestClient.GetNestedResourceTypeSecondAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, _nestedResourceTypeFirst, _nestedResourceTypeSecond, sku, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NestedResourceTypeSecondSkuResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/resourcetypeRegistrations/{nestedResourceTypeSecond}/skus/{sku} + /// + /// + /// Operation Id + /// Skus_GetNestedResourceTypeSecond + /// + /// + /// + /// The SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sku, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sku, nameof(sku)); + + using var scope = _nestedResourceTypeSecondSkuSkusClientDiagnostics.CreateScope("NestedResourceTypeSecondSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _nestedResourceTypeSecondSkuSkusRestClient.GetNestedResourceTypeSecond(Id.SubscriptionId, Id.Parent.Name, Id.Name, _nestedResourceTypeFirst, _nestedResourceTypeSecond, sku, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NestedResourceTypeSecondSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeThirdSkuCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeThirdSkuCollection.cs index bfa807654d93..b8dc96ed66b8 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeThirdSkuCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeThirdSkuCollection.cs @@ -334,6 +334,80 @@ public virtual Response Exists(string sku, CancellationToken cancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/resourcetypeRegistrations/{nestedResourceTypeSecond}/resourcetypeRegistrations/{nestedResourceTypeThird}/skus/{sku} + /// + /// + /// Operation Id + /// Skus_GetNestedResourceTypeThird + /// + /// + /// + /// The SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sku, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sku, nameof(sku)); + + using var scope = _nestedResourceTypeThirdSkuSkusClientDiagnostics.CreateScope("NestedResourceTypeThirdSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _nestedResourceTypeThirdSkuSkusRestClient.GetNestedResourceTypeThirdAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, _nestedResourceTypeFirst, _nestedResourceTypeSecond, _nestedResourceTypeThird, sku, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NestedResourceTypeThirdSkuResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/resourcetypeRegistrations/{nestedResourceTypeSecond}/resourcetypeRegistrations/{nestedResourceTypeThird}/skus/{sku} + /// + /// + /// Operation Id + /// Skus_GetNestedResourceTypeThird + /// + /// + /// + /// The SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sku, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sku, nameof(sku)); + + using var scope = _nestedResourceTypeThirdSkuSkusClientDiagnostics.CreateScope("NestedResourceTypeThirdSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _nestedResourceTypeThirdSkuSkusRestClient.GetNestedResourceTypeThird(Id.SubscriptionId, Id.Parent.Name, Id.Name, _nestedResourceTypeFirst, _nestedResourceTypeSecond, _nestedResourceTypeThird, sku, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NestedResourceTypeThirdSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NotificationRegistrationCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NotificationRegistrationCollection.cs index c4cc4f6bfe44..d25081e9f47a 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NotificationRegistrationCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NotificationRegistrationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string notificationRegistrationName, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/notificationRegistrations/{notificationRegistrationName} + /// + /// + /// Operation Id + /// NotificationRegistrations_Get + /// + /// + /// + /// The notification registration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string notificationRegistrationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(notificationRegistrationName, nameof(notificationRegistrationName)); + + using var scope = _notificationRegistrationClientDiagnostics.CreateScope("NotificationRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _notificationRegistrationRestClient.GetAsync(Id.SubscriptionId, Id.Name, notificationRegistrationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationRegistrationResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/notificationRegistrations/{notificationRegistrationName} + /// + /// + /// Operation Id + /// NotificationRegistrations_Get + /// + /// + /// + /// The notification registration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string notificationRegistrationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(notificationRegistrationName, nameof(notificationRegistrationName)); + + using var scope = _notificationRegistrationClientDiagnostics.CreateScope("NotificationRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _notificationRegistrationRestClient.Get(Id.SubscriptionId, Id.Name, notificationRegistrationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NotificationRegistrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationCollection.cs index 6d0d1f578a29..6d090261b1f9 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string providerNamespace, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace} + /// + /// + /// Operation Id + /// ProviderRegistrations_Get + /// + /// + /// + /// The name of the resource provider hosted within ProviderHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string providerNamespace, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerNamespace, nameof(providerNamespace)); + + using var scope = _providerRegistrationClientDiagnostics.CreateScope("ProviderRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _providerRegistrationRestClient.GetAsync(Id.SubscriptionId, providerNamespace, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProviderRegistrationResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace} + /// + /// + /// Operation Id + /// ProviderRegistrations_Get + /// + /// + /// + /// The name of the resource provider hosted within ProviderHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string providerNamespace, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerNamespace, nameof(providerNamespace)); + + using var scope = _providerRegistrationClientDiagnostics.CreateScope("ProviderRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _providerRegistrationRestClient.Get(Id.SubscriptionId, providerNamespace, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProviderRegistrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationCollection.cs index 83d92b71eba3..4d7aecb737eb 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string resourceType, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType} + /// + /// + /// Operation Id + /// ResourceTypeRegistrations_Get + /// + /// + /// + /// The resource type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + + using var scope = _resourceTypeRegistrationClientDiagnostics.CreateScope("ResourceTypeRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceTypeRegistrationRestClient.GetAsync(Id.SubscriptionId, Id.Name, resourceType, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceTypeRegistrationResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType} + /// + /// + /// Operation Id + /// ResourceTypeRegistrations_Get + /// + /// + /// + /// The resource type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + + using var scope = _resourceTypeRegistrationClientDiagnostics.CreateScope("ResourceTypeRegistrationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceTypeRegistrationRestClient.Get(Id.SubscriptionId, Id.Name, resourceType, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceTypeRegistrationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeSkuCollection.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeSkuCollection.cs index a8108402c27f..db20f7d7f6a5 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeSkuCollection.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeSkuCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string sku, CancellationToken cancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku} + /// + /// + /// Operation Id + /// Skus_Get + /// + /// + /// + /// The SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sku, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sku, nameof(sku)); + + using var scope = _resourceTypeSkuSkusClientDiagnostics.CreateScope("ResourceTypeSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceTypeSkuSkusRestClient.GetAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, sku, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceTypeSkuResource(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}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku} + /// + /// + /// Operation Id + /// Skus_Get + /// + /// + /// + /// The SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sku, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sku, nameof(sku)); + + using var scope = _resourceTypeSkuSkusClientDiagnostics.CreateScope("ResourceTypeSkuCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceTypeSkuSkusRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, sku, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceTypeSkuResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewAccountCollection.cs b/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewAccountCollection.cs index b57c788c1a68..947b675ff667 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewAccountCollection.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewAccountCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_AccountsGet() Console.WriteLine($"Succeeded: {result}"); } + // Accounts_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AccountsGet() + { + // Generated from example definition: specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/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 = "12345678-1234-1234-12345678abc"; + string resourceGroupName = "SampleResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PurviewAccountResource + PurviewAccountCollection collection = resourceGroupResource.GetPurviewAccounts(); + + // invoke the operation + string accountName = "account1"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + PurviewAccountResource 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 + PurviewAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Accounts_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewPrivateEndpointConnectionCollection.cs b/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewPrivateEndpointConnectionCollection.cs index 17adb684176f..6cafb4e5c85d 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewPrivateEndpointConnectionCollection.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PrivateEndpointConnectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/PrivateEndpointConnections_Get.json + // this example is just showing the usage of "PrivateEndpointConnections_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 PurviewAccountResource created on azure + // for more information of creating PurviewAccountResource, please refer to the document of PurviewAccountResource + string subscriptionId = "12345678-1234-1234-12345678abc"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "account1"; + ResourceIdentifier purviewAccountResourceId = PurviewAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + PurviewAccountResource purviewAccount = client.GetPurviewAccountResource(purviewAccountResourceId); + + // get the collection of this PurviewPrivateEndpointConnectionResource + PurviewPrivateEndpointConnectionCollection collection = purviewAccount.GetPurviewPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnection1"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + PurviewPrivateEndpointConnectionResource 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 + PurviewPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnections_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewPrivateLinkResourceCollection.cs b/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewPrivateLinkResourceCollection.cs index b613ec71e9a5..b441521b4c8e 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewPrivateLinkResourceCollection.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/samples/Generated/Samples/Sample_PurviewPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_PrivateLinkResourcesGetByGroupId() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateLinkResources_GetByGroupId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateLinkResourcesGetByGroupId() + { + // Generated from example definition: specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/PrivateLinkResources_GetByGroupId.json + // this example is just showing the usage of "PrivateLinkResources_GetByGroupId" 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 PurviewAccountResource created on azure + // for more information of creating PurviewAccountResource, please refer to the document of PurviewAccountResource + string subscriptionId = "12345678-1234-1234-12345678abc"; + string resourceGroupName = "SampleResourceGroup"; + string accountName = "account1"; + ResourceIdentifier purviewAccountResourceId = PurviewAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + PurviewAccountResource purviewAccount = client.GetPurviewAccountResource(purviewAccountResourceId); + + // get the collection of this PurviewPrivateLinkResource + PurviewPrivateLinkResourceCollection collection = purviewAccount.GetPurviewPrivateLinkResources(); + + // invoke the operation + string groupId = "group1"; + NullableResponse response = await collection.GetIfExistsAsync(groupId); + PurviewPrivateLinkResource 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 + PurviewPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountCollection.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountCollection.cs index d444c2bd0ba8..a85d134dbb88 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountCollection.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _purviewAccountAccountsClientDiagnostics.CreateScope("PurviewAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _purviewAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PurviewAccountResource(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.Purview/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _purviewAccountAccountsClientDiagnostics.CreateScope("PurviewAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _purviewAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PurviewAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateEndpointConnectionCollection.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateEndpointConnectionCollection.cs index d8e3bf57d008..5a44a16fcd49 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateEndpointConnectionCollection.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateEndpointConnectionCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _purviewPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("PurviewPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _purviewPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PurviewPrivateEndpointConnectionResource(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.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// Name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _purviewPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("PurviewPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _purviewPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PurviewPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateLinkResourceCollection.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateLinkResourceCollection.cs index d97524a6ec77..16fd0699e313 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateLinkResourceCollection.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string groupId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// PrivateLinkResources_GetByGroupId + /// + /// + /// + /// The group identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _purviewPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("PurviewPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _purviewPrivateLinkResourcePrivateLinkResourcesRestClient.GetByGroupIdAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PurviewPrivateLinkResource(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.Purview/accounts/{accountName}/privateLinkResources/{groupId} + /// + /// + /// Operation Id + /// PrivateLinkResources_GetByGroupId + /// + /// + /// + /// The group identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _purviewPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("PurviewPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _purviewPrivateLinkResourcePrivateLinkResourcesRestClient.GetByGroupId(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PurviewPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); From 7b020efaf0de7a2c899b0da682e67b6758d5d3cd Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 21 Sep 2023 08:47:50 +0000 Subject: [PATCH 7/8] Update SDK codes --- .../Sample_QuantumWorkspaceCollection.cs | 42 ++++ .../Generated/QuantumWorkspaceCollection.cs | 74 ++++++ ...mple_QumuloFileSystemResourceCollection.cs | 84 +++++++ .../QumuloFileSystemResourceCollection.cs | 74 ++++++ .../Sample_CurrentQuotaLimitBaseCollection.cs | 80 +++++++ .../Sample_CurrentUsagesBaseCollection.cs | 81 +++++++ .../Sample_QuotaRequestDetailCollection.cs | 121 ++++++++++ .../CurrentQuotaLimitBaseCollection.cs | 84 +++++++ .../Generated/CurrentUsagesBaseCollection.cs | 84 +++++++ .../Generated/QuotaRequestDetailCollection.cs | 74 ++++++ .../Samples/Sample_BackupEngineCollection.cs | 44 ++++ .../Samples/Sample_BackupJobCollection.cs | 44 ++++ ...ckupPrivateEndpointConnectionCollection.cs | 43 ++++ .../Sample_BackupProtectedItemCollection.cs | 90 ++++++++ ...ple_BackupProtectionContainerCollection.cs | 44 ++++ ...Sample_BackupProtectionIntentCollection.cs | 44 ++++ ...Sample_BackupProtectionPolicyCollection.cs | 86 +++++++ .../Sample_BackupRecoveryPointCollection.cs | 47 ++++ .../Sample_BackupResourceConfigCollection.cs | 42 ++++ ...ourceEncryptionConfigExtendedCollection.cs | 42 ++++ ...ple_BackupResourceVaultConfigCollection.cs | 42 ++++ .../Sample_ResourceGuardProxyCollection.cs | 43 ++++ .../src/Generated/BackupEngineCollection.cs | 78 +++++++ .../src/Generated/BackupJobCollection.cs | 74 ++++++ ...ckupPrivateEndpointConnectionCollection.cs | 78 +++++++ .../BackupProtectedItemCollection.cs | 76 ++++++ .../BackupProtectionContainerCollection.cs | 82 +++++++ .../BackupProtectionIntentCollection.cs | 82 +++++++ .../BackupProtectionPolicyCollection.cs | 74 ++++++ .../BackupRecoveryPointCollection.cs | 74 ++++++ .../BackupResourceConfigCollection.cs | 74 ++++++ ...ourceEncryptionConfigExtendedCollection.cs | 74 ++++++ .../BackupResourceVaultConfigCollection.cs | 74 ++++++ .../Generated/ResourceGuardProxyCollection.cs | 74 ++++++ .../Sample_DataReplicationDraCollection.cs | 43 ++++ ...ReplicationEmailConfigurationCollection.cs | 43 ++++ .../Sample_DataReplicationEventCollection.cs | 44 ++++ .../Sample_DataReplicationFabricCollection.cs | 42 ++++ .../Sample_DataReplicationPolicyCollection.cs | 43 ++++ ..._DataReplicationProtectedItemCollection.cs | 43 ++++ ..._DataReplicationRecoveryPointCollection.cs | 45 ++++ ...plicationReplicationExtensionCollection.cs | 43 ++++ .../Sample_DataReplicationVaultCollection.cs | 42 ++++ ...ample_DataReplicationWorkflowCollection.cs | 44 ++++ .../Generated/DataReplicationDraCollection.cs | 74 ++++++ ...ReplicationEmailConfigurationCollection.cs | 74 ++++++ .../DataReplicationEventCollection.cs | 74 ++++++ .../DataReplicationFabricCollection.cs | 74 ++++++ .../DataReplicationPolicyCollection.cs | 74 ++++++ .../DataReplicationProtectedItemCollection.cs | 74 ++++++ .../DataReplicationRecoveryPointCollection.cs | 74 ++++++ ...plicationReplicationExtensionCollection.cs | 74 ++++++ .../DataReplicationVaultCollection.cs | 74 ++++++ .../DataReplicationWorkflowCollection.cs | 74 ++++++ ...Sample_MigrationRecoveryPointCollection.cs | 47 ++++ ...le_ProtectionContainerMappingCollection.cs | 46 ++++ ..._ReplicationEligibilityResultCollection.cs | 43 ++++ ...mple_ReplicationProtectedItemCollection.cs | 45 ++++ ...e_ReplicationProtectionIntentCollection.cs | 43 ++++ .../Sample_SiteRecoveryAlertCollection.cs | 43 ++++ .../Sample_SiteRecoveryEventCollection.cs | 44 ++++ .../Sample_SiteRecoveryFabricCollection.cs | 44 ++++ .../Sample_SiteRecoveryJobCollection.cs | 44 ++++ ...le_SiteRecoveryLogicalNetworkCollection.cs | 45 ++++ ...ple_SiteRecoveryMigrationItemCollection.cs | 45 ++++ .../Sample_SiteRecoveryNetworkCollection.cs | 45 ++++ ...le_SiteRecoveryNetworkMappingCollection.cs | 45 ++++ .../Sample_SiteRecoveryPointCollection.cs | 47 ++++ .../Sample_SiteRecoveryPolicyCollection.cs | 43 ++++ ...e_SiteRecoveryProtectableItemCollection.cs | 46 ++++ ...teRecoveryProtectionContainerCollection.cs | 45 ++++ ...mple_SiteRecoveryRecoveryPlanCollection.cs | 43 ++++ ..._SiteRecoveryServicesProviderCollection.cs | 44 ++++ .../Sample_SiteRecoveryVCenterCollection.cs | 44 ++++ ...mple_SiteRecoveryVaultSettingCollection.cs | 43 ++++ .../Sample_StorageClassificationCollection.cs | 45 ++++ ..._StorageClassificationMappingCollection.cs | 45 ++++ .../MigrationRecoveryPointCollection.cs | 74 ++++++ .../ProtectionContainerMappingCollection.cs | 74 ++++++ .../ReplicationEligibilityResultCollection.cs | 64 ++++++ .../ReplicationProtectedItemCollection.cs | 74 ++++++ .../ReplicationProtectionIntentCollection.cs | 74 ++++++ .../Generated/SiteRecoveryAlertCollection.cs | 74 ++++++ .../Generated/SiteRecoveryEventCollection.cs | 74 ++++++ .../Generated/SiteRecoveryFabricCollection.cs | 76 ++++++ .../Generated/SiteRecoveryJobCollection.cs | 74 ++++++ .../SiteRecoveryLogicalNetworkCollection.cs | 74 ++++++ .../SiteRecoveryMigrationItemCollection.cs | 74 ++++++ .../SiteRecoveryNetworkCollection.cs | 74 ++++++ .../SiteRecoveryNetworkMappingCollection.cs | 74 ++++++ .../Generated/SiteRecoveryPointCollection.cs | 74 ++++++ .../Generated/SiteRecoveryPolicyCollection.cs | 74 ++++++ .../SiteRecoveryProtectableItemCollection.cs | 74 ++++++ ...teRecoveryProtectionContainerCollection.cs | 74 ++++++ .../SiteRecoveryRecoveryPlanCollection.cs | 74 ++++++ .../SiteRecoveryServicesProviderCollection.cs | 74 ++++++ .../SiteRecoveryVCenterCollection.cs | 74 ++++++ .../SiteRecoveryVaultSettingCollection.cs | 74 ++++++ .../StorageClassificationCollection.cs | 74 ++++++ .../StorageClassificationMappingCollection.cs | 74 ++++++ ...ryServicesPrivateLinkResourceCollection.cs | 44 ++++ .../Sample_RecoveryServicesVaultCollection.cs | 42 ++++ ...ryServicesPrivateLinkResourceCollection.cs | 74 ++++++ .../RecoveryServicesVaultCollection.cs | 74 ++++++ .../Samples/Sample_RedisCollection.cs | 42 ++++ .../Sample_RedisFirewallRuleCollection.cs | 43 ++++ ...RedisLinkedServerWithPropertyCollection.cs | 43 ++++ .../Sample_RedisPatchScheduleCollection.cs | 43 ++++ ...edisPrivateEndpointConnectionCollection.cs | 43 ++++ .../src/Generated/RedisCollection.cs | 74 ++++++ .../Generated/RedisFirewallRuleCollection.cs | 74 ++++++ ...RedisLinkedServerWithPropertyCollection.cs | 74 ++++++ .../Generated/RedisPatchScheduleCollection.cs | 66 ++++++ ...edisPrivateEndpointConnectionCollection.cs | 74 ++++++ ...Sample_RedisEnterpriseClusterCollection.cs | 42 ++++ ...ample_RedisEnterpriseDatabaseCollection.cs | 43 ++++ ...risePrivateEndpointConnectionCollection.cs | 43 ++++ .../RedisEnterpriseClusterCollection.cs | 74 ++++++ .../RedisEnterpriseDatabaseCollection.cs | 74 ++++++ ...risePrivateEndpointConnectionCollection.cs | 74 ++++++ ...idConnectionAuthorizationRuleCollection.cs | 44 ++++ .../Sample_RelayHybridConnectionCollection.cs | 43 ++++ ...layNamespaceAuthorizationRuleCollection.cs | 43 ++++ .../Sample_RelayNamespaceCollection.cs | 42 ++++ ...elayPrivateEndpointConnectionCollection.cs | 43 ++++ ...mple_RelayPrivateLinkResourceCollection.cs | 44 ++++ ...ple_WcfRelayAuthorizationRuleCollection.cs | 44 ++++ .../Samples/Sample_WcfRelayCollection.cs | 43 ++++ ...idConnectionAuthorizationRuleCollection.cs | 74 ++++++ .../RelayHybridConnectionCollection.cs | 74 ++++++ ...layNamespaceAuthorizationRuleCollection.cs | 74 ++++++ .../src/Generated/RelayNamespaceCollection.cs | 74 ++++++ ...elayPrivateEndpointConnectionCollection.cs | 74 ++++++ .../RelayPrivateLinkResourceCollection.cs | 74 ++++++ .../WcfRelayAuthorizationRuleCollection.cs | 74 ++++++ .../src/Generated/WcfRelayCollection.cs | 74 ++++++ .../Sample_QuotaRequestDetailCollection.cs | 130 +++++++++++ .../Sample_ReservationDetailCollection.cs | 43 ++++ .../Sample_ReservationOrderCollection.cs | 79 +++++++ .../Sample_ReservationQuotaCollection.cs | 43 ++++ .../Generated/QuotaRequestDetailCollection.cs | 66 ++++++ .../Generated/ReservationDetailCollection.cs | 68 ++++++ .../Generated/ReservationOrderCollection.cs | 68 ++++++ .../Generated/ReservationQuotaCollection.cs | 74 ++++++ ...le_ResourceConnectorApplianceCollection.cs | 42 ++++ .../ResourceConnectorApplianceCollection.cs | 74 ++++++ .../Sample_ResourceHealthEventCollection.cs | 44 ++++ ...ceHealthEventImpactedResourceCollection.cs | 43 ++++ ..._ResourceHealthMetadataEntityCollection.cs | 40 ++++ .../Sample_ServiceEmergingIssueCollection.cs | 40 ++++ ...ple_TenantResourceHealthEventCollection.cs | 42 ++++ ...ceHealthEventImpactedResourceCollection.cs | 42 ++++ .../ResourceHealthEventCollection.cs | 78 +++++++ ...ceHealthEventImpactedResourceCollection.cs | 74 ++++++ .../ResourceHealthMetadataEntityCollection.cs | 74 ++++++ .../ServiceEmergingIssueCollection.cs | 66 ++++++ .../TenantResourceHealthEventCollection.cs | 78 +++++++ ...ceHealthEventImpactedResourceCollection.cs | 74 ++++++ .../Sample_DataPolicyManifestCollection.cs | 40 ++++ .../Samples/Sample_FeatureCollection.cs | 43 ++++ .../Sample_ManagementGroupCollection.cs | 205 +++++++++++++++++ ...nagementGroupPolicyDefinitionCollection.cs | 41 ++++ ...ementGroupPolicySetDefinitionCollection.cs | 41 ++++ .../Sample_ManagementLockCollection.cs | 40 ++++ .../Sample_PolicyAssignmentCollection.cs | 200 ++++++++++++++++ .../Sample_ResourceProviderCollection.cs | 42 ++++ .../Samples/Sample_SubscriptionCollection.cs | 40 ++++ ..._SubscriptionPolicyDefinitionCollection.cs | 41 ++++ ...bscriptionPolicySetDefinitionCollection.cs | 41 ++++ ...Sample_TenantPolicyDefinitionCollection.cs | 40 ++++ ...ple_TenantPolicySetDefinitionCollection.cs | 40 ++++ .../Generated/ManagementGroupCollection.cs | 82 +++++++ .../Generated/DataPolicyManifestCollection.cs | 74 ++++++ .../Resources/Generated/FeatureCollection.cs | 74 ++++++ ...nagementGroupPolicyDefinitionCollection.cs | 74 ++++++ ...ementGroupPolicySetDefinitionCollection.cs | 74 ++++++ .../Generated/ManagementLockCollection.cs | 74 ++++++ .../Generated/PolicyAssignmentCollection.cs | 74 ++++++ .../Generated/ResourceGroupCollection.cs | 74 ++++++ .../Generated/ResourceProviderCollection.cs | 76 ++++++ .../Generated/SubscriptionCollection.cs | 74 ++++++ .../SubscriptionPolicyDefinitionCollection.cs | 74 ++++++ ...bscriptionPolicySetDefinitionCollection.cs | 74 ++++++ .../Resources/Generated/TenantCollection.cs | 64 ++++++ .../TenantPolicyDefinitionCollection.cs | 74 ++++++ .../TenantPolicySetDefinitionCollection.cs | 74 ++++++ .../Samples/Sample_MoverResourceCollection.cs | 43 ++++ .../Sample_MoverResourceSetCollection.cs | 42 ++++ .../src/Generated/MoverResourceCollection.cs | 74 ++++++ .../Generated/MoverResourceSetCollection.cs | 74 ++++++ .../Sample_ArmApplicationCollection.cs | 42 ++++ ...mple_ArmApplicationDefinitionCollection.cs | 42 ++++ .../Sample_ArmDeploymentScriptCollection.cs | 42 ++++ .../Samples/Sample_TemplateSpecCollection.cs | 42 ++++ .../Sample_TemplateSpecVersionCollection.cs | 43 ++++ .../src/Generated/ArmApplicationCollection.cs | 74 ++++++ .../ArmApplicationDefinitionCollection.cs | 74 ++++++ .../src/Generated/ArmDeploymentCollection.cs | 74 ++++++ .../ArmDeploymentScriptCollection.cs | 74 ++++++ .../src/Generated/JitRequestCollection.cs | 74 ++++++ .../src/Generated/TemplateSpecCollection.cs | 76 ++++++ .../TemplateSpecVersionCollection.cs | 74 ++++++ ...archPrivateEndpointConnectionCollection.cs | 43 ++++ .../Samples/Sample_SearchServiceCollection.cs | 42 ++++ ...rchServicePrivateLinkResourceCollection.cs | 43 ++++ ...archPrivateEndpointConnectionCollection.cs | 76 ++++++ .../src/Generated/SearchServiceCollection.cs | 76 ++++++ ...rchServicePrivateLinkResourceCollection.cs | 76 ++++++ ...aptiveApplicationControlGroupCollection.cs | 42 ++++ ...mple_AdaptiveNetworkHardeningCollection.cs | 46 ++++ ...ample_AutoProvisioningSettingCollection.cs | 41 ++++ .../Sample_ComplianceResultCollection.cs | 41 ++++ ...le_CustomAssessmentAutomationCollection.cs | 42 ++++ ...e_CustomEntityStoreAssignmentCollection.cs | 42 ++++ .../Sample_DeviceSecurityGroupCollection.cs | 40 ++++ .../Sample_GovernanceAssignmentCollection.cs | 42 ++++ .../Sample_GovernanceRuleCollection.cs | 120 ++++++++++ .../Sample_IngestionSettingCollection.cs | 41 ++++ ...le_IotSecurityAggregatedAlertCollection.cs | 44 ++++ ...urityAggregatedRecommendationCollection.cs | 44 ++++ .../Sample_IotSecuritySolutionCollection.cs | 42 ++++ ...Sample_JitNetworkAccessPolicyCollection.cs | 43 ++++ ...egulatoryComplianceAssessmentCollection.cs | 44 ++++ ...e_RegulatoryComplianceControlCollection.cs | 43 ++++ ..._RegulatoryComplianceStandardCollection.cs | 42 ++++ ...le_ResourceGroupSecurityAlertCollection.cs | 44 ++++ ...ple_ResourceGroupSecurityTaskCollection.cs | 44 ++++ .../Samples/Sample_SecureScoreCollection.cs | 42 ++++ ...SecurityAlertsSuppressionRuleCollection.cs | 41 ++++ .../Sample_SecurityAssessmentCollection.cs | 81 +++++++ .../Sample_SecurityAutomationCollection.cs | 42 ++++ ...Sample_SecurityCenterLocationCollection.cs | 42 ++++ .../Sample_SecurityCenterPricingCollection.cs | 205 +++++++++++++++++ ...Sample_SecurityCloudConnectorCollection.cs | 41 ++++ .../Sample_SecurityComplianceCollection.cs | 41 ++++ ..._SecurityConnectorApplicationCollection.cs | 43 ++++ .../Sample_SecurityConnectorCollection.cs | 42 ++++ .../Sample_SecurityContactCollection.cs | 41 ++++ .../Sample_SecuritySettingCollection.cs | 41 ++++ .../Sample_SecuritySubAssessmentCollection.cs | 43 ++++ ...mple_SecurityWorkspaceSettingCollection.cs | 41 ++++ ...ServerVulnerabilityAssessmentCollection.cs | 44 ++++ .../Sample_SoftwareInventoryCollection.cs | 46 ++++ ...abilityAssessmentBaselineRuleCollection.cs | 41 ++++ ...qlVulnerabilityAssessmentScanCollection.cs | 83 +++++++ ...ubscriptionAssessmentMetadataCollection.cs | 41 ++++ ...ple_SubscriptionSecurityAlertCollection.cs | 42 ++++ ...bscriptionSecurityApplicationCollection.cs | 41 ++++ ...mple_SubscriptionSecurityTaskCollection.cs | 43 ++++ ...mple_TenantAssessmentMetadataCollection.cs | 40 ++++ ...aptiveApplicationControlGroupCollection.cs | 74 ++++++ .../AdaptiveNetworkHardeningCollection.cs | 74 ++++++ .../AutoProvisioningSettingCollection.cs | 74 ++++++ .../Generated/ComplianceResultCollection.cs | 74 ++++++ .../CustomAssessmentAutomationCollection.cs | 74 ++++++ .../CustomEntityStoreAssignmentCollection.cs | 74 ++++++ .../DeviceSecurityGroupCollection.cs | 74 ++++++ .../GovernanceAssignmentCollection.cs | 74 ++++++ .../src/Generated/GovernanceRuleCollection.cs | 74 ++++++ .../Generated/IngestionSettingCollection.cs | 74 ++++++ .../IotSecurityAggregatedAlertCollection.cs | 74 ++++++ ...urityAggregatedRecommendationCollection.cs | 74 ++++++ .../IotSecuritySolutionCollection.cs | 74 ++++++ .../JitNetworkAccessPolicyCollection.cs | 74 ++++++ ...egulatoryComplianceAssessmentCollection.cs | 74 ++++++ .../RegulatoryComplianceControlCollection.cs | 74 ++++++ .../RegulatoryComplianceStandardCollection.cs | 74 ++++++ .../ResourceGroupSecurityAlertCollection.cs | 74 ++++++ .../ResourceGroupSecurityTaskCollection.cs | 74 ++++++ .../src/Generated/SecureScoreCollection.cs | 74 ++++++ ...SecurityAlertsSuppressionRuleCollection.cs | 74 ++++++ .../Generated/SecurityAssessmentCollection.cs | 76 ++++++ .../Generated/SecurityAutomationCollection.cs | 74 ++++++ .../SecurityCenterLocationCollection.cs | 66 ++++++ .../SecurityCenterPricingCollection.cs | 74 ++++++ .../SecurityCloudConnectorCollection.cs | 74 ++++++ .../Generated/SecurityComplianceCollection.cs | 74 ++++++ .../SecurityConnectorApplicationCollection.cs | 74 ++++++ .../Generated/SecurityConnectorCollection.cs | 74 ++++++ .../Generated/SecurityContactCollection.cs | 74 ++++++ .../Generated/SecuritySettingCollection.cs | 66 ++++++ .../SecuritySubAssessmentCollection.cs | 74 ++++++ .../SecurityWorkspaceSettingCollection.cs | 74 ++++++ ...ServerVulnerabilityAssessmentCollection.cs | 64 ++++++ .../Generated/SoftwareInventoryCollection.cs | 74 ++++++ ...abilityAssessmentBaselineRuleCollection.cs | 76 ++++++ ...qlVulnerabilityAssessmentScanCollection.cs | 76 ++++++ ...ubscriptionAssessmentMetadataCollection.cs | 74 ++++++ .../SubscriptionSecurityAlertCollection.cs | 74 ++++++ ...bscriptionSecurityApplicationCollection.cs | 74 ++++++ .../SubscriptionSecurityTaskCollection.cs | 74 ++++++ .../TenantAssessmentMetadataCollection.cs | 74 ++++++ .../Sample_AzureDevOpsConnectorCollection.cs | 42 ++++ .../Sample_AzureDevOpsOrgCollection.cs | 43 ++++ .../Sample_AzureDevOpsProjectCollection.cs | 44 ++++ .../Sample_AzureDevOpsRepoCollection.cs | 45 ++++ .../Sample_GitHubConnectorCollection.cs | 42 ++++ .../Samples/Sample_GitHubOwnerCollection.cs | 43 ++++ .../Samples/Sample_GitHubRepoCollection.cs | 44 ++++ .../AzureDevOpsConnectorCollection.cs | 74 ++++++ .../src/Generated/AzureDevOpsOrgCollection.cs | 74 ++++++ .../Generated/AzureDevOpsProjectCollection.cs | 74 ++++++ .../Generated/AzureDevOpsRepoCollection.cs | 74 ++++++ .../Generated/GitHubConnectorCollection.cs | 74 ++++++ .../src/Generated/GitHubOwnerCollection.cs | 74 ++++++ .../src/Generated/GitHubRepoCollection.cs | 74 ++++++ ...curityInsightsAlertRuleActionCollection.cs | 74 ++++++ .../SecurityInsightsAlertRuleCollection.cs | 74 ++++++ ...rityInsightsAlertRuleTemplateCollection.cs | 74 ++++++ ...ecurityInsightsAutomationRuleCollection.cs | 74 ++++++ .../SecurityInsightsBookmarkCollection.cs | 74 ++++++ ...SecurityInsightsDataConnectorCollection.cs | 74 ++++++ .../SecurityInsightsIncidentCollection.cs | 74 ++++++ ...curityInsightsIncidentCommentCollection.cs | 74 ++++++ ...urityInsightsIncidentRelationCollection.cs | 74 ++++++ ...sightsSentinelOnboardingStateCollection.cs | 74 ++++++ ...tsThreatIntelligenceIndicatorCollection.cs | 74 ++++++ .../SecurityInsightsWatchlistCollection.cs | 74 ++++++ ...SecurityInsightsWatchlistItemCollection.cs | 74 ++++++ .../SecurityMLAnalyticsSettingCollection.cs | 74 ++++++ .../Sample_SelfHelpDiagnosticCollection.cs | 40 ++++ .../Generated/SelfHelpDiagnosticCollection.cs | 74 ++++++ ...Sample_MigrationConfigurationCollection.cs | 43 ++++ ...sterRecoveryAuthorizationRuleCollection.cs | 45 ++++ ...le_ServiceBusDisasterRecoveryCollection.cs | 43 ++++ ...BusNamespaceAuthorizationRuleCollection.cs | 43 ++++ .../Sample_ServiceBusNamespaceCollection.cs | 42 ++++ ...eBusPrivateEndpointConnectionCollection.cs | 43 ++++ ...viceBusQueueAuthorizationRuleCollection.cs | 44 ++++ .../Sample_ServiceBusQueueCollection.cs | 43 ++++ .../Sample_ServiceBusRuleCollection.cs | 45 ++++ ...Sample_ServiceBusSubscriptionCollection.cs | 44 ++++ ...viceBusTopicAuthorizationRuleCollection.cs | 44 ++++ .../Sample_ServiceBusTopicCollection.cs | 43 ++++ .../MigrationConfigurationCollection.cs | 66 ++++++ ...sterRecoveryAuthorizationRuleCollection.cs | 74 ++++++ .../ServiceBusDisasterRecoveryCollection.cs | 74 ++++++ ...BusNamespaceAuthorizationRuleCollection.cs | 74 ++++++ .../ServiceBusNamespaceCollection.cs | 74 ++++++ ...eBusPrivateEndpointConnectionCollection.cs | 74 ++++++ ...viceBusQueueAuthorizationRuleCollection.cs | 74 ++++++ .../Generated/ServiceBusQueueCollection.cs | 74 ++++++ .../src/Generated/ServiceBusRuleCollection.cs | 74 ++++++ .../ServiceBusSubscriptionCollection.cs | 74 ++++++ ...viceBusTopicAuthorizationRuleCollection.cs | 74 ++++++ .../Generated/ServiceBusTopicCollection.cs | 74 ++++++ ...mple_ServiceFabricApplicationCollection.cs | 43 ++++ ..._ServiceFabricApplicationTypeCollection.cs | 43 ++++ ...eFabricApplicationTypeVersionCollection.cs | 44 ++++ .../Sample_ServiceFabricClusterCollection.cs | 42 ++++ .../Sample_ServiceFabricServiceCollection.cs | 44 ++++ .../ServiceFabricApplicationCollection.cs | 74 ++++++ .../ServiceFabricApplicationTypeCollection.cs | 74 ++++++ ...eFabricApplicationTypeVersionCollection.cs | 74 ++++++ .../ServiceFabricClusterCollection.cs | 74 ++++++ .../ServiceFabricServiceCollection.cs | 74 ++++++ ...rviceFabricManagedApplicationCollection.cs | 43 ++++ ...eFabricManagedApplicationTypeCollection.cs | 43 ++++ ...ManagedApplicationTypeVersionCollection.cs | 44 ++++ ...e_ServiceFabricManagedClusterCollection.cs | 42 ++++ ..._ServiceFabricManagedNodeTypeCollection.cs | 43 ++++ ...e_ServiceFabricManagedServiceCollection.cs | 44 ++++ ...rviceFabricManagedApplicationCollection.cs | 74 ++++++ ...eFabricManagedApplicationTypeCollection.cs | 74 ++++++ ...ManagedApplicationTypeVersionCollection.cs | 74 ++++++ .../ServiceFabricManagedClusterCollection.cs | 74 ++++++ .../ServiceFabricManagedNodeTypeCollection.cs | 74 ++++++ .../ServiceFabricManagedServiceCollection.cs | 74 ++++++ .../Sample_LinkerResourceCollection.cs | 40 ++++ .../src/Generated/LinkerResourceCollection.cs | 74 ++++++ .../Samples/Sample_AssociationCollection.cs | 43 ++++ .../Samples/Sample_FrontendCollection.cs | 43 ++++ .../Sample_TrafficControllerCollection.cs | 42 ++++ .../src/Generated/AssociationCollection.cs | 74 ++++++ .../src/Generated/FrontendCollection.cs | 74 ++++++ .../Generated/TrafficControllerCollection.cs | 74 ++++++ .../src/Generated/SignalRCollection.cs | 74 ++++++ .../SignalRCustomCertificateCollection.cs | 74 ++++++ .../SignalRCustomDomainCollection.cs | 74 ++++++ ...nalRPrivateEndpointConnectionCollection.cs | 74 ++++++ ...nalRSharedPrivateLinkResourceCollection.cs | 74 ++++++ .../Samples/Sample_SphereCatalogCollection.cs | 42 ++++ .../Sample_SphereCertificateCollection.cs | 44 ++++ .../Sample_SphereDeploymentCollection.cs | 45 ++++ .../Samples/Sample_SphereDeviceCollection.cs | 45 ++++ .../Sample_SphereDeviceGroupCollection.cs | 44 ++++ .../Samples/Sample_SphereImageCollection.cs | 43 ++++ .../Samples/Sample_SphereProductCollection.cs | 43 ++++ .../src/Generated/SphereCatalogCollection.cs | 74 ++++++ .../Generated/SphereCertificateCollection.cs | 74 ++++++ .../Generated/SphereDeploymentCollection.cs | 74 ++++++ .../src/Generated/SphereDeviceCollection.cs | 74 ++++++ .../Generated/SphereDeviceGroupCollection.cs | 74 ++++++ .../src/Generated/SphereImageCollection.cs | 74 ++++++ .../src/Generated/SphereProductCollection.cs | 74 ++++++ ...ackupShortTermRetentionPolicyCollection.cs | 44 ++++ ...ple_DataWarehouseUserActivityCollection.cs | 45 ++++ ...abaseAdvancedThreatProtectionCollection.cs | 44 ++++ .../Samples/Sample_DeletedServerCollection.cs | 43 ++++ ..._DistributedAvailabilityGroupCollection.cs | 43 ++++ .../Samples/Sample_ElasticPoolCollection.cs | 172 ++++++++++++++ .../Sample_EncryptionProtectorCollection.cs | 43 ++++ .../Sample_EndpointCertificateCollection.cs | 44 ++++ ...dedDatabaseBlobAuditingPolicyCollection.cs | 44 ++++ ...endedServerBlobAuditingPolicyCollection.cs | 43 ++++ .../Samples/Sample_FailoverGroupCollection.cs | 43 ++++ .../Sample_GeoBackupPolicyCollection.cs | 44 ++++ .../Sample_IPv6FirewallRuleCollection.cs | 43 ++++ .../Sample_InstanceFailoverGroupCollection.cs | 43 ++++ .../Samples/Sample_InstancePoolCollection.cs | 42 ++++ .../Sample_LedgerDigestUploadCollection.cs | 44 ++++ ...baseTransparentDataEncryptionCollection.cs | 44 ++++ ...ample_LongTermRetentionPolicyCollection.cs | 44 ++++ ...ackupShortTermRetentionPolicyCollection.cs | 44 ++++ ...abaseAdvancedThreatProtectionCollection.cs | 44 ++++ .../Sample_ManagedDatabaseCollection.cs | 43 ++++ .../Sample_ManagedDatabaseColumnCollection.cs | 47 ++++ ..._ManagedDatabaseRestoreDetailCollection.cs | 45 ++++ .../Sample_ManagedDatabaseSchemaCollection.cs | 45 ++++ ...edDatabaseSecurityAlertPolicyCollection.cs | 44 ++++ ...nagedDatabaseSensitivityLabelCollection.cs | 48 ++++ .../Sample_ManagedDatabaseTableCollection.cs | 46 ++++ ...tabaseVulnerabilityAssessmentCollection.cs | 44 ++++ ...abilityAssessmentRuleBaselineCollection.cs | 46 ++++ ...seVulnerabilityAssessmentScanCollection.cs | 46 ++++ ..._ManagedInstanceAdministratorCollection.cs | 43 ++++ ...tanceAdvancedThreatProtectionCollection.cs | 43 ++++ ...anceAzureADOnlyAuthenticationCollection.cs | 43 ++++ .../Sample_ManagedInstanceCollection.cs | 84 +++++++ .../Sample_ManagedInstanceDtcCollection.cs | 43 ++++ ...edInstanceEncryptionProtectorCollection.cs | 43 ++++ .../Sample_ManagedInstanceKeyCollection.cs | 43 ++++ ...stanceLongTermRetentionPolicyCollection.cs | 44 ++++ ...mple_ManagedInstanceOperationCollection.cs | 44 ++++ ...ancePrivateEndpointConnectionCollection.cs | 43 ++++ ...le_ManagedInstancePrivateLinkCollection.cs | 44 ++++ ...anceServerConfigurationOptionCollection.cs | 43 ++++ ...nstanceServerTrustCertificateCollection.cs | 43 ++++ ...agedInstanceStartStopScheduleCollection.cs | 43 ++++ ...stanceVulnerabilityAssessmentCollection.cs | 43 ++++ ...ple_ManagedLedgerDigestUploadCollection.cs | 44 ++++ ...ackupShortTermRetentionPolicyCollection.cs | 44 ++++ .../Sample_ManagedServerDnsAliasCollection.cs | 43 ++++ ...agedServerSecurityAlertPolicyCollection.cs | 43 ++++ ...agedTransparentDataEncryptionCollection.cs | 44 ++++ .../Sample_OutboundFirewallRuleCollection.cs | 43 ++++ .../Sample_RecommendedActionCollection.cs | 46 ++++ .../Sample_RecoverableDatabaseCollection.cs | 88 +++++++ ...le_RecoverableManagedDatabaseCollection.cs | 44 ++++ ...eGroupLongTermRetentionBackupCollection.cs | 46 ++++ ...etentionManagedInstanceBackupCollection.cs | 46 ++++ ...ple_RestorableDroppedDatabaseCollection.cs | 88 +++++++ ...torableDroppedManagedDatabaseCollection.cs | 44 ++++ ...erverAdvancedThreatProtectionCollection.cs | 43 ++++ .../Sample_ServiceObjectiveCollection.cs | 44 ++++ .../Sample_SqlDatabaseAdvisorCollection.cs | 45 ++++ ...SqlDatabaseBlobAuditingPolicyCollection.cs | 44 ++++ .../Samples/Sample_SqlDatabaseCollection.cs | 216 ++++++++++++++++++ .../Sample_SqlDatabaseColumnCollection.cs | 47 ++++ .../Sample_SqlDatabaseSchemaCollection.cs | 45 ++++ ...qlDatabaseSecurityAlertPolicyCollection.cs | 44 ++++ ...e_SqlDatabaseSensitivityLabelCollection.cs | 48 ++++ ...lnerabilityAssessmentBaselineCollection.cs | 45 ++++ ...abilityAssessmentBaselineRuleCollection.cs | 46 ++++ ...aseSqlVulnerabilityAssessmentCollection.cs | 45 ++++ ...qlVulnerabilityAssessmentScanCollection.cs | 46 ++++ ...erabilityAssessmentScanResultCollection.cs | 47 ++++ .../Sample_SqlDatabaseTableCollection.cs | 46 ++++ ...tabaseVulnerabilityAssessmentCollection.cs | 44 ++++ ...abilityAssessmentRuleBaselineCollection.cs | 46 ++++ ...seVulnerabilityAssessmentScanCollection.cs | 46 ++++ .../Sample_SqlFirewallRuleCollection.cs | 43 ++++ ..._SqlPrivateEndpointConnectionCollection.cs | 43 ++++ ...Sample_SqlPrivateLinkResourceCollection.cs | 44 ++++ .../Sample_SqlServerAdvisorCollection.cs | 44 ++++ ...SqlServerAzureADAdministratorCollection.cs | 43 ++++ ...rverAzureADOnlyAuthenticationCollection.cs | 43 ++++ ...e_SqlServerBlobAuditingPolicyCollection.cs | 43 ++++ .../Samples/Sample_SqlServerCollection.cs | 84 +++++++ ...le_SqlServerCommunicationLinkCollection.cs | 43 ++++ ...ple_SqlServerConnectionPolicyCollection.cs | 43 ++++ ...ServerDatabaseReplicationLinkCollection.cs | 45 ++++ ...SqlServerDatabaseRestorePointCollection.cs | 89 ++++++++ ...qlServerDevOpsAuditingSettingCollection.cs | 43 ++++ .../Sample_SqlServerDnsAliasCollection.cs | 43 ++++ .../Sample_SqlServerJobAgentCollection.cs | 43 ++++ .../Samples/Sample_SqlServerJobCollection.cs | 44 ++++ ...Sample_SqlServerJobCredentialCollection.cs | 44 ++++ .../Sample_SqlServerJobExecutionCollection.cs | 45 ++++ ...ple_SqlServerJobExecutionStepCollection.cs | 47 ++++ ...lServerJobExecutionStepTargetCollection.cs | 48 ++++ .../Sample_SqlServerJobStepCollection.cs | 45 ++++ ...ample_SqlServerJobTargetGroupCollection.cs | 44 ++++ .../Sample_SqlServerJobVersionCollection.cs | 46 ++++ ...ample_SqlServerJobVersionStepCollection.cs | 47 ++++ .../Samples/Sample_SqlServerKeyCollection.cs | 43 ++++ ..._SqlServerSecurityAlertPolicyCollection.cs | 43 ++++ ...lnerabilityAssessmentBaselineCollection.cs | 44 ++++ ...abilityAssessmentBaselineRuleCollection.cs | 45 ++++ ...verSqlVulnerabilityAssessmentCollection.cs | 43 ++++ ...qlVulnerabilityAssessmentScanCollection.cs | 45 ++++ ...erabilityAssessmentScanResultCollection.cs | 46 ++++ .../Sample_SqlServerTrustGroupCollection.cs | 43 ++++ ...e_SqlServerVirtualNetworkRuleCollection.cs | 43 ++++ ...ServerVulnerabilityAssessmentCollection.cs | 43 ++++ .../Samples/Sample_SqlTimeZoneCollection.cs | 43 ++++ ...iptionLongTermRetentionBackupCollection.cs | 45 ++++ ...etentionManagedInstanceBackupCollection.cs | 45 ++++ .../Sample_SubscriptionUsageCollection.cs | 43 ++++ .../Samples/Sample_SyncAgentCollection.cs | 43 ++++ .../Samples/Sample_SyncGroupCollection.cs | 44 ++++ .../Samples/Sample_SyncMemberCollection.cs | 45 ++++ .../Sample_VirtualClusterCollection.cs | 43 ++++ .../Sample_WorkloadClassifierCollection.cs | 45 ++++ .../Samples/Sample_WorkloadGroupCollection.cs | 44 ++++ ...ackupShortTermRetentionPolicyCollection.cs | 66 ++++++ .../DataWarehouseUserActivityCollection.cs | 66 ++++++ ...abaseAdvancedThreatProtectionCollection.cs | 66 ++++++ .../src/Generated/DeletedServerCollection.cs | 74 ++++++ .../DistributedAvailabilityGroupCollection.cs | 74 ++++++ .../src/Generated/ElasticPoolCollection.cs | 74 ++++++ .../EncryptionProtectorCollection.cs | 66 ++++++ .../EndpointCertificateCollection.cs | 74 ++++++ ...dedDatabaseBlobAuditingPolicyCollection.cs | 66 ++++++ ...endedServerBlobAuditingPolicyCollection.cs | 66 ++++++ .../src/Generated/FailoverGroupCollection.cs | 74 ++++++ .../Generated/GeoBackupPolicyCollection.cs | 66 ++++++ .../Generated/IPv6FirewallRuleCollection.cs | 74 ++++++ .../InstanceFailoverGroupCollection.cs | 74 ++++++ .../src/Generated/InstancePoolCollection.cs | 74 ++++++ .../Generated/LedgerDigestUploadCollection.cs | 66 ++++++ ...baseTransparentDataEncryptionCollection.cs | 66 ++++++ .../LongTermRetentionPolicyCollection.cs | 66 ++++++ ...ackupShortTermRetentionPolicyCollection.cs | 66 ++++++ ...abaseAdvancedThreatProtectionCollection.cs | 66 ++++++ .../Generated/ManagedDatabaseCollection.cs | 74 ++++++ .../ManagedDatabaseColumnCollection.cs | 74 ++++++ .../ManagedDatabaseRestoreDetailCollection.cs | 66 ++++++ .../ManagedDatabaseSchemaCollection.cs | 74 ++++++ ...edDatabaseSecurityAlertPolicyCollection.cs | 66 ++++++ ...nagedDatabaseSensitivityLabelCollection.cs | 66 ++++++ .../ManagedDatabaseTableCollection.cs | 74 ++++++ ...tabaseVulnerabilityAssessmentCollection.cs | 66 ++++++ ...abilityAssessmentRuleBaselineCollection.cs | 76 ++++++ ...seVulnerabilityAssessmentScanCollection.cs | 74 ++++++ .../ManagedInstanceAdministratorCollection.cs | 66 ++++++ ...tanceAdvancedThreatProtectionCollection.cs | 66 ++++++ ...anceAzureADOnlyAuthenticationCollection.cs | 66 ++++++ .../Generated/ManagedInstanceCollection.cs | 76 ++++++ .../Generated/ManagedInstanceDtcCollection.cs | 66 ++++++ ...edInstanceEncryptionProtectorCollection.cs | 66 ++++++ .../Generated/ManagedInstanceKeyCollection.cs | 74 ++++++ ...stanceLongTermRetentionPolicyCollection.cs | 66 ++++++ .../ManagedInstanceOperationCollection.cs | 66 ++++++ ...ancePrivateEndpointConnectionCollection.cs | 74 ++++++ .../ManagedInstancePrivateLinkCollection.cs | 74 ++++++ ...anceServerConfigurationOptionCollection.cs | 66 ++++++ ...nstanceServerTrustCertificateCollection.cs | 74 ++++++ ...agedInstanceStartStopScheduleCollection.cs | 66 ++++++ ...stanceVulnerabilityAssessmentCollection.cs | 66 ++++++ .../ManagedLedgerDigestUploadCollection.cs | 66 ++++++ ...ackupShortTermRetentionPolicyCollection.cs | 66 ++++++ .../ManagedServerDnsAliasCollection.cs | 74 ++++++ ...agedServerSecurityAlertPolicyCollection.cs | 66 ++++++ ...agedTransparentDataEncryptionCollection.cs | 66 ++++++ .../OutboundFirewallRuleCollection.cs | 74 ++++++ .../Generated/RecommendedActionCollection.cs | 74 ++++++ .../RecoverableDatabaseCollection.cs | 78 +++++++ .../RecoverableManagedDatabaseCollection.cs | 74 ++++++ ...eGroupLongTermRetentionBackupCollection.cs | 74 ++++++ ...etentionManagedInstanceBackupCollection.cs | 74 ++++++ .../RestorableDroppedDatabaseCollection.cs | 78 +++++++ ...torableDroppedManagedDatabaseCollection.cs | 74 ++++++ ...erverAdvancedThreatProtectionCollection.cs | 66 ++++++ .../Generated/ServiceObjectiveCollection.cs | 74 ++++++ .../Generated/SqlDatabaseAdvisorCollection.cs | 74 ++++++ ...SqlDatabaseBlobAuditingPolicyCollection.cs | 66 ++++++ .../src/Generated/SqlDatabaseCollection.cs | 78 +++++++ .../Generated/SqlDatabaseColumnCollection.cs | 74 ++++++ .../Generated/SqlDatabaseSchemaCollection.cs | 74 ++++++ ...qlDatabaseSecurityAlertPolicyCollection.cs | 66 ++++++ .../SqlDatabaseSensitivityLabelCollection.cs | 66 ++++++ ...lnerabilityAssessmentBaselineCollection.cs | 66 ++++++ ...abilityAssessmentBaselineRuleCollection.cs | 74 ++++++ ...aseSqlVulnerabilityAssessmentCollection.cs | 66 ++++++ ...qlVulnerabilityAssessmentScanCollection.cs | 74 ++++++ ...erabilityAssessmentScanResultCollection.cs | 74 ++++++ .../Generated/SqlDatabaseTableCollection.cs | 74 ++++++ ...tabaseVulnerabilityAssessmentCollection.cs | 66 ++++++ ...abilityAssessmentRuleBaselineCollection.cs | 76 ++++++ ...seVulnerabilityAssessmentScanCollection.cs | 74 ++++++ .../Generated/SqlFirewallRuleCollection.cs | 74 ++++++ .../SqlPrivateEndpointConnectionCollection.cs | 74 ++++++ .../SqlPrivateLinkResourceCollection.cs | 74 ++++++ .../Generated/SqlServerAdvisorCollection.cs | 74 ++++++ ...SqlServerAzureADAdministratorCollection.cs | 66 ++++++ ...rverAzureADOnlyAuthenticationCollection.cs | 66 ++++++ .../SqlServerBlobAuditingPolicyCollection.cs | 66 ++++++ .../src/Generated/SqlServerCollection.cs | 76 ++++++ .../SqlServerCommunicationLinkCollection.cs | 74 ++++++ .../SqlServerConnectionPolicyCollection.cs | 66 ++++++ ...ServerDatabaseReplicationLinkCollection.cs | 74 ++++++ ...SqlServerDatabaseRestorePointCollection.cs | 74 ++++++ ...qlServerDevOpsAuditingSettingCollection.cs | 74 ++++++ .../Generated/SqlServerDnsAliasCollection.cs | 74 ++++++ .../Generated/SqlServerJobAgentCollection.cs | 74 ++++++ .../src/Generated/SqlServerJobCollection.cs | 74 ++++++ .../SqlServerJobCredentialCollection.cs | 74 ++++++ .../SqlServerJobExecutionCollection.cs | 66 ++++++ .../SqlServerJobExecutionStepCollection.cs | 74 ++++++ ...lServerJobExecutionStepTargetCollection.cs | 66 ++++++ .../Generated/SqlServerJobStepCollection.cs | 74 ++++++ .../SqlServerJobTargetGroupCollection.cs | 74 ++++++ .../SqlServerJobVersionCollection.cs | 66 ++++++ .../SqlServerJobVersionStepCollection.cs | 74 ++++++ .../src/Generated/SqlServerKeyCollection.cs | 74 ++++++ .../SqlServerSecurityAlertPolicyCollection.cs | 66 ++++++ ...lnerabilityAssessmentBaselineCollection.cs | 66 ++++++ ...abilityAssessmentBaselineRuleCollection.cs | 74 ++++++ ...verSqlVulnerabilityAssessmentCollection.cs | 66 ++++++ ...qlVulnerabilityAssessmentScanCollection.cs | 74 ++++++ ...erabilityAssessmentScanResultCollection.cs | 74 ++++++ .../SqlServerTrustGroupCollection.cs | 74 ++++++ .../SqlServerVirtualNetworkRuleCollection.cs | 74 ++++++ ...ServerVulnerabilityAssessmentCollection.cs | 66 ++++++ .../src/Generated/SqlTimeZoneCollection.cs | 74 ++++++ ...iptionLongTermRetentionBackupCollection.cs | 74 ++++++ ...etentionManagedInstanceBackupCollection.cs | 74 ++++++ .../Generated/SubscriptionUsageCollection.cs | 74 ++++++ .../src/Generated/SyncAgentCollection.cs | 74 ++++++ .../src/Generated/SyncGroupCollection.cs | 74 ++++++ .../src/Generated/SyncMemberCollection.cs | 74 ++++++ .../src/Generated/VirtualClusterCollection.cs | 74 ++++++ .../Generated/WorkloadClassifierCollection.cs | 74 ++++++ .../src/Generated/WorkloadGroupCollection.cs | 74 ++++++ ...ple_AvailabilityGroupListenerCollection.cs | 43 ++++ .../Samples/Sample_SqlVmCollection.cs | 42 ++++ .../Samples/Sample_SqlVmGroupCollection.cs | 42 ++++ .../AvailabilityGroupListenerCollection.cs | 76 ++++++ .../src/Generated/SqlVmCollection.cs | 76 ++++++ .../src/Generated/SqlVmGroupCollection.cs | 74 ++++++ 641 files changed, 39165 insertions(+) diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/samples/Generated/Samples/Sample_QuantumWorkspaceCollection.cs b/sdk/quantum/Azure.ResourceManager.Quantum/samples/Generated/Samples/Sample_QuantumWorkspaceCollection.cs index ec35ad9e1cfd..691e5b197b3c 100644 --- a/sdk/quantum/Azure.ResourceManager.Quantum/samples/Generated/Samples/Sample_QuantumWorkspaceCollection.cs +++ b/sdk/quantum/Azure.ResourceManager.Quantum/samples/Generated/Samples/Sample_QuantumWorkspaceCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_QuantumWorkspacesGet() Console.WriteLine($"Succeeded: {result}"); } + // QuantumWorkspacesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuantumWorkspacesGet() + { + // Generated from example definition: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/quantumWorkspacesGet.json + // this example is just showing the usage of "Workspaces_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-1111-2222-3333-444444444444"; + string resourceGroupName = "quantumResourcegroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this QuantumWorkspaceResource + QuantumWorkspaceCollection collection = resourceGroupResource.GetQuantumWorkspaces(); + + // invoke the operation + string workspaceName = "quantumworkspace1"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + QuantumWorkspaceResource 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 + QuantumWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QuantumWorkspacesPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/QuantumWorkspaceCollection.cs b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/QuantumWorkspaceCollection.cs index f0a75e10e927..cf06ae14a0ab 100644 --- a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/QuantumWorkspaceCollection.cs +++ b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/QuantumWorkspaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string workspaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the quantum workspace 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 workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _quantumWorkspaceWorkspacesClientDiagnostics.CreateScope("QuantumWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _quantumWorkspaceWorkspacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QuantumWorkspaceResource(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.Quantum/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the quantum workspace resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _quantumWorkspaceWorkspacesClientDiagnostics.CreateScope("QuantumWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _quantumWorkspaceWorkspacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QuantumWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/samples/Generated/Samples/Sample_QumuloFileSystemResourceCollection.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/samples/Generated/Samples/Sample_QumuloFileSystemResourceCollection.cs index 8ed7ab943ae9..11f97ca8bf4f 100644 --- a/sdk/qumulo/Azure.ResourceManager.Qumulo/samples/Generated/Samples/Sample_QumuloFileSystemResourceCollection.cs +++ b/sdk/qumulo/Azure.ResourceManager.Qumulo/samples/Generated/Samples/Sample_QumuloFileSystemResourceCollection.cs @@ -157,6 +157,48 @@ public async Task Exists_FileSystemsGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // FileSystems_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FileSystemsGetMaximumSetGen() + { + // Generated from example definition: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_Get_MaximumSet_Gen.json + // this example is just showing the usage of "FileSystems_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 = "ulseeqylxb"; + string resourceGroupName = "rgQumulo"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this QumuloFileSystemResource + QumuloFileSystemResourceCollection collection = resourceGroupResource.GetQumuloFileSystemResources(); + + // invoke the operation + string fileSystemName = "nauwwbfoqehgbhdsmkewoboyxeqg"; + NullableResponse response = await collection.GetIfExistsAsync(fileSystemName); + QumuloFileSystemResource 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 + QumuloFileSystemResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FileSystems_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -221,6 +263,48 @@ public async Task Exists_FileSystemsGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // FileSystems_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FileSystemsGetMinimumSetGen() + { + // Generated from example definition: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_Get_MinimumSet_Gen.json + // this example is just showing the usage of "FileSystems_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 = "aaaaaaa"; + string resourceGroupName = "rgQumulo"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this QumuloFileSystemResource + QumuloFileSystemResourceCollection collection = resourceGroupResource.GetQumuloFileSystemResources(); + + // invoke the operation + string fileSystemName = "aaaaaaaaaaaaaaaaa"; + NullableResponse response = await collection.GetIfExistsAsync(fileSystemName); + QumuloFileSystemResource 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 + QumuloFileSystemResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // FileSystems_CreateOrUpdate_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/QumuloFileSystemResourceCollection.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/QumuloFileSystemResourceCollection.cs index 63fe2d78bda3..107cedb934e7 100644 --- a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/QumuloFileSystemResourceCollection.cs +++ b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/QumuloFileSystemResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string fileSystemName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName} + /// + /// + /// Operation Id + /// FileSystems_Get + /// + /// + /// + /// Name of the File System 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 fileSystemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileSystemName, nameof(fileSystemName)); + + using var scope = _qumuloFileSystemResourceFileSystemsClientDiagnostics.CreateScope("QumuloFileSystemResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _qumuloFileSystemResourceFileSystemsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fileSystemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QumuloFileSystemResource(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/Qumulo.Storage/fileSystems/{fileSystemName} + /// + /// + /// Operation Id + /// FileSystems_Get + /// + /// + /// + /// Name of the File System resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fileSystemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileSystemName, nameof(fileSystemName)); + + using var scope = _qumuloFileSystemResourceFileSystemsClientDiagnostics.CreateScope("QumuloFileSystemResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _qumuloFileSystemResourceFileSystemsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fileSystemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QumuloFileSystemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseCollection.cs index 1a5e11a6ea65..bd0df7013543 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentQuotaLimitBaseCollection.cs @@ -78,6 +78,46 @@ public async Task Exists_QuotasGetRequestForCompute() Console.WriteLine($"Succeeded: {result}"); } + // Quotas_Get_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotasGetRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuQuotaLimit.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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CurrentQuotaLimitBaseResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CurrentQuotaLimitBaseCollection collection = client.GetCurrentQuotaLimitBases(scopeId); + + // invoke the operation + string resourceName = "standardNDSFamily"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + CurrentQuotaLimitBaseResource 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 + CurrentQuotaLimitBaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Quotas_UsagesRequest_ForNetwork [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -138,6 +178,46 @@ public async Task Exists_QuotasUsagesRequestForNetwork() Console.WriteLine($"Succeeded: {result}"); } + // Quotas_UsagesRequest_ForNetwork + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotasUsagesRequestForNetwork() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuQuotaLimit.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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CurrentQuotaLimitBaseResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CurrentQuotaLimitBaseCollection collection = client.GetCurrentQuotaLimitBases(scopeId); + + // invoke the operation + string resourceName = "MinPublicIpInterNetworkPrefixLength"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + CurrentQuotaLimitBaseResource 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 + CurrentQuotaLimitBaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Quotas_PutRequest_ForNetwork [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseCollection.cs index bc2cbc4b2a91..8d381be9db88 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_CurrentUsagesBaseCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -76,6 +77,46 @@ public async Task Exists_QuotasUsagesRequestForCompute() Console.WriteLine($"Succeeded: {result}"); } + // Quotas_UsagesRequest_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotasUsagesRequestForCompute() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getComputeOneSkuUsages.json + // this example is just showing the usage of "Usages_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CurrentUsagesBaseResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CurrentUsagesBaseCollection collection = client.GetCurrentUsagesBases(scopeId); + + // invoke the operation + string resourceName = "standardNDSFamily"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + CurrentUsagesBaseResource 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 + CurrentUsagesBaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Quotas_UsagesRequest_ForNetwork [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -136,6 +177,46 @@ public async Task Exists_QuotasUsagesRequestForNetwork() Console.WriteLine($"Succeeded: {result}"); } + // Quotas_UsagesRequest_ForNetwork + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotasUsagesRequestForNetwork() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getNetworkOneSkuUsages.json + // this example is just showing the usage of "Usages_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CurrentUsagesBaseResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CurrentUsagesBaseCollection collection = client.GetCurrentUsagesBases(scopeId); + + // invoke the operation + string resourceName = "MinPublicIpInterNetworkPrefixLength"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + CurrentUsagesBaseResource 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 + CurrentUsagesBaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Quotas_listUsagesForCompute [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs index 4e01fcf685db..cb0367aca414 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -76,6 +77,46 @@ public async Task Exists_QuotaRequestFailed() Console.WriteLine($"Succeeded: {result}"); } + // QuotaRequestFailed + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotaRequestFailed() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusFailed.json + // this example is just showing the usage of "QuotaRequestStatus_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this QuotaRequestDetailResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + QuotaRequestDetailCollection collection = client.GetQuotaRequestDetails(scopeId); + + // invoke the operation + string id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + NullableResponse response = await collection.GetIfExistsAsync(id); + QuotaRequestDetailResource 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 + QuotaRequestDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QuotaRequestInProgress [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -136,6 +177,46 @@ public async Task Exists_QuotaRequestInProgress() Console.WriteLine($"Succeeded: {result}"); } + // QuotaRequestInProgress + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotaRequestInProgress() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusInProgress.json + // this example is just showing the usage of "QuotaRequestStatus_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this QuotaRequestDetailResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + QuotaRequestDetailCollection collection = client.GetQuotaRequestDetails(scopeId); + + // invoke the operation + string id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + NullableResponse response = await collection.GetIfExistsAsync(id); + QuotaRequestDetailResource 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 + QuotaRequestDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QuotaRequestStatus [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -196,6 +277,46 @@ public async Task Exists_QuotaRequestStatus() Console.WriteLine($"Succeeded: {result}"); } + // QuotaRequestStatus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotaRequestStatus() + { + // Generated from example definition: specification/quota/resource-manager/Microsoft.Quota/stable/2023-02-01/examples/getQuotaRequestStatusById.json + // this example is just showing the usage of "QuotaRequestStatus_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this QuotaRequestDetailResource + string scope = "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + QuotaRequestDetailCollection collection = client.GetQuotaRequestDetails(scopeId); + + // invoke the operation + string id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + NullableResponse response = await collection.GetIfExistsAsync(id); + QuotaRequestDetailResource 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 + QuotaRequestDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QuotaRequestHistory [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseCollection.cs index ac08b2b5811f..72a810d1952b 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseCollection.cs @@ -347,6 +347,90 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/quotas/{resourceName} + /// + /// + /// Operation Id + /// Quota_Get + /// + /// + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _currentQuotaLimitBaseQuotaClientDiagnostics.CreateScope("CurrentQuotaLimitBaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _currentQuotaLimitBaseQuotaRestClient.GetAsync(Id, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CurrentQuotaLimitBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/quotas/{resourceName} + /// + /// + /// Operation Id + /// Quota_Get + /// + /// + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _currentQuotaLimitBaseQuotaClientDiagnostics.CreateScope("CurrentQuotaLimitBaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _currentQuotaLimitBaseQuotaRestClient.Get(Id, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CurrentQuotaLimitBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseCollection.cs index a8722a7bbb53..db594f322a78 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseCollection.cs @@ -251,6 +251,90 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/usages/{resourceName} + /// + /// + /// Operation Id + /// Usages_Get + /// + /// + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _currentUsagesBaseUsagesClientDiagnostics.CreateScope("CurrentUsagesBaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _currentUsagesBaseUsagesRestClient.GetAsync(Id, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CurrentUsagesBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/usages/{resourceName} + /// + /// + /// Operation Id + /// Usages_Get + /// + /// + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _currentUsagesBaseUsagesClientDiagnostics.CreateScope("CurrentUsagesBaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _currentUsagesBaseUsagesRestClient.Get(Id, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CurrentUsagesBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailCollection.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailCollection.cs index 3e4e6dc70dcc..fab2e2b93f46 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailCollection.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailCollection.cs @@ -253,6 +253,80 @@ public virtual Response Exists(string id, CancellationToken cancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/quotaRequests/{id} + /// + /// + /// Operation Id + /// QuotaRequestStatus_Get + /// + /// + /// + /// Quota request ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _quotaRequestDetailQuotaRequestStatusClientDiagnostics.CreateScope("QuotaRequestDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _quotaRequestDetailQuotaRequestStatusRestClient.GetAsync(Id, id, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QuotaRequestDetailResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/quotaRequests/{id} + /// + /// + /// Operation Id + /// QuotaRequestStatus_Get + /// + /// + /// + /// Quota request ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _quotaRequestDetailQuotaRequestStatusClientDiagnostics.CreateScope("QuotaRequestDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = _quotaRequestDetailQuotaRequestStatusRestClient.Get(Id, id, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QuotaRequestDetailResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupEngineCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupEngineCollection.cs index 0acb8faa689e..b86ec78cfa5b 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupEngineCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupEngineCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,5 +120,48 @@ public async Task Exists_GetDpmAzureBackupServerLajollaBackupEngineDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Get Dpm/AzureBackupServer/Lajolla Backup Engine Details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDpmAzureBackupServerLajollaBackupEngineDetails() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/Dpm/BackupEngines_Get.json + // this example is just showing the usage of "BackupEngines_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 = "testRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupEngineResource + string vaultName = "testVault"; + BackupEngineCollection collection = resourceGroupResource.GetBackupEngines(vaultName); + + // invoke the operation + string backupEngineName = "testServer"; + NullableResponse response = await collection.GetIfExistsAsync(backupEngineName); + BackupEngineResource 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 + BackupEngineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupJobCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupJobCollection.cs index c51a2820c4a9..409f9fbd1882 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupJobCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupJobCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -195,5 +196,48 @@ public async Task Exists_GetJobDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Get Job Details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetJobDetails() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/Common/GetJobDetails.json + // this example is just showing the usage of "JobDetails_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 = "SwaggerTestRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupJobResource + string vaultName = "NetSDKTestRsVault"; + BackupJobCollection collection = resourceGroupResource.GetBackupJobs(vaultName); + + // invoke the operation + string jobName = "00000000-0000-0000-0000-000000000000"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + BackupJobResource 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 + BackupJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupPrivateEndpointConnectionCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupPrivateEndpointConnectionCollection.cs index b7ee14f03667..18b1f4f39052 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupPrivateEndpointConnectionCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupPrivateEndpointConnectionCollection.cs @@ -85,6 +85,49 @@ public async Task Exists_GetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Get PrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateEndpointConnection() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/PrivateEndpointConnection/GetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_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 = "04cf684a-d41f-4550-9f70-7708a3a2283b"; + string resourceGroupName = "gaallaRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupPrivateEndpointConnectionResource + BackupPrivateEndpointConnectionCollection collection = resourceGroupResource.GetBackupPrivateEndpointConnections(); + + // invoke the operation + string vaultName = "gaallavaultbvtd2msi"; + string privateEndpointConnectionName = "gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName, privateEndpointConnectionName); + BackupPrivateEndpointConnectionResource 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 + BackupPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update PrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectedItemCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectedItemCollection.cs index cb910f20b376..cc843576fa33 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectedItemCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectedItemCollection.cs @@ -88,6 +88,51 @@ public async Task Exists_GetProtectedClassicVirtualMachineDetails() Console.WriteLine($"Succeeded: {result}"); } + // Get Protected Classic Virtual Machine Details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetProtectedClassicVirtualMachineDetails() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/AzureIaasVm/ClassicCompute_ProtectedItem_Get.json + // this example is just showing the usage of "ProtectedItems_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 BackupProtectionContainerResource created on azure + // for more information of creating BackupProtectionContainerResource, please refer to the document of BackupProtectionContainerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "PythonSDKBackupTestRg"; + string vaultName = "PySDKBackupTestRsVault"; + string fabricName = "Azure"; + string containerName = "iaasvmcontainer;iaasvmcontainer;iaasvm-rg;iaasvm-1"; + ResourceIdentifier backupProtectionContainerResourceId = BackupProtectionContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, fabricName, containerName); + BackupProtectionContainerResource backupProtectionContainer = client.GetBackupProtectionContainerResource(backupProtectionContainerResourceId); + + // get the collection of this BackupProtectedItemResource + BackupProtectedItemCollection collection = backupProtectionContainer.GetBackupProtectedItems(); + + // invoke the operation + string protectedItemName = "vm;iaasvmcontainer;iaasvm-rg;iaasvm-1"; + NullableResponse response = await collection.GetIfExistsAsync(protectedItemName); + BackupProtectedItemResource 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 + BackupProtectedItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Protected Virtual Machine Details [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -158,6 +203,51 @@ public async Task Exists_GetProtectedVirtualMachineDetails() Console.WriteLine($"Succeeded: {result}"); } + // Get Protected Virtual Machine Details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetProtectedVirtualMachineDetails() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/AzureIaasVm/Compute_ProtectedItem_Get.json + // this example is just showing the usage of "ProtectedItems_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 BackupProtectionContainerResource created on azure + // for more information of creating BackupProtectionContainerResource, please refer to the document of BackupProtectionContainerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "PythonSDKBackupTestRg"; + string vaultName = "PySDKBackupTestRsVault"; + string fabricName = "Azure"; + string containerName = "iaasvmcontainer;iaasvmcontainerv2;iaasvm-rg;iaasvm-1"; + ResourceIdentifier backupProtectionContainerResourceId = BackupProtectionContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, fabricName, containerName); + BackupProtectionContainerResource backupProtectionContainer = client.GetBackupProtectionContainerResource(backupProtectionContainerResourceId); + + // get the collection of this BackupProtectedItemResource + BackupProtectedItemCollection collection = backupProtectionContainer.GetBackupProtectedItems(); + + // invoke the operation + string protectedItemName = "vm;iaasvmcontainerv2;iaasvm-rg;iaasvm-1"; + NullableResponse response = await collection.GetIfExistsAsync(protectedItemName); + BackupProtectedItemResource 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 + BackupProtectedItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Enable Protection on Azure IaasVm [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionContainerCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionContainerCollection.cs index e7ee844919b6..a784e743a66c 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionContainerCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionContainerCollection.cs @@ -87,6 +87,50 @@ public async Task Exists_GetProtectionContainerDetails() Console.WriteLine($"Succeeded: {result}"); } + // Get Protection Container Details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetProtectionContainerDetails() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/AzureWorkload/ProtectionContainers_Get.json + // this example is just showing the usage of "ProtectionContainers_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 = "testRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupProtectionContainerResource + BackupProtectionContainerCollection collection = resourceGroupResource.GetBackupProtectionContainers(); + + // invoke the operation + string vaultName = "testVault"; + string fabricName = "Azure"; + string containerName = "VMAppContainer;Compute;testRG;testSQL"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName, fabricName, containerName); + BackupProtectionContainerResource 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 + BackupProtectionContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RegisterAzure Storage ProtectionContainers [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionIntentCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionIntentCollection.cs index 516c6417675e..8ac7b8b437d3 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionIntentCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionIntentCollection.cs @@ -87,6 +87,50 @@ public async Task Exists_GetProtectionIntentForAnItem() Console.WriteLine($"Succeeded: {result}"); } + // Get ProtectionIntent for an item + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetProtectionIntentForAnItem() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/AzureWorkload/BackupProtectionIntent_Get.json + // this example is just showing the usage of "ProtectionIntent_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 = "myRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupProtectionIntentResource + BackupProtectionIntentCollection collection = resourceGroupResource.GetBackupProtectionIntents(); + + // invoke the operation + string vaultName = "myVault"; + string fabricName = "Azure"; + string intentObjectName = "249D9B07-D2EF-4202-AA64-65F35418564E"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName, fabricName, intentObjectName); + BackupProtectionIntentResource 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 + BackupProtectionIntentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Azure Vm Protection Intent [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionPolicyCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionPolicyCollection.cs index d4e8d9c21f7a..fb2008952f74 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionPolicyCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupProtectionPolicyCollection.cs @@ -199,6 +199,49 @@ public async Task Exists_GetAzureIaasVmEnhancedProtectionPolicyDetails() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure IaasVm Enhanced Protection Policy Details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureIaasVmEnhancedProtectionPolicyDetails() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/AzureIaasVm/V2Policy/v2-Get-Policy.json + // this example is just showing the usage of "ProtectionPolicies_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 = "SwaggerTestRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupProtectionPolicyResource + string vaultName = "NetSDKTestRsVault"; + BackupProtectionPolicyCollection collection = resourceGroupResource.GetBackupProtectionPolicies(vaultName); + + // invoke the operation + string policyName = "v2-daily-sample"; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + BackupProtectionPolicyResource 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 + BackupProtectionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Azure IaasVm Protection Policy Details [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -265,6 +308,49 @@ public async Task Exists_GetAzureIaasVmProtectionPolicyDetails() Console.WriteLine($"Succeeded: {result}"); } + // Get Azure IaasVm Protection Policy Details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureIaasVmProtectionPolicyDetails() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/AzureIaasVm/ProtectionPolicies_Get.json + // this example is just showing the usage of "ProtectionPolicies_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 = "SwaggerTestRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupProtectionPolicyResource + string vaultName = "NetSDKTestRsVault"; + BackupProtectionPolicyCollection collection = resourceGroupResource.GetBackupProtectionPolicies(vaultName); + + // invoke the operation + string policyName = "testPolicy1"; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + BackupProtectionPolicyResource 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 + BackupProtectionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Daily Azure Storage Protection Policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupRecoveryPointCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupRecoveryPointCollection.cs index 32ae892071fc..cb8433498a94 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupRecoveryPointCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupRecoveryPointCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -127,5 +128,51 @@ public async Task Exists_GetAzureVmRecoveryPointDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Get Azure Vm Recovery Point Details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAzureVmRecoveryPointDetails() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/AzureIaasVm/RecoveryPoints_Get.json + // this example is just showing the usage of "RecoveryPoints_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 BackupProtectedItemResource created on azure + // for more information of creating BackupProtectedItemResource, please refer to the document of BackupProtectedItemResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rshhtestmdvmrg"; + string vaultName = "rshvault"; + string fabricName = "Azure"; + string containerName = "IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall"; + string protectedItemName = "VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall"; + ResourceIdentifier backupProtectedItemResourceId = BackupProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, fabricName, containerName, protectedItemName); + BackupProtectedItemResource backupProtectedItem = client.GetBackupProtectedItemResource(backupProtectedItemResourceId); + + // get the collection of this BackupRecoveryPointResource + BackupRecoveryPointCollection collection = backupProtectedItem.GetBackupRecoveryPoints(); + + // invoke the operation + string recoveryPointId = "26083826328862"; + NullableResponse response = await collection.GetIfExistsAsync(recoveryPointId); + BackupRecoveryPointResource 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 + BackupRecoveryPointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceConfigCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceConfigCollection.cs index af2769fd3472..64eb513dfdfb 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceConfigCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceConfigCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetVaultStorageConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get Vault Storage Configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVaultStorageConfiguration() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/Common/BackupStorageConfig_Get.json + // this example is just showing the usage of "BackupResourceStorageConfigsNonCRR_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 = "PythonSDKBackupTestRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupResourceConfigResource + BackupResourceConfigCollection collection = resourceGroupResource.GetBackupResourceConfigs(); + + // invoke the operation + string vaultName = "PySDKBackupTestRsVault"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName); + BackupResourceConfigResource 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 + BackupResourceConfigData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update Vault Storage Configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceEncryptionConfigExtendedCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceEncryptionConfigExtendedCollection.cs index 9e14171542b9..e76d7fd03342 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceEncryptionConfigExtendedCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceEncryptionConfigExtendedCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetVaultEncryptionConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Get Vault Encryption Configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVaultEncryptionConfiguration() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/BackupResourceEncryptionConfig_Get.json + // this example is just showing the usage of "BackupResourceEncryptionConfigs_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 = "rishgrp"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupResourceEncryptionConfigExtendedResource + BackupResourceEncryptionConfigExtendedCollection collection = resourceGroupResource.GetBackupResourceEncryptionConfigExtendeds(); + + // invoke the operation + string vaultName = "rishTestVault"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName); + BackupResourceEncryptionConfigExtendedResource 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 + BackupResourceEncryptionConfigExtendedData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update Vault Encryption Configuration [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceVaultConfigCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceVaultConfigCollection.cs index fe8cdefb9d0c..c26c2288fc18 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceVaultConfigCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_BackupResourceVaultConfigCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetVaultSecurityConfig() Console.WriteLine($"Succeeded: {result}"); } + // Get Vault Security Config + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVaultSecurityConfig() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/Common/BackupResourceVaultConfigs_Get.json + // this example is just showing the usage of "BackupResourceVaultConfigs_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 = "SwaggerTestRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this BackupResourceVaultConfigResource + BackupResourceVaultConfigCollection collection = resourceGroupResource.GetBackupResourceVaultConfigs(); + + // invoke the operation + string vaultName = "SwaggerTest"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName); + BackupResourceVaultConfigResource 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 + BackupResourceVaultConfigData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update Vault Security Config [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_ResourceGuardProxyCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_ResourceGuardProxyCollection.cs index 78175aee8b34..4f929a317944 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_ResourceGuardProxyCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/samples/Generated/Samples/Sample_ResourceGuardProxyCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetResourceGuardProxy() Console.WriteLine($"Succeeded: {result}"); } + // Get ResourceGuardProxy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetResourceGuardProxy() + { + // Generated from example definition: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json + // this example is just showing the usage of "ResourceGuardProxy_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 = "0b352192-dcac-4cc7-992e-a96190ccc68c"; + string resourceGroupName = "SampleResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ResourceGuardProxyResource + string vaultName = "sampleVault"; + ResourceGuardProxyCollection collection = resourceGroupResource.GetResourceGuardProxies(vaultName); + + // invoke the operation + string resourceGuardProxyName = "swaggerExample"; + NullableResponse response = await collection.GetIfExistsAsync(resourceGuardProxyName); + ResourceGuardProxyResource 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 + ResourceGuardProxyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create ResourceGuardProxy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupEngineCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupEngineCollection.cs index 585fa5e2bb38..b9b72940cf54 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupEngineCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupEngineCollection.cs @@ -259,6 +259,84 @@ public virtual Response Exists(string backupEngineName, string filter = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName} + /// + /// + /// Operation Id + /// BackupEngines_Get + /// + /// + /// + /// Name of the backup management server. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupEngineName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupEngineName, nameof(backupEngineName)); + + using var scope = _backupEngineClientDiagnostics.CreateScope("BackupEngineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupEngineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, backupEngineName, filter, skipToken, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupEngineResource(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.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName} + /// + /// + /// Operation Id + /// BackupEngines_Get + /// + /// + /// + /// Name of the backup management server. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupEngineName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupEngineName, nameof(backupEngineName)); + + using var scope = _backupEngineClientDiagnostics.CreateScope("BackupEngineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupEngineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, backupEngineName, filter, skipToken, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupEngineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupJobCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupJobCollection.cs index 44c66e570ac9..23b9eadd5153 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupJobCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupJobCollection.cs @@ -256,6 +256,80 @@ public virtual Response Exists(string jobName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName} + /// + /// + /// Operation Id + /// JobDetails_Get + /// + /// + /// + /// Name of the job whose details are to be fetched. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _backupJobJobDetailsClientDiagnostics.CreateScope("BackupJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupJobJobDetailsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, jobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupJobResource(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.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName} + /// + /// + /// Operation Id + /// JobDetails_Get + /// + /// + /// + /// Name of the job whose details are to be fetched. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _backupJobJobDetailsClientDiagnostics.CreateScope("BackupJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupJobJobDetailsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, jobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupPrivateEndpointConnectionCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupPrivateEndpointConnectionCollection.cs index d9895b2160e1..c1a778447b55 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupPrivateEndpointConnectionCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupPrivateEndpointConnectionCollection.cs @@ -288,5 +288,83 @@ public virtual Response Exists(string vaultName, string privateEndpointCon throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _backupPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics.CreateScope("BackupPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupPrivateEndpointConnectionPrivateEndpointConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupPrivateEndpointConnectionResource(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.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _backupPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics.CreateScope("BackupPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupPrivateEndpointConnectionPrivateEndpointConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemCollection.cs index cc7c2a448902..7637e543a796 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemCollection.cs @@ -283,5 +283,81 @@ public virtual Response Exists(string protectedItemName, string filter = n throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItems_Get + /// + /// + /// + /// Backed up item name whose details are to be fetched. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string protectedItemName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var scope = _backupProtectedItemProtectedItemsClientDiagnostics.CreateScope("BackupProtectedItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupProtectedItemProtectedItemsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, protectedItemName, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupProtectedItemResource(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.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItems_Get + /// + /// + /// + /// Backed up item name whose details are to be fetched. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string protectedItemName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var scope = _backupProtectedItemProtectedItemsClientDiagnostics.CreateScope("BackupProtectedItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupProtectedItemProtectedItemsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, protectedItemName, filter, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupProtectedItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerCollection.cs index 015c7a032cb1..7087a3e77cc5 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerCollection.cs @@ -304,5 +304,87 @@ public virtual Response Exists(string vaultName, string fabricName, string throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName} + /// + /// + /// Operation Id + /// ProtectionContainers_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the fabric where the container belongs. + /// Name of the container whose details need to be fetched. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GetIfExistsAsync(string vaultName, string fabricName, string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _backupProtectionContainerProtectionContainersClientDiagnostics.CreateScope("BackupProtectionContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupProtectionContainerProtectionContainersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, containerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupProtectionContainerResource(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.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName} + /// + /// + /// Operation Id + /// ProtectionContainers_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the fabric where the container belongs. + /// Name of the container whose details need to be fetched. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual NullableResponse GetIfExists(string vaultName, string fabricName, string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _backupProtectionContainerProtectionContainersClientDiagnostics.CreateScope("BackupProtectionContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupProtectionContainerProtectionContainersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, containerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupProtectionContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionIntentCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionIntentCollection.cs index 5068099c8d13..af335c4a19ae 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionIntentCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionIntentCollection.cs @@ -302,5 +302,87 @@ public virtual Response Exists(string vaultName, string fabricName, string throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName} + /// + /// + /// Operation Id + /// ProtectionIntent_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Fabric name associated with the backed up item. + /// Backed up item name whose details are to be fetched. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GetIfExistsAsync(string vaultName, string fabricName, string intentObjectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(intentObjectName, nameof(intentObjectName)); + + using var scope = _backupProtectionIntentProtectionIntentClientDiagnostics.CreateScope("BackupProtectionIntentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupProtectionIntentProtectionIntentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, intentObjectName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupProtectionIntentResource(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.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName} + /// + /// + /// Operation Id + /// ProtectionIntent_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Fabric name associated with the backed up item. + /// Backed up item name whose details are to be fetched. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual NullableResponse GetIfExists(string vaultName, string fabricName, string intentObjectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(intentObjectName, nameof(intentObjectName)); + + using var scope = _backupProtectionIntentProtectionIntentClientDiagnostics.CreateScope("BackupProtectionIntentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupProtectionIntentProtectionIntentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, intentObjectName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupProtectionIntentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionPolicyCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionPolicyCollection.cs index f4488ff99bac..57a520a6c630 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionPolicyCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionPolicyCollection.cs @@ -342,6 +342,80 @@ public virtual Response Exists(string policyName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName} + /// + /// + /// Operation Id + /// ProtectionPolicies_Get + /// + /// + /// + /// Backup policy information to be fetched. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _backupProtectionPolicyProtectionPoliciesClientDiagnostics.CreateScope("BackupProtectionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupProtectionPolicyProtectionPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupProtectionPolicyResource(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.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName} + /// + /// + /// Operation Id + /// ProtectionPolicies_Get + /// + /// + /// + /// Backup policy information to be fetched. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _backupProtectionPolicyProtectionPoliciesClientDiagnostics.CreateScope("BackupProtectionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupProtectionPolicyProtectionPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupProtectionPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupRecoveryPointCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupRecoveryPointCollection.cs index 1f97b38f9729..622a0ef1f785 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupRecoveryPointCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupRecoveryPointCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string recoveryPointId, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// RecoveryPointID represents the backed up data to be fetched. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recoveryPointId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointId, nameof(recoveryPointId)); + + using var scope = _backupRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("BackupRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupRecoveryPointRecoveryPointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, recoveryPointId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupRecoveryPointResource(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.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// RecoveryPointID represents the backed up data to be fetched. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recoveryPointId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointId, nameof(recoveryPointId)); + + using var scope = _backupRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("BackupRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupRecoveryPointRecoveryPointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, recoveryPointId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceConfigCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceConfigCollection.cs index f8e5c269ff32..80ebcab167d3 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceConfigCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceConfigCollection.cs @@ -276,5 +276,79 @@ public virtual Response Exists(string vaultName, CancellationToken cancell throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig + /// + /// + /// Operation Id + /// BackupResourceStorageConfigsNonCRR_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _backupResourceConfigBackupResourceStorageConfigsNonCRRClientDiagnostics.CreateScope("BackupResourceConfigCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupResourceConfigBackupResourceStorageConfigsNonCRRRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupResourceConfigResource(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.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig + /// + /// + /// Operation Id + /// BackupResourceStorageConfigsNonCRR_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _backupResourceConfigBackupResourceStorageConfigsNonCRRClientDiagnostics.CreateScope("BackupResourceConfigCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupResourceConfigBackupResourceStorageConfigsNonCRRRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupResourceConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceEncryptionConfigExtendedCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceEncryptionConfigExtendedCollection.cs index 28234a4f5bd6..91d97da7a56b 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceEncryptionConfigExtendedCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceEncryptionConfigExtendedCollection.cs @@ -277,5 +277,79 @@ public virtual Response Exists(string vaultName, CancellationToken cancell throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig + /// + /// + /// Operation Id + /// BackupResourceEncryptionConfigs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _backupResourceEncryptionConfigExtendedBackupResourceEncryptionConfigsClientDiagnostics.CreateScope("BackupResourceEncryptionConfigExtendedCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupResourceEncryptionConfigExtendedBackupResourceEncryptionConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupResourceEncryptionConfigExtendedResource(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.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig + /// + /// + /// Operation Id + /// BackupResourceEncryptionConfigs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _backupResourceEncryptionConfigExtendedBackupResourceEncryptionConfigsClientDiagnostics.CreateScope("BackupResourceEncryptionConfigExtendedCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupResourceEncryptionConfigExtendedBackupResourceEncryptionConfigsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupResourceEncryptionConfigExtendedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceVaultConfigCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceVaultConfigCollection.cs index 88ff2076b378..198e60067a91 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceVaultConfigCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceVaultConfigCollection.cs @@ -276,5 +276,79 @@ public virtual Response Exists(string vaultName, CancellationToken cancell throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig + /// + /// + /// Operation Id + /// BackupResourceVaultConfigs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _backupResourceVaultConfigClientDiagnostics.CreateScope("BackupResourceVaultConfigCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupResourceVaultConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupResourceVaultConfigResource(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.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig + /// + /// + /// Operation Id + /// BackupResourceVaultConfigs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _backupResourceVaultConfigClientDiagnostics.CreateScope("BackupResourceVaultConfigCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupResourceVaultConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupResourceVaultConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/ResourceGuardProxyCollection.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/ResourceGuardProxyCollection.cs index 2ecd5231a24f..f1f46d0aab31 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/ResourceGuardProxyCollection.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/ResourceGuardProxyCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string resourceGuardProxyName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// ResourceGuardProxy_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var scope = _resourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceGuardProxyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, resourceGuardProxyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardProxyResource(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.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// ResourceGuardProxy_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var scope = _resourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceGuardProxyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, resourceGuardProxyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardProxyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraCollection.cs index 89f55c41adb8..8c2901757c52 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_DraGet() Console.WriteLine($"Succeeded: {result}"); } + // Dra_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DraGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Get.json + // this example is just showing the usage of "Dra_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 DataReplicationFabricResource created on azure + // for more information of creating DataReplicationFabricResource, please refer to the document of DataReplicationFabricResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + ResourceIdentifier dataReplicationFabricResourceId = DataReplicationFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName); + DataReplicationFabricResource dataReplicationFabric = client.GetDataReplicationFabricResource(dataReplicationFabricResourceId); + + // get the collection of this DataReplicationDraResource + DataReplicationDraCollection collection = dataReplicationFabric.GetDataReplicationDras(); + + // invoke the operation + string fabricAgentName = "M"; + NullableResponse response = await collection.GetIfExistsAsync(fabricAgentName); + DataReplicationDraResource 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 + DataReplicationDraData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Dra_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationCollection.cs index 164bda8248af..da967963935c 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_EmailConfigurationGet() Console.WriteLine($"Succeeded: {result}"); } + // EmailConfiguration_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EmailConfigurationGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Get.json + // this example is just showing the usage of "EmailConfiguration_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEmailConfigurationResource + DataReplicationEmailConfigurationCollection collection = dataReplicationVault.GetDataReplicationEmailConfigurations(); + + // invoke the operation + string emailConfigurationName = "0"; + NullableResponse response = await collection.GetIfExistsAsync(emailConfigurationName); + DataReplicationEmailConfigurationResource 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 + DataReplicationEmailConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // EmailConfiguration_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventCollection.cs index a42f2008f13b..e8e46070f72d 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_EventGet() Console.WriteLine($"Succeeded: {result}"); } + // Event_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_Get.json + // this example is just showing the usage of "Event_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEventResource + DataReplicationEventCollection collection = dataReplicationVault.GetDataReplicationEvents(); + + // invoke the operation + string eventName = "231CIG"; + NullableResponse response = await collection.GetIfExistsAsync(eventName); + DataReplicationEventResource 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 + DataReplicationEventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Event_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricCollection.cs index 3718a03ff387..4c1c67cb9641 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_FabricGet() Console.WriteLine($"Succeeded: {result}"); } + // Fabric_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FabricGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Get.json + // this example is just showing the usage of "Fabric_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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationFabricResource + DataReplicationFabricCollection collection = resourceGroupResource.GetDataReplicationFabrics(); + + // invoke the operation + string fabricName = "wPR"; + NullableResponse response = await collection.GetIfExistsAsync(fabricName); + DataReplicationFabricResource 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 + DataReplicationFabricData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Fabric_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyCollection.cs index 105f687df4ec..ca8b34e5385a 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_PolicyGet() Console.WriteLine($"Succeeded: {result}"); } + // Policy_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PolicyGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Get.json + // this example is just showing the usage of "Policy_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationPolicyResource + DataReplicationPolicyCollection collection = dataReplicationVault.GetDataReplicationPolicies(); + + // invoke the operation + string policyName = "wdqsacasc"; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + DataReplicationPolicyResource 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 + DataReplicationPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Policy_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemCollection.cs index c9caa7c1bba2..d20b7c6570da 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ProtectedItemGet() Console.WriteLine($"Succeeded: {result}"); } + // ProtectedItem_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProtectedItemGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Get.json + // this example is just showing the usage of "ProtectedItem_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationProtectedItemResource + DataReplicationProtectedItemCollection collection = dataReplicationVault.GetDataReplicationProtectedItems(); + + // invoke the operation + string protectedItemName = "d"; + NullableResponse response = await collection.GetIfExistsAsync(protectedItemName); + DataReplicationProtectedItemResource 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 + DataReplicationProtectedItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ProtectedItem_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointCollection.cs index 74ca7d8389ac..91cd5a0fbd5f 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_RecoveryPointsGet() Console.WriteLine($"Succeeded: {result}"); } + // RecoveryPoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RecoveryPointsGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_Get.json + // this example is just showing the usage of "RecoveryPoints_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 DataReplicationProtectedItemResource created on azure + // for more information of creating DataReplicationProtectedItemResource, please refer to the document of DataReplicationProtectedItemResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + ResourceIdentifier dataReplicationProtectedItemResourceId = DataReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName); + DataReplicationProtectedItemResource dataReplicationProtectedItem = client.GetDataReplicationProtectedItemResource(dataReplicationProtectedItemResourceId); + + // get the collection of this DataReplicationRecoveryPointResource + DataReplicationRecoveryPointCollection collection = dataReplicationProtectedItem.GetDataReplicationRecoveryPoints(); + + // invoke the operation + string recoveryPointName = "1X"; + NullableResponse response = await collection.GetIfExistsAsync(recoveryPointName); + DataReplicationRecoveryPointResource 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 + DataReplicationRecoveryPointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RecoveryPoints_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionCollection.cs index cc97eb6b1c94..8f08bc71e4ee 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_ReplicationExtensionGet() Console.WriteLine($"Succeeded: {result}"); } + // ReplicationExtension_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ReplicationExtensionGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Get.json + // this example is just showing the usage of "ReplicationExtension_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationReplicationExtensionResource + DataReplicationReplicationExtensionCollection collection = dataReplicationVault.GetDataReplicationReplicationExtensions(); + + // invoke the operation + string replicationExtensionName = "g16yjJ"; + NullableResponse response = await collection.GetIfExistsAsync(replicationExtensionName); + DataReplicationReplicationExtensionResource 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 + DataReplicationReplicationExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ReplicationExtension_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultCollection.cs index 5083fcd49f69..f436cec95273 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_VaultGet() Console.WriteLine($"Succeeded: {result}"); } + // Vault_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VaultGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Get.json + // this example is just showing the usage of "Vault_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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationVaultResource + DataReplicationVaultCollection collection = resourceGroupResource.GetDataReplicationVaults(); + + // invoke the operation + string vaultName = "4"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName); + DataReplicationVaultResource 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 + DataReplicationVaultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Vault_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowCollection.cs index 3f94aa048f0b..36be74219dd9 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_WorkflowGet() Console.WriteLine($"Succeeded: {result}"); } + // Workflow_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WorkflowGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_Get.json + // this example is just showing the usage of "Workflow_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationWorkflowResource + DataReplicationWorkflowCollection collection = dataReplicationVault.GetDataReplicationWorkflows(); + + // invoke the operation + string jobName = "ZGH4y"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + DataReplicationWorkflowResource 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 + DataReplicationWorkflowData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Workflow_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraCollection.cs index d621f8e7b62f..b51d480c54cf 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string fabricAgentName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationDraDraRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationDraResource(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.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationDraDraRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationDraResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationCollection.cs index 1d046413f34d..c15af5489be6 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string emailConfigurationName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The email configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string emailConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationEmailConfigurationEmailConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, emailConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEmailConfigurationResource(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.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The email configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string emailConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationEmailConfigurationEmailConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, emailConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEmailConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventCollection.cs index 28b0d71a2e92..c595dc9e9aec 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string eventName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The event name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var scope = _dataReplicationEventEventClientDiagnostics.CreateScope("DataReplicationEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationEventEventRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEventResource(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.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The event name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var scope = _dataReplicationEventEventClientDiagnostics.CreateScope("DataReplicationEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationEventEventRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricCollection.cs index 99082bcff10e..2df2a60208bb 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string fabricName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The fabric name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationFabricFabricRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fabricName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationFabricResource(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.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The fabric name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationFabricFabricRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fabricName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationFabricResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyCollection.cs index 5e47fc007025..60ff8b2afeaa 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string policyName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationPolicyPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationPolicyResource(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.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationPolicyPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemCollection.cs index 01e4cc73d544..fd1f9aa60851 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string protectedItemName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationProtectedItemProtectedItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationProtectedItemResource(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.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationProtectedItemProtectedItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationProtectedItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointCollection.cs index 701a6d5daae2..9a8033e1136a 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string recoveryPointName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var scope = _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataReplicationRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationRecoveryPointRecoveryPointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recoveryPointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationRecoveryPointResource(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.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var scope = _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataReplicationRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationRecoveryPointRecoveryPointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recoveryPointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionCollection.cs index 5f7eda7fb26f..2bb773001ec3 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string replicationExtensionName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The replication extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationReplicationExtensionReplicationExtensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationReplicationExtensionResource(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.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The replication extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationReplicationExtensionReplicationExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationReplicationExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultCollection.cs index dd5c283abca5..5192d941cc68 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string vaultName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The vault name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationVaultVaultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationVaultResource(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.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The vault name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationVaultVaultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowCollection.cs index dd9d8e9d4b4f..d948aa036e2f 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowCollection.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string jobName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The job (workflow) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataReplicationWorkflowWorkflowClientDiagnostics.CreateScope("DataReplicationWorkflowCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataReplicationWorkflowWorkflowRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationWorkflowResource(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.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The job (workflow) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataReplicationWorkflowWorkflowClientDiagnostics.CreateScope("DataReplicationWorkflowCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataReplicationWorkflowWorkflowRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataReplicationWorkflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_MigrationRecoveryPointCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_MigrationRecoveryPointCollection.cs index 206d539795cf..f67042934c2b 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_MigrationRecoveryPointCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_MigrationRecoveryPointCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -127,5 +128,51 @@ public async Task Exists_GetsARecoveryPointForAMigrationItem() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a recovery point for a migration item. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsARecoveryPointForAMigrationItem() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/MigrationRecoveryPoints_Get.json + // this example is just showing the usage of "MigrationRecoveryPoints_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 SiteRecoveryMigrationItemResource created on azure + // for more information of creating SiteRecoveryMigrationItemResource, please refer to the document of SiteRecoveryMigrationItemResource + string subscriptionId = "cb53d0c3-bd59-4721-89bc-06916a9147ef"; + string resourceGroupName = "resourcegroup1"; + string resourceName = "migrationvault"; + string fabricName = "vmwarefabric1"; + string protectionContainerName = "vmwareContainer1"; + string migrationItemName = "virtualmachine1"; + ResourceIdentifier siteRecoveryMigrationItemResourceId = SiteRecoveryMigrationItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName, protectionContainerName, migrationItemName); + SiteRecoveryMigrationItemResource siteRecoveryMigrationItem = client.GetSiteRecoveryMigrationItemResource(siteRecoveryMigrationItemResourceId); + + // get the collection of this MigrationRecoveryPointResource + MigrationRecoveryPointCollection collection = siteRecoveryMigrationItem.GetMigrationRecoveryPoints(); + + // invoke the operation + string migrationRecoveryPointName = "b22134ea-620c-474b-9fa5-3c1cb47708e3"; + NullableResponse response = await collection.GetIfExistsAsync(migrationRecoveryPointName); + MigrationRecoveryPointResource 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 + MigrationRecoveryPointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ProtectionContainerMappingCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ProtectionContainerMappingCollection.cs index 2de7d5b15c38..8bd341e81d0b 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ProtectionContainerMappingCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ProtectionContainerMappingCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetsAProtectionContainerMapping() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a protection container mapping. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAProtectionContainerMapping() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Get.json + // this example is just showing the usage of "ReplicationProtectionContainerMappings_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 SiteRecoveryProtectionContainerResource created on azure + // for more information of creating SiteRecoveryProtectionContainerResource, please refer to the document of SiteRecoveryProtectionContainerResource + string subscriptionId = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "cloud1"; + string protectionContainerName = "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"; + ResourceIdentifier siteRecoveryProtectionContainerResourceId = SiteRecoveryProtectionContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName, protectionContainerName); + SiteRecoveryProtectionContainerResource siteRecoveryProtectionContainer = client.GetSiteRecoveryProtectionContainerResource(siteRecoveryProtectionContainerResourceId); + + // get the collection of this ProtectionContainerMappingResource + ProtectionContainerMappingCollection collection = siteRecoveryProtectionContainer.GetProtectionContainerMappings(); + + // invoke the operation + string mappingName = "cloud1protectionprofile1"; + NullableResponse response = await collection.GetIfExistsAsync(mappingName); + ProtectionContainerMappingResource 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 + ProtectionContainerMappingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationEligibilityResultCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationEligibilityResultCollection.cs index 823e1c30ff5a..50cee70b647c 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationEligibilityResultCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationEligibilityResultCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -117,5 +118,47 @@ public async Task Exists_GetsTheValidationErrorsInCaseTheVMIsUnsuitableForProtec Console.WriteLine($"Succeeded: {result}"); } + + // Gets the validation errors in case the VM is unsuitable for protection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheValidationErrorsInCaseTheVMIsUnsuitableForProtection() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEligibilityResults_Get.json + // this example is just showing the usage of "ReplicationEligibilityResults_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 = "d90d145a-4cdd-45a3-b2c4-971d69775278"; + string resourceGroupName = "testRg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ReplicationEligibilityResultResource + string virtualMachineName = "testVm1"; + ReplicationEligibilityResultCollection collection = resourceGroupResource.GetReplicationEligibilityResults(virtualMachineName); + + // invoke the operation + NullableResponse response = await collection.GetIfExistsAsync(); + ReplicationEligibilityResultResource 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 + ReplicationEligibilityResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationProtectedItemCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationProtectedItemCollection.cs index 940bbaf51a69..1774a415cd42 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationProtectedItemCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationProtectedItemCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_GetsTheDetailsOfAReplicationProtectedItem() Console.WriteLine($"Succeeded: {result}"); } + // Gets the details of a Replication protected item. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfAReplicationProtectedItem() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Get.json + // this example is just showing the usage of "ReplicationProtectedItems_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 SiteRecoveryProtectionContainerResource created on azure + // for more information of creating SiteRecoveryProtectionContainerResource, please refer to the document of SiteRecoveryProtectionContainerResource + string subscriptionId = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "cloud1"; + string protectionContainerName = "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"; + ResourceIdentifier siteRecoveryProtectionContainerResourceId = SiteRecoveryProtectionContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName, protectionContainerName); + SiteRecoveryProtectionContainerResource siteRecoveryProtectionContainer = client.GetSiteRecoveryProtectionContainerResource(siteRecoveryProtectionContainerResourceId); + + // get the collection of this ReplicationProtectedItemResource + ReplicationProtectedItemCollection collection = siteRecoveryProtectionContainer.GetReplicationProtectedItems(); + + // invoke the operation + string replicatedProtectedItemName = "f8491e4f-817a-40dd-a90c-af773978c75b"; + NullableResponse response = await collection.GetIfExistsAsync(replicatedProtectedItemName); + ReplicationProtectedItemResource 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 + ReplicationProtectedItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Enables protection. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationProtectionIntentCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationProtectionIntentCollection.cs index 76c23022a4d6..b2d76d1565a4 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationProtectionIntentCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_ReplicationProtectionIntentCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetsTheDetailsOfAReplicationProtectionIntentItem() Console.WriteLine($"Succeeded: {result}"); } + // Gets the details of a Replication protection intent item. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfAReplicationProtectionIntentItem() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_Get.json + // this example is just showing the usage of "ReplicationProtectionIntents_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 = "509099b2-9d2c-4636-b43e-bd5cafb6be69"; + string resourceGroupName = "resourceGroupPS1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ReplicationProtectionIntentResource + string resourceName = "vault1"; + ReplicationProtectionIntentCollection collection = resourceGroupResource.GetReplicationProtectionIntents(resourceName); + + // invoke the operation + string intentObjectName = "vm1"; + NullableResponse response = await collection.GetIfExistsAsync(intentObjectName); + ReplicationProtectionIntentResource 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 + ReplicationProtectionIntentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create protection intent Resource. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryAlertCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryAlertCollection.cs index cd3126f34079..ca13a64ac80d 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryAlertCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryAlertCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetsAnEmailNotificationAlertConfiguration() Console.WriteLine($"Succeeded: {result}"); } + // Gets an email notification(alert) configuration. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAnEmailNotificationAlertConfiguration() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_Get.json + // this example is just showing the usage of "ReplicationAlertSettings_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 = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteRecoveryAlertResource + string resourceName = "vault1"; + SiteRecoveryAlertCollection collection = resourceGroupResource.GetSiteRecoveryAlerts(resourceName); + + // invoke the operation + string alertSettingName = "defaultAlertSetting"; + NullableResponse response = await collection.GetIfExistsAsync(alertSettingName); + SiteRecoveryAlertResource 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 + SiteRecoveryAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Configures email notifications for this vault. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryEventCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryEventCollection.cs index 3db378ee87b6..18cf37b37720 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryEventCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryEventCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,5 +120,48 @@ public async Task Exists_GetTheDetailsOfAnAzureSiteRecoveryEvent() Console.WriteLine($"Succeeded: {result}"); } + + // Get the details of an Azure Site recovery event. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheDetailsOfAnAzureSiteRecoveryEvent() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEvents_Get.json + // this example is just showing the usage of "ReplicationEvents_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 = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteRecoveryEventResource + string resourceName = "vault1"; + SiteRecoveryEventCollection collection = resourceGroupResource.GetSiteRecoveryEvents(resourceName); + + // invoke the operation + string eventName = "654b71d0-b2ce-4e6e-a861-98528d4bd375"; + NullableResponse response = await collection.GetIfExistsAsync(eventName); + SiteRecoveryEventResource 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 + SiteRecoveryEventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryFabricCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryFabricCollection.cs index 23dbde5d26b4..99b71786b0ef 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryFabricCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryFabricCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,5 +120,48 @@ public async Task Exists_GetsTheDetailsOfAnASRFabric() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the details of an ASR fabric. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfAnASRFabric() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Get.json + // this example is just showing the usage of "ReplicationFabrics_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 = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteRecoveryFabricResource + string resourceName = "vault1"; + SiteRecoveryFabricCollection collection = resourceGroupResource.GetSiteRecoveryFabrics(resourceName); + + // invoke the operation + string fabricName = "cloud1"; + NullableResponse response = await collection.GetIfExistsAsync(fabricName); + SiteRecoveryFabricResource 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 + SiteRecoveryFabricData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryJobCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryJobCollection.cs index 3633bee1167f..ffb8065c6c4a 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryJobCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryJobCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,5 +120,48 @@ public async Task Exists_GetsTheJobDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the job details. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheJobDetails() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Get.json + // this example is just showing the usage of "ReplicationJobs_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 = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteRecoveryJobResource + string resourceName = "vault1"; + SiteRecoveryJobCollection collection = resourceGroupResource.GetSiteRecoveryJobs(resourceName); + + // invoke the operation + string jobName = "58776d0b-3141-48b2-a377-9ad863eb160d"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + SiteRecoveryJobResource 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 + SiteRecoveryJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryLogicalNetworkCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryLogicalNetworkCollection.cs index fc9113a90358..985d3bf5d1b2 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryLogicalNetworkCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryLogicalNetworkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetsALogicalNetworkWithSpecifiedServerIdAndLogicalNetwo Console.WriteLine($"Succeeded: {result}"); } + + // Gets a logical network with specified server id and logical network name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsALogicalNetworkWithSpecifiedServerIdAndLogicalNetworkName() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationLogicalNetworks_Get.json + // this example is just showing the usage of "ReplicationLogicalNetworks_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 SiteRecoveryFabricResource created on azure + // for more information of creating SiteRecoveryFabricResource, please refer to the document of SiteRecoveryFabricResource + string subscriptionId = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "cloud1"; + ResourceIdentifier siteRecoveryFabricResourceId = SiteRecoveryFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName); + SiteRecoveryFabricResource siteRecoveryFabric = client.GetSiteRecoveryFabricResource(siteRecoveryFabricResourceId); + + // get the collection of this SiteRecoveryLogicalNetworkResource + SiteRecoveryLogicalNetworkCollection collection = siteRecoveryFabric.GetSiteRecoveryLogicalNetworks(); + + // invoke the operation + string logicalNetworkName = "87ab394f-165f-4aa9-bd84-b018500b4509"; + NullableResponse response = await collection.GetIfExistsAsync(logicalNetworkName); + SiteRecoveryLogicalNetworkResource 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 + SiteRecoveryLogicalNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryMigrationItemCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryMigrationItemCollection.cs index bd9de564e662..a735a500689d 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryMigrationItemCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryMigrationItemCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_GetsTheDetailsOfAMigrationItem() Console.WriteLine($"Succeeded: {result}"); } + // Gets the details of a migration item. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfAMigrationItem() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Get.json + // this example is just showing the usage of "ReplicationMigrationItems_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 SiteRecoveryProtectionContainerResource created on azure + // for more information of creating SiteRecoveryProtectionContainerResource, please refer to the document of SiteRecoveryProtectionContainerResource + string subscriptionId = "cb53d0c3-bd59-4721-89bc-06916a9147ef"; + string resourceGroupName = "resourcegroup1"; + string resourceName = "migrationvault"; + string fabricName = "vmwarefabric1"; + string protectionContainerName = "vmwareContainer1"; + ResourceIdentifier siteRecoveryProtectionContainerResourceId = SiteRecoveryProtectionContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName, protectionContainerName); + SiteRecoveryProtectionContainerResource siteRecoveryProtectionContainer = client.GetSiteRecoveryProtectionContainerResource(siteRecoveryProtectionContainerResourceId); + + // get the collection of this SiteRecoveryMigrationItemResource + SiteRecoveryMigrationItemCollection collection = siteRecoveryProtectionContainer.GetSiteRecoveryMigrationItems(); + + // invoke the operation + string migrationItemName = "virtualmachine1"; + NullableResponse response = await collection.GetIfExistsAsync(migrationItemName); + SiteRecoveryMigrationItemResource 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 + SiteRecoveryMigrationItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Enables migration. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryNetworkCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryNetworkCollection.cs index c29d152c1285..c7d85c7877c8 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryNetworkCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryNetworkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetsANetworkWithSpecifiedServerIdAndNetworkName() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a network with specified server id and network name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsANetworkWithSpecifiedServerIdAndNetworkName() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_Get.json + // this example is just showing the usage of "ReplicationNetworks_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 SiteRecoveryFabricResource created on azure + // for more information of creating SiteRecoveryFabricResource, please refer to the document of SiteRecoveryFabricResource + string subscriptionId = "9112a37f-0f3e-46ec-9c00-060c6edca071"; + string resourceGroupName = "srcBvte2a14C27"; + string resourceName = "srce2avaultbvtaC27"; + string fabricName = "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac"; + ResourceIdentifier siteRecoveryFabricResourceId = SiteRecoveryFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName); + SiteRecoveryFabricResource siteRecoveryFabric = client.GetSiteRecoveryFabricResource(siteRecoveryFabricResourceId); + + // get the collection of this SiteRecoveryNetworkResource + SiteRecoveryNetworkCollection collection = siteRecoveryFabric.GetSiteRecoveryNetworks(); + + // invoke the operation + string networkName = "93ce99d7-1219-4914-aa61-73fe5023988e"; + NullableResponse response = await collection.GetIfExistsAsync(networkName); + SiteRecoveryNetworkResource 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 + SiteRecoveryNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryNetworkMappingCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryNetworkMappingCollection.cs index c1497e2dfbe5..4319a75dfc70 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryNetworkMappingCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryNetworkMappingCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_GetsNetworkMappingByName() Console.WriteLine($"Succeeded: {result}"); } + // Gets network mapping by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsNetworkMappingByName() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Get.json + // this example is just showing the usage of "ReplicationNetworkMappings_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 SiteRecoveryNetworkResource created on azure + // for more information of creating SiteRecoveryNetworkResource, please refer to the document of SiteRecoveryNetworkResource + string subscriptionId = "9112a37f-0f3e-46ec-9c00-060c6edca071"; + string resourceGroupName = "srcBvte2a14C27"; + string resourceName = "srce2avaultbvtaC27"; + string fabricName = "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac"; + string networkName = "e2267b5c-2650-49bd-ab3f-d66aae694c06"; + ResourceIdentifier siteRecoveryNetworkResourceId = SiteRecoveryNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName, networkName); + SiteRecoveryNetworkResource siteRecoveryNetwork = client.GetSiteRecoveryNetworkResource(siteRecoveryNetworkResourceId); + + // get the collection of this SiteRecoveryNetworkMappingResource + SiteRecoveryNetworkMappingCollection collection = siteRecoveryNetwork.GetSiteRecoveryNetworkMappings(); + + // invoke the operation + string networkMappingName = "corpe2amap"; + NullableResponse response = await collection.GetIfExistsAsync(networkMappingName); + SiteRecoveryNetworkMappingResource 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 + SiteRecoveryNetworkMappingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates network mapping. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryPointCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryPointCollection.cs index 9437cabdf8d0..2ed4b9b845fd 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryPointCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryPointCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -127,5 +128,51 @@ public async Task Exists_GetsARecoveryPoint() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a recovery point. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsARecoveryPoint() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/RecoveryPoints_Get.json + // this example is just showing the usage of "RecoveryPoints_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 ReplicationProtectedItemResource created on azure + // for more information of creating ReplicationProtectedItemResource, please refer to the document of ReplicationProtectedItemResource + string subscriptionId = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "cloud1"; + string protectionContainerName = "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"; + string replicatedProtectedItemName = "f8491e4f-817a-40dd-a90c-af773978c75b"; + ResourceIdentifier replicationProtectedItemResourceId = ReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName, protectionContainerName, replicatedProtectedItemName); + ReplicationProtectedItemResource replicationProtectedItem = client.GetReplicationProtectedItemResource(replicationProtectedItemResourceId); + + // get the collection of this SiteRecoveryPointResource + SiteRecoveryPointCollection collection = replicationProtectedItem.GetSiteRecoveryPoints(); + + // invoke the operation + string recoveryPointName = "b22134ea-620c-474b-9fa5-3c1cb47708e3"; + NullableResponse response = await collection.GetIfExistsAsync(recoveryPointName); + SiteRecoveryPointResource 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 + SiteRecoveryPointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryPolicyCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryPolicyCollection.cs index 7fa4f8c8646a..0135f8df3ff6 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryPolicyCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryPolicyCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetsTheRequestedPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Gets the requested policy. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheRequestedPolicy() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Get.json + // this example is just showing the usage of "ReplicationPolicies_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 = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteRecoveryPolicyResource + string resourceName = "vault1"; + SiteRecoveryPolicyCollection collection = resourceGroupResource.GetSiteRecoveryPolicies(resourceName); + + // invoke the operation + string policyName = "protectionprofile1"; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + SiteRecoveryPolicyResource 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 + SiteRecoveryPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates the policy. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryProtectableItemCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryProtectableItemCollection.cs index 4cf2797e852e..bee03ee5cec1 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryProtectableItemCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryProtectableItemCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetsTheDetailsOfAProtectableItem() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the details of a protectable item. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfAProtectableItem() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectableItems_Get.json + // this example is just showing the usage of "ReplicationProtectableItems_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 SiteRecoveryProtectionContainerResource created on azure + // for more information of creating SiteRecoveryProtectionContainerResource, please refer to the document of SiteRecoveryProtectionContainerResource + string subscriptionId = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "cloud1"; + string protectionContainerName = "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"; + ResourceIdentifier siteRecoveryProtectionContainerResourceId = SiteRecoveryProtectionContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName, protectionContainerName); + SiteRecoveryProtectionContainerResource siteRecoveryProtectionContainer = client.GetSiteRecoveryProtectionContainerResource(siteRecoveryProtectionContainerResourceId); + + // get the collection of this SiteRecoveryProtectableItemResource + SiteRecoveryProtectableItemCollection collection = siteRecoveryProtectionContainer.GetSiteRecoveryProtectableItems(); + + // invoke the operation + string protectableItemName = "c0c14913-3d7a-48ea-9531-cc99e0e686e6"; + NullableResponse response = await collection.GetIfExistsAsync(protectableItemName); + SiteRecoveryProtectableItemResource 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 + SiteRecoveryProtectableItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryProtectionContainerCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryProtectionContainerCollection.cs index ddec05d04b6f..5d031c7a6455 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryProtectionContainerCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryProtectionContainerCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetsTheProtectionContainerDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the protection container details. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheProtectionContainerDetails() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Get.json + // this example is just showing the usage of "ReplicationProtectionContainers_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 SiteRecoveryFabricResource created on azure + // for more information of creating SiteRecoveryFabricResource, please refer to the document of SiteRecoveryFabricResource + string subscriptionId = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "cloud1"; + ResourceIdentifier siteRecoveryFabricResourceId = SiteRecoveryFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName); + SiteRecoveryFabricResource siteRecoveryFabric = client.GetSiteRecoveryFabricResource(siteRecoveryFabricResourceId); + + // get the collection of this SiteRecoveryProtectionContainerResource + SiteRecoveryProtectionContainerCollection collection = siteRecoveryFabric.GetSiteRecoveryProtectionContainers(); + + // invoke the operation + string protectionContainerName = "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"; + NullableResponse response = await collection.GetIfExistsAsync(protectionContainerName); + SiteRecoveryProtectionContainerResource 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 + SiteRecoveryProtectionContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryRecoveryPlanCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryRecoveryPlanCollection.cs index 73c16bd62ee5..b9ad8ed4f2a3 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryRecoveryPlanCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryRecoveryPlanCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetsTheRequestedRecoveryPlan() Console.WriteLine($"Succeeded: {result}"); } + // Gets the requested recovery plan. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheRequestedRecoveryPlan() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Get.json + // this example is just showing the usage of "ReplicationRecoveryPlans_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 = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteRecoveryRecoveryPlanResource + string resourceName = "vault1"; + SiteRecoveryRecoveryPlanCollection collection = resourceGroupResource.GetSiteRecoveryRecoveryPlans(resourceName); + + // invoke the operation + string recoveryPlanName = "RPtest1"; + NullableResponse response = await collection.GetIfExistsAsync(recoveryPlanName); + SiteRecoveryRecoveryPlanResource 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 + SiteRecoveryRecoveryPlanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates a recovery plan with the given details. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryServicesProviderCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryServicesProviderCollection.cs index e7f4b090ff6b..1168b36b8fb2 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryServicesProviderCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryServicesProviderCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetsTheDetailsOfARecoveryServicesProvider() Console.WriteLine($"Succeeded: {result}"); } + // Gets the details of a recovery services provider. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfARecoveryServicesProvider() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Get.json + // this example is just showing the usage of "ReplicationRecoveryServicesProviders_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 SiteRecoveryFabricResource created on azure + // for more information of creating SiteRecoveryFabricResource, please refer to the document of SiteRecoveryFabricResource + string subscriptionId = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "cloud1"; + ResourceIdentifier siteRecoveryFabricResourceId = SiteRecoveryFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName); + SiteRecoveryFabricResource siteRecoveryFabric = client.GetSiteRecoveryFabricResource(siteRecoveryFabricResourceId); + + // get the collection of this SiteRecoveryServicesProviderResource + SiteRecoveryServicesProviderCollection collection = siteRecoveryFabric.GetSiteRecoveryServicesProviders(); + + // invoke the operation + string providerName = "241641e6-ee7b-4ee4-8141-821fadda43fa"; + NullableResponse response = await collection.GetIfExistsAsync(providerName); + SiteRecoveryServicesProviderResource 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 + SiteRecoveryServicesProviderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Adds a recovery services provider. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryVCenterCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryVCenterCollection.cs index a5279c4b9616..e5279b51adcf 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryVCenterCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryVCenterCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_GetsTheDetailsOfAVCenter() Console.WriteLine($"Succeeded: {result}"); } + // Gets the details of a vCenter. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfAVCenter() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Get.json + // this example is just showing the usage of "ReplicationvCenters_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 SiteRecoveryFabricResource created on azure + // for more information of creating SiteRecoveryFabricResource, please refer to the document of SiteRecoveryFabricResource + string subscriptionId = "7c943c1b-5122-4097-90c8-861411bdd574"; + string resourceGroupName = "MadhaviVRG"; + string resourceName = "MadhaviVault"; + string fabricName = "MadhaviFabric"; + ResourceIdentifier siteRecoveryFabricResourceId = SiteRecoveryFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName); + SiteRecoveryFabricResource siteRecoveryFabric = client.GetSiteRecoveryFabricResource(siteRecoveryFabricResourceId); + + // get the collection of this SiteRecoveryVCenterResource + SiteRecoveryVCenterCollection collection = siteRecoveryFabric.GetSiteRecoveryVCenters(); + + // invoke the operation + string vCenterName = "esx-78"; + NullableResponse response = await collection.GetIfExistsAsync(vCenterName); + SiteRecoveryVCenterResource 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 + SiteRecoveryVCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Add vCenter. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryVaultSettingCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryVaultSettingCollection.cs index c02eee400a55..414e588aa3b5 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryVaultSettingCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_SiteRecoveryVaultSettingCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetsTheVaultSetting() Console.WriteLine($"Succeeded: {result}"); } + // Gets the vault setting. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheVaultSetting() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_Get.json + // this example is just showing the usage of "ReplicationVaultSetting_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 = "c183865e-6077-46f2-a3b1-deb0f4f4650a"; + string resourceGroupName = "resourceGroupPS1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteRecoveryVaultSettingResource + string resourceName = "vault1"; + SiteRecoveryVaultSettingCollection collection = resourceGroupResource.GetSiteRecoveryVaultSettings(resourceName); + + // invoke the operation + string vaultSettingName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(vaultSettingName); + SiteRecoveryVaultSettingResource 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 + SiteRecoveryVaultSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Updates vault setting. A vault setting object is a singleton per vault and it is always present by default. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_StorageClassificationCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_StorageClassificationCollection.cs index 1967ddc56c60..0268641c93bd 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_StorageClassificationCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_StorageClassificationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetsTheDetailsOfAStorageClassification() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the details of a storage classification. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfAStorageClassification() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_Get.json + // this example is just showing the usage of "ReplicationStorageClassifications_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 SiteRecoveryFabricResource created on azure + // for more information of creating SiteRecoveryFabricResource, please refer to the document of SiteRecoveryFabricResource + string subscriptionId = "9112a37f-0f3e-46ec-9c00-060c6edca071"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0"; + ResourceIdentifier siteRecoveryFabricResourceId = SiteRecoveryFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName); + SiteRecoveryFabricResource siteRecoveryFabric = client.GetSiteRecoveryFabricResource(siteRecoveryFabricResourceId); + + // get the collection of this StorageClassificationResource + StorageClassificationCollection collection = siteRecoveryFabric.GetStorageClassifications(); + + // invoke the operation + string storageClassificationName = "8891569e-aaef-4a46-a4a0-78c14f2d7b09"; + NullableResponse response = await collection.GetIfExistsAsync(storageClassificationName); + StorageClassificationResource 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 + StorageClassificationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_StorageClassificationMappingCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_StorageClassificationMappingCollection.cs index f14c85637bd0..831742ca9b63 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_StorageClassificationMappingCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/samples/Generated/Samples/Sample_StorageClassificationMappingCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_GetsTheDetailsOfAStorageClassificationMapping() Console.WriteLine($"Succeeded: {result}"); } + // Gets the details of a storage classification mapping. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDetailsOfAStorageClassificationMapping() + { + // Generated from example definition: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Get.json + // this example is just showing the usage of "ReplicationStorageClassificationMappings_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 StorageClassificationResource created on azure + // for more information of creating StorageClassificationResource, please refer to the document of StorageClassificationResource + string subscriptionId = "9112a37f-0f3e-46ec-9c00-060c6edca071"; + string resourceGroupName = "resourceGroupPS1"; + string resourceName = "vault1"; + string fabricName = "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0"; + string storageClassificationName = "8891569e-aaef-4a46-a4a0-78c14f2d7b09"; + ResourceIdentifier storageClassificationResourceId = StorageClassificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, fabricName, storageClassificationName); + StorageClassificationResource storageClassification = client.GetStorageClassificationResource(storageClassificationResourceId); + + // get the collection of this StorageClassificationMappingResource + StorageClassificationMappingCollection collection = storageClassification.GetStorageClassificationMappings(); + + // invoke the operation + string storageClassificationMappingName = "testStorageMapping"; + NullableResponse response = await collection.GetIfExistsAsync(storageClassificationMappingName); + StorageClassificationMappingResource 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 + StorageClassificationMappingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create storage classification mapping. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/MigrationRecoveryPointCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/MigrationRecoveryPointCollection.cs index 2e147f8659fa..5f710920e163 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/MigrationRecoveryPointCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/MigrationRecoveryPointCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string migrationRecoveryPointName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName} + /// + /// + /// Operation Id + /// MigrationRecoveryPoints_Get + /// + /// + /// + /// The migration recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string migrationRecoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(migrationRecoveryPointName, nameof(migrationRecoveryPointName)); + + using var scope = _migrationRecoveryPointClientDiagnostics.CreateScope("MigrationRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _migrationRecoveryPointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, migrationRecoveryPointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MigrationRecoveryPointResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName} + /// + /// + /// Operation Id + /// MigrationRecoveryPoints_Get + /// + /// + /// + /// The migration recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string migrationRecoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(migrationRecoveryPointName, nameof(migrationRecoveryPointName)); + + using var scope = _migrationRecoveryPointClientDiagnostics.CreateScope("MigrationRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _migrationRecoveryPointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, migrationRecoveryPointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MigrationRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ProtectionContainerMappingCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ProtectionContainerMappingCollection.cs index 96ef9069f77e..532bafa4c56a 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ProtectionContainerMappingCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ProtectionContainerMappingCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string mappingName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName} + /// + /// + /// Operation Id + /// ReplicationProtectionContainerMappings_Get + /// + /// + /// + /// Protection Container mapping name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string mappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mappingName, nameof(mappingName)); + + using var scope = _protectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics.CreateScope("ProtectionContainerMappingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _protectionContainerMappingReplicationProtectionContainerMappingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, mappingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProtectionContainerMappingResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName} + /// + /// + /// Operation Id + /// ReplicationProtectionContainerMappings_Get + /// + /// + /// + /// Protection Container mapping name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string mappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mappingName, nameof(mappingName)); + + using var scope = _protectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics.CreateScope("ProtectionContainerMappingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _protectionContainerMappingReplicationProtectionContainerMappingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, mappingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProtectionContainerMappingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationEligibilityResultCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationEligibilityResultCollection.cs index 57f5590b1785..eb156ce52552 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationEligibilityResultCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationEligibilityResultCollection.cs @@ -225,6 +225,70 @@ public virtual Response Exists(CancellationToken cancellationToken = defau } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default + /// + /// + /// Operation Id + /// ReplicationEligibilityResults_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(CancellationToken cancellationToken = default) + { + using var scope = _replicationEligibilityResultClientDiagnostics.CreateScope("ReplicationEligibilityResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _replicationEligibilityResultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _virtualMachineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReplicationEligibilityResultResource(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.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default + /// + /// + /// Operation Id + /// ReplicationEligibilityResults_Get + /// + /// + /// + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(CancellationToken cancellationToken = default) + { + using var scope = _replicationEligibilityResultClientDiagnostics.CreateScope("ReplicationEligibilityResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _replicationEligibilityResultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _virtualMachineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReplicationEligibilityResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemCollection.cs index b6beba860e9a..3d362bd68d43 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string replicatedProtectedItemName, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName} + /// + /// + /// Operation Id + /// ReplicationProtectedItems_Get + /// + /// + /// + /// Replication protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string replicatedProtectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicatedProtectedItemName, nameof(replicatedProtectedItemName)); + + using var scope = _replicationProtectedItemClientDiagnostics.CreateScope("ReplicationProtectedItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _replicationProtectedItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, replicatedProtectedItemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReplicationProtectedItemResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName} + /// + /// + /// Operation Id + /// ReplicationProtectedItems_Get + /// + /// + /// + /// Replication protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string replicatedProtectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicatedProtectedItemName, nameof(replicatedProtectedItemName)); + + using var scope = _replicationProtectedItemClientDiagnostics.CreateScope("ReplicationProtectedItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _replicationProtectedItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, replicatedProtectedItemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReplicationProtectedItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectionIntentCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectionIntentCollection.cs index 7119187ac48e..da1788d18ab6 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectionIntentCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectionIntentCollection.cs @@ -334,6 +334,80 @@ public virtual Response Exists(string intentObjectName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName} + /// + /// + /// Operation Id + /// ReplicationProtectionIntents_Get + /// + /// + /// + /// Replication protection intent name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string intentObjectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(intentObjectName, nameof(intentObjectName)); + + using var scope = _replicationProtectionIntentClientDiagnostics.CreateScope("ReplicationProtectionIntentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _replicationProtectionIntentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, intentObjectName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReplicationProtectionIntentResource(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.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName} + /// + /// + /// Operation Id + /// ReplicationProtectionIntents_Get + /// + /// + /// + /// Replication protection intent name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string intentObjectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(intentObjectName, nameof(intentObjectName)); + + using var scope = _replicationProtectionIntentClientDiagnostics.CreateScope("ReplicationProtectionIntentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _replicationProtectionIntentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, intentObjectName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReplicationProtectionIntentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryAlertCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryAlertCollection.cs index b3cae6d18b1d..3dbfc0f9fc2c 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryAlertCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryAlertCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string alertSettingName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName} + /// + /// + /// Operation Id + /// ReplicationAlertSettings_Get + /// + /// + /// + /// The name of the email notification configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string alertSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertSettingName, nameof(alertSettingName)); + + using var scope = _siteRecoveryAlertReplicationAlertSettingsClientDiagnostics.CreateScope("SiteRecoveryAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryAlertReplicationAlertSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, alertSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryAlertResource(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.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName} + /// + /// + /// Operation Id + /// ReplicationAlertSettings_Get + /// + /// + /// + /// The name of the email notification configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string alertSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertSettingName, nameof(alertSettingName)); + + using var scope = _siteRecoveryAlertReplicationAlertSettingsClientDiagnostics.CreateScope("SiteRecoveryAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryAlertReplicationAlertSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, alertSettingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryEventCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryEventCollection.cs index d18b75e25c18..465aa0a3f6c7 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryEventCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryEventCollection.cs @@ -249,6 +249,80 @@ public virtual Response Exists(string eventName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName} + /// + /// + /// Operation Id + /// ReplicationEvents_Get + /// + /// + /// + /// The name of the Azure Site Recovery event. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var scope = _siteRecoveryEventReplicationEventsClientDiagnostics.CreateScope("SiteRecoveryEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryEventReplicationEventsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, eventName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryEventResource(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.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName} + /// + /// + /// Operation Id + /// ReplicationEvents_Get + /// + /// + /// + /// The name of the Azure Site Recovery event. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var scope = _siteRecoveryEventReplicationEventsClientDiagnostics.CreateScope("SiteRecoveryEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryEventReplicationEventsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, eventName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricCollection.cs index c554e95a2f20..804ca38ead98 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricCollection.cs @@ -334,6 +334,82 @@ public virtual Response Exists(string fabricName, string filter = null, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// ReplicationFabrics_Get + /// + /// + /// + /// Fabric name. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string fabricName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = _siteRecoveryFabricReplicationFabricsClientDiagnostics.CreateScope("SiteRecoveryFabricCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryFabricReplicationFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, fabricName, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryFabricResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// ReplicationFabrics_Get + /// + /// + /// + /// Fabric name. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fabricName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = _siteRecoveryFabricReplicationFabricsClientDiagnostics.CreateScope("SiteRecoveryFabricCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryFabricReplicationFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, fabricName, filter, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryFabricResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryJobCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryJobCollection.cs index 34222f8055c9..1d00d5f30520 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryJobCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryJobCollection.cs @@ -249,6 +249,80 @@ public virtual Response Exists(string jobName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName} + /// + /// + /// Operation Id + /// ReplicationJobs_Get + /// + /// + /// + /// Job identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _siteRecoveryJobReplicationJobsClientDiagnostics.CreateScope("SiteRecoveryJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryJobReplicationJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, jobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryJobResource(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.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName} + /// + /// + /// Operation Id + /// ReplicationJobs_Get + /// + /// + /// + /// Job identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _siteRecoveryJobReplicationJobsClientDiagnostics.CreateScope("SiteRecoveryJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryJobReplicationJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, jobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryLogicalNetworkCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryLogicalNetworkCollection.cs index 4a22cfd3c59f..20a8d92ab62d 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryLogicalNetworkCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryLogicalNetworkCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string logicalNetworkName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName} + /// + /// + /// Operation Id + /// ReplicationLogicalNetworks_Get + /// + /// + /// + /// Logical network name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string logicalNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(logicalNetworkName, nameof(logicalNetworkName)); + + using var scope = _siteRecoveryLogicalNetworkReplicationLogicalNetworksClientDiagnostics.CreateScope("SiteRecoveryLogicalNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryLogicalNetworkReplicationLogicalNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, logicalNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryLogicalNetworkResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName} + /// + /// + /// Operation Id + /// ReplicationLogicalNetworks_Get + /// + /// + /// + /// Logical network name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string logicalNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(logicalNetworkName, nameof(logicalNetworkName)); + + using var scope = _siteRecoveryLogicalNetworkReplicationLogicalNetworksClientDiagnostics.CreateScope("SiteRecoveryLogicalNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryLogicalNetworkReplicationLogicalNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, logicalNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryLogicalNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemCollection.cs index 927540a8dbf7..93c632a034d1 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string migrationItemName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName} + /// + /// + /// Operation Id + /// ReplicationMigrationItems_Get + /// + /// + /// + /// Migration item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string migrationItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(migrationItemName, nameof(migrationItemName)); + + using var scope = _siteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics.CreateScope("SiteRecoveryMigrationItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryMigrationItemReplicationMigrationItemsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, migrationItemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryMigrationItemResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName} + /// + /// + /// Operation Id + /// ReplicationMigrationItems_Get + /// + /// + /// + /// Migration item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string migrationItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(migrationItemName, nameof(migrationItemName)); + + using var scope = _siteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics.CreateScope("SiteRecoveryMigrationItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryMigrationItemReplicationMigrationItemsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, migrationItemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryMigrationItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkCollection.cs index 052f6319bf86..89fec2bee6ed 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string networkName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName} + /// + /// + /// Operation Id + /// ReplicationNetworks_Get + /// + /// + /// + /// Primary network name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkName, nameof(networkName)); + + using var scope = _siteRecoveryNetworkReplicationNetworksClientDiagnostics.CreateScope("SiteRecoveryNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryNetworkReplicationNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryNetworkResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName} + /// + /// + /// Operation Id + /// ReplicationNetworks_Get + /// + /// + /// + /// Primary network name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkName, nameof(networkName)); + + using var scope = _siteRecoveryNetworkReplicationNetworksClientDiagnostics.CreateScope("SiteRecoveryNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryNetworkReplicationNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkMappingCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkMappingCollection.cs index 34d39f2ff5ee..6099105ddf60 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkMappingCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkMappingCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string networkMappingName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName} + /// + /// + /// Operation Id + /// ReplicationNetworkMappings_Get + /// + /// + /// + /// Network mapping name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkMappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkMappingName, nameof(networkMappingName)); + + using var scope = _siteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics.CreateScope("SiteRecoveryNetworkMappingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkMappingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryNetworkMappingResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName} + /// + /// + /// Operation Id + /// ReplicationNetworkMappings_Get + /// + /// + /// + /// Network mapping name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkMappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkMappingName, nameof(networkMappingName)); + + using var scope = _siteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics.CreateScope("SiteRecoveryNetworkMappingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkMappingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryNetworkMappingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPointCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPointCollection.cs index fe4bb00e2251..b20e7aea573e 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPointCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPointCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string recoveryPointName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var scope = _siteRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("SiteRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryPointRecoveryPointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, recoveryPointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryPointResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var scope = _siteRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("SiteRecoveryPointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryPointRecoveryPointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, recoveryPointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPolicyCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPolicyCollection.cs index f6fd6ac29cb1..a202b5781614 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPolicyCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPolicyCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string policyName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// ReplicationPolicies_Get + /// + /// + /// + /// Replication policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _siteRecoveryPolicyReplicationPoliciesClientDiagnostics.CreateScope("SiteRecoveryPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryPolicyReplicationPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryPolicyResource(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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// ReplicationPolicies_Get + /// + /// + /// + /// Replication policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _siteRecoveryPolicyReplicationPoliciesClientDiagnostics.CreateScope("SiteRecoveryPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryPolicyReplicationPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectableItemCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectableItemCollection.cs index bbad7152d555..844f9075f584 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectableItemCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectableItemCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string protectableItemName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName} + /// + /// + /// Operation Id + /// ReplicationProtectableItems_Get + /// + /// + /// + /// Protectable item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string protectableItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectableItemName, nameof(protectableItemName)); + + using var scope = _siteRecoveryProtectableItemReplicationProtectableItemsClientDiagnostics.CreateScope("SiteRecoveryProtectableItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryProtectableItemReplicationProtectableItemsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, protectableItemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryProtectableItemResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName} + /// + /// + /// Operation Id + /// ReplicationProtectableItems_Get + /// + /// + /// + /// Protectable item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string protectableItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectableItemName, nameof(protectableItemName)); + + using var scope = _siteRecoveryProtectableItemReplicationProtectableItemsClientDiagnostics.CreateScope("SiteRecoveryProtectableItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryProtectableItemReplicationProtectableItemsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, protectableItemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryProtectableItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerCollection.cs index 145f18689b3d..8e68603c9d0d 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string protectionContainerName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName} + /// + /// + /// Operation Id + /// ReplicationProtectionContainers_Get + /// + /// + /// + /// Protection container name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string protectionContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectionContainerName, nameof(protectionContainerName)); + + using var scope = _siteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics.CreateScope("SiteRecoveryProtectionContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryProtectionContainerReplicationProtectionContainersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, protectionContainerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryProtectionContainerResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName} + /// + /// + /// Operation Id + /// ReplicationProtectionContainers_Get + /// + /// + /// + /// Protection container name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string protectionContainerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectionContainerName, nameof(protectionContainerName)); + + using var scope = _siteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics.CreateScope("SiteRecoveryProtectionContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryProtectionContainerReplicationProtectionContainersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, protectionContainerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryProtectionContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryRecoveryPlanCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryRecoveryPlanCollection.cs index ca4d4a050462..9e53869d5762 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryRecoveryPlanCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryRecoveryPlanCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string recoveryPlanName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName} + /// + /// + /// Operation Id + /// ReplicationRecoveryPlans_Get + /// + /// + /// + /// Name of the recovery plan. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recoveryPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPlanName, nameof(recoveryPlanName)); + + using var scope = _siteRecoveryRecoveryPlanReplicationRecoveryPlansClientDiagnostics.CreateScope("SiteRecoveryRecoveryPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryRecoveryPlanReplicationRecoveryPlansRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, recoveryPlanName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryRecoveryPlanResource(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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName} + /// + /// + /// Operation Id + /// ReplicationRecoveryPlans_Get + /// + /// + /// + /// Name of the recovery plan. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recoveryPlanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPlanName, nameof(recoveryPlanName)); + + using var scope = _siteRecoveryRecoveryPlanReplicationRecoveryPlansClientDiagnostics.CreateScope("SiteRecoveryRecoveryPlanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryRecoveryPlanReplicationRecoveryPlansRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, recoveryPlanName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryRecoveryPlanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryServicesProviderCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryServicesProviderCollection.cs index 5b5105ff3de8..1a48b8d5311c 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryServicesProviderCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryServicesProviderCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string providerName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName} + /// + /// + /// Operation Id + /// ReplicationRecoveryServicesProviders_Get + /// + /// + /// + /// Recovery services provider name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string providerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + + using var scope = _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics.CreateScope("SiteRecoveryServicesProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, providerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryServicesProviderResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName} + /// + /// + /// Operation Id + /// ReplicationRecoveryServicesProviders_Get + /// + /// + /// + /// Recovery services provider name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string providerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + + using var scope = _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics.CreateScope("SiteRecoveryServicesProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, providerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryServicesProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVCenterCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVCenterCollection.cs index 60c5b0564226..3c16020e5da9 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVCenterCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVCenterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string vCenterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName} + /// + /// + /// Operation Id + /// ReplicationvCenters_Get + /// + /// + /// + /// vcenter name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vCenterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vCenterName, nameof(vCenterName)); + + using var scope = _siteRecoveryVCenterReplicationvCentersClientDiagnostics.CreateScope("SiteRecoveryVCenterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryVCenterReplicationvCentersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vCenterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryVCenterResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName} + /// + /// + /// Operation Id + /// ReplicationvCenters_Get + /// + /// + /// + /// vcenter name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vCenterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vCenterName, nameof(vCenterName)); + + using var scope = _siteRecoveryVCenterReplicationvCentersClientDiagnostics.CreateScope("SiteRecoveryVCenterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryVCenterReplicationvCentersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vCenterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryVCenterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVaultSettingCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVaultSettingCollection.cs index 1d6490f4e248..231af92b7732 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVaultSettingCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVaultSettingCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string vaultSettingName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName} + /// + /// + /// Operation Id + /// ReplicationVaultSetting_Get + /// + /// + /// + /// Vault setting name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vaultSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultSettingName, nameof(vaultSettingName)); + + using var scope = _siteRecoveryVaultSettingReplicationVaultSettingClientDiagnostics.CreateScope("SiteRecoveryVaultSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRecoveryVaultSettingReplicationVaultSettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, vaultSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryVaultSettingResource(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.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName} + /// + /// + /// Operation Id + /// ReplicationVaultSetting_Get + /// + /// + /// + /// Vault setting name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vaultSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultSettingName, nameof(vaultSettingName)); + + using var scope = _siteRecoveryVaultSettingReplicationVaultSettingClientDiagnostics.CreateScope("SiteRecoveryVaultSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRecoveryVaultSettingReplicationVaultSettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceName, vaultSettingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteRecoveryVaultSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationCollection.cs index 9adfc18524e2..bf743ec14627 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string storageClassificationName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName} + /// + /// + /// Operation Id + /// ReplicationStorageClassifications_Get + /// + /// + /// + /// Storage classification name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageClassificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageClassificationName, nameof(storageClassificationName)); + + using var scope = _storageClassificationReplicationStorageClassificationsClientDiagnostics.CreateScope("StorageClassificationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageClassificationReplicationStorageClassificationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, storageClassificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageClassificationResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName} + /// + /// + /// Operation Id + /// ReplicationStorageClassifications_Get + /// + /// + /// + /// Storage classification name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageClassificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageClassificationName, nameof(storageClassificationName)); + + using var scope = _storageClassificationReplicationStorageClassificationsClientDiagnostics.CreateScope("StorageClassificationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageClassificationReplicationStorageClassificationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, storageClassificationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageClassificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationMappingCollection.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationMappingCollection.cs index 4258e7ffba1a..bcee7cf8f09c 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationMappingCollection.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationMappingCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string storageClassificationMappingName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName} + /// + /// + /// Operation Id + /// ReplicationStorageClassificationMappings_Get + /// + /// + /// + /// Storage classification mapping name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageClassificationMappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageClassificationMappingName, nameof(storageClassificationMappingName)); + + using var scope = _storageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics.CreateScope("StorageClassificationMappingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _storageClassificationMappingReplicationStorageClassificationMappingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, storageClassificationMappingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageClassificationMappingResource(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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName} + /// + /// + /// Operation Id + /// ReplicationStorageClassificationMappings_Get + /// + /// + /// + /// Storage classification mapping name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageClassificationMappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageClassificationMappingName, nameof(storageClassificationMappingName)); + + using var scope = _storageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics.CreateScope("StorageClassificationMappingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _storageClassificationMappingReplicationStorageClassificationMappingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, storageClassificationMappingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new StorageClassificationMappingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/samples/Generated/Samples/Sample_RecoveryServicesPrivateLinkResourceCollection.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/samples/Generated/Samples/Sample_RecoveryServicesPrivateLinkResourceCollection.cs index 494942ab02f0..fc9d7e352583 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/samples/Generated/Samples/Sample_RecoveryServicesPrivateLinkResourceCollection.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/samples/Generated/Samples/Sample_RecoveryServicesPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetPrivateLinkResource() Console.WriteLine($"Succeeded: {result}"); } + + // Get PrivateLinkResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPrivateLinkResource() + { + // Generated from example definition: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/GetPrivateLinkResources.json + // this example is just showing the usage of "PrivateLinkResources_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 RecoveryServicesVaultResource created on azure + // for more information of creating RecoveryServicesVaultResource, please refer to the document of RecoveryServicesVaultResource + string subscriptionId = "6c48fa17-39c7-45f1-90ac-47a587128ace"; + string resourceGroupName = "petesting"; + string vaultName = "pemsi-ecy-rsv2"; + ResourceIdentifier recoveryServicesVaultResourceId = RecoveryServicesVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + RecoveryServicesVaultResource recoveryServicesVault = client.GetRecoveryServicesVaultResource(recoveryServicesVaultResourceId); + + // get the collection of this RecoveryServicesPrivateLinkResource + RecoveryServicesPrivateLinkResourceCollection collection = recoveryServicesVault.GetRecoveryServicesPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "backupResource"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + RecoveryServicesPrivateLinkResource 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 + RecoveryServicesPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/samples/Generated/Samples/Sample_RecoveryServicesVaultCollection.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/samples/Generated/Samples/Sample_RecoveryServicesVaultCollection.cs index 00a400dc7a72..1d68e3c5f774 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/samples/Generated/Samples/Sample_RecoveryServicesVaultCollection.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/samples/Generated/Samples/Sample_RecoveryServicesVaultCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetRecoveryServicesResource() Console.WriteLine($"Succeeded: {result}"); } + // Get Recovery Services Resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRecoveryServicesResource() + { + // Generated from example definition: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2023-04-01/examples/GETVault.json + // this example is just showing the usage of "Vaults_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 = "77777777-b0c6-47a2-b37c-d8e65a629c18"; + string resourceGroupName = "Default-RecoveryServices-ResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RecoveryServicesVaultResource + RecoveryServicesVaultCollection collection = resourceGroupResource.GetRecoveryServicesVaults(); + + // invoke the operation + string vaultName = "swaggerExample"; + NullableResponse response = await collection.GetIfExistsAsync(vaultName); + RecoveryServicesVaultResource 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 + RecoveryServicesVaultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Recovery Services vault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesPrivateLinkResourceCollection.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesPrivateLinkResourceCollection.cs index d50d8d76804c..62f6c6c2554c 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesPrivateLinkResourceCollection.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesPrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _recoveryServicesPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("RecoveryServicesPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _recoveryServicesPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecoveryServicesPrivateLinkResource(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.RecoveryServices/vaults/{vaultName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _recoveryServicesPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("RecoveryServicesPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _recoveryServicesPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecoveryServicesPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultCollection.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultCollection.cs index 837ba8ce27bd..65e8cb6bc79f 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultCollection.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string vaultName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _recoveryServicesVaultVaultsClientDiagnostics.CreateScope("RecoveryServicesVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _recoveryServicesVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecoveryServicesVaultResource(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.RecoveryServices/vaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _recoveryServicesVaultVaultsClientDiagnostics.CreateScope("RecoveryServicesVaultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _recoveryServicesVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecoveryServicesVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCollection.cs index 127c2880eb1e..72ed416e5c8f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCollection.cs @@ -242,6 +242,48 @@ public async Task Exists_RedisCacheGet() Console.WriteLine($"Succeeded: {result}"); } + // RedisCacheGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisCacheGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGet.json + // this example is just showing the usage of "Redis_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RedisResource + RedisCollection collection = resourceGroupResource.GetAllRedis(); + + // invoke the operation + string name = "cache1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + RedisResource 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 + RedisData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RedisCacheListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleCollection.cs index e51ecd76aa9b..872a62c385d3 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleCollection.cs @@ -157,5 +157,48 @@ public async Task Exists_RedisCacheFirewallRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // RedisCacheFirewallRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisCacheFirewallRuleGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleGet.json + // this example is just showing the usage of "FirewallRules_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 RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisFirewallRuleResource + RedisFirewallRuleCollection collection = redis.GetRedisFirewallRules(); + + // invoke the operation + string ruleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + RedisFirewallRuleResource 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 + RedisFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs index a5e35ad0ae16..eb07929033c4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_LinkedServerGet() Console.WriteLine($"Succeeded: {result}"); } + // LinkedServer_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LinkedServerGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Get.json + // this example is just showing the usage of "LinkedServer_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 RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string name = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisLinkedServerWithPropertyResource + RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); + + // invoke the operation + string linkedServerName = "cache2"; + NullableResponse response = await collection.GetIfExistsAsync(linkedServerName); + RedisLinkedServerWithPropertyResource 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 + RedisLinkedServerWithPropertyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // LinkedServer_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleCollection.cs index 4cd2287edd58..1267d22c1cae 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleCollection.cs @@ -164,5 +164,48 @@ public async Task Exists_RedisCachePatchSchedulesGet() Console.WriteLine($"Succeeded: {result}"); } + + // RedisCachePatchSchedulesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisCachePatchSchedulesGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesGet.json + // this example is just showing the usage of "PatchSchedules_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 RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string name = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisPatchScheduleResource + RedisPatchScheduleCollection collection = redis.GetRedisPatchSchedules(); + + // invoke the operation + RedisPatchScheduleDefaultName defaultName = RedisPatchScheduleDefaultName.Default; + NullableResponse response = await collection.GetIfExistsAsync(defaultName); + RedisPatchScheduleResource 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 + RedisPatchScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs index a2c395f6169f..b516489965d0 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_RedisCacheGetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // RedisCacheGetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisCacheGetPrivateEndpointConnection() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "rgtest01"; + string cacheName = "cachetest01"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisPrivateEndpointConnectionResource + RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "pectest01"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + RedisPrivateEndpointConnectionResource 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 + RedisPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RedisCachePutPrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs index d00d1aa0308d..25498988c56e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name} + /// + /// + /// Operation Id + /// Redis_Get + /// + /// + /// + /// The name of the Redis cache. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisResource(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.Cache/redis/{name} + /// + /// + /// Operation Id + /// Redis_Get + /// + /// + /// + /// The name of the Redis cache. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleCollection.cs index 3566c61fb79e..a414cd42420c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisFirewallRuleResource(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.Cache/redis/{cacheName}/firewallRules/{ruleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyCollection.cs index 52431b1fe456..c21f41647997 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string linkedServerName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName} + /// + /// + /// Operation Id + /// LinkedServer_Get + /// + /// + /// + /// The name of the linked server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string linkedServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkedServerName, nameof(linkedServerName)); + + using var scope = _redisLinkedServerWithPropertyLinkedServerClientDiagnostics.CreateScope("RedisLinkedServerWithPropertyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisLinkedServerWithPropertyLinkedServerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkedServerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisLinkedServerWithPropertyResource(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.Cache/redis/{name}/linkedServers/{linkedServerName} + /// + /// + /// Operation Id + /// LinkedServer_Get + /// + /// + /// + /// The name of the linked server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkedServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkedServerName, nameof(linkedServerName)); + + using var scope = _redisLinkedServerWithPropertyLinkedServerClientDiagnostics.CreateScope("RedisLinkedServerWithPropertyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisLinkedServerWithPropertyLinkedServerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkedServerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisLinkedServerWithPropertyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs index 6451b7334670..b0289747ce66 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(RedisPatchScheduleDefaultName defaultName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default} + /// + /// + /// Operation Id + /// PatchSchedules_Get + /// + /// + /// + /// Default string modeled as parameter for auto generation to work correctly. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + { + using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisPatchSchedulePatchSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisPatchScheduleResource(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.Cache/redis/{name}/patchSchedules/{default} + /// + /// + /// Operation Id + /// PatchSchedules_Get + /// + /// + /// + /// Default string modeled as parameter for auto generation to work correctly. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + { + using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisPatchSchedulePatchSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisPatchScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionCollection.cs index 653ff140745c..6d43305df150 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _redisPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("RedisPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisPrivateEndpointConnectionResource(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.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _redisPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("RedisPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterpriseClusterCollection.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterpriseClusterCollection.cs index 808ddb97202e..658fb91e8380 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterpriseClusterCollection.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterpriseClusterCollection.cs @@ -150,6 +150,48 @@ public async Task Exists_RedisEnterpriseGet() Console.WriteLine($"Succeeded: {result}"); } + // RedisEnterpriseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisEnterpriseGet() + { + // Generated from example definition: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseGet.json + // this example is just showing the usage of "RedisEnterprise_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RedisEnterpriseClusterResource + RedisEnterpriseClusterCollection collection = resourceGroupResource.GetRedisEnterpriseClusters(); + + // invoke the operation + string clusterName = "cache1"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + RedisEnterpriseClusterResource 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 + RedisEnterpriseClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RedisEnterpriseListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterpriseDatabaseCollection.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterpriseDatabaseCollection.cs index 2813c2e6f2c7..e626250913a7 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterpriseDatabaseCollection.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterpriseDatabaseCollection.cs @@ -235,5 +235,48 @@ public async Task Exists_RedisEnterpriseDatabasesGet() Console.WriteLine($"Succeeded: {result}"); } + + // RedisEnterpriseDatabasesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisEnterpriseDatabasesGet() + { + // Generated from example definition: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesGet.json + // this example is just showing the usage of "Databases_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 RedisEnterpriseClusterResource created on azure + // for more information of creating RedisEnterpriseClusterResource, please refer to the document of RedisEnterpriseClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string clusterName = "cache1"; + ResourceIdentifier redisEnterpriseClusterResourceId = RedisEnterpriseClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + RedisEnterpriseClusterResource redisEnterpriseCluster = client.GetRedisEnterpriseClusterResource(redisEnterpriseClusterResourceId); + + // get the collection of this RedisEnterpriseDatabaseResource + RedisEnterpriseDatabaseCollection collection = redisEnterpriseCluster.GetRedisEnterpriseDatabases(); + + // invoke the operation + string databaseName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + RedisEnterpriseDatabaseResource 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 + RedisEnterpriseDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterprisePrivateEndpointConnectionCollection.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterprisePrivateEndpointConnectionCollection.cs index 92758c4f7304..5d7530f7d0d3 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterprisePrivateEndpointConnectionCollection.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/samples/Generated/Samples/Sample_RedisEnterprisePrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_RedisEnterpriseGetPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // RedisEnterpriseGetPrivateEndpointConnection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisEnterpriseGetPrivateEndpointConnection() + { + // Generated from example definition: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 RedisEnterpriseClusterResource created on azure + // for more information of creating RedisEnterpriseClusterResource, please refer to the document of RedisEnterpriseClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string clusterName = "cache1"; + ResourceIdentifier redisEnterpriseClusterResourceId = RedisEnterpriseClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + RedisEnterpriseClusterResource redisEnterpriseCluster = client.GetRedisEnterpriseClusterResource(redisEnterpriseClusterResourceId); + + // get the collection of this RedisEnterprisePrivateEndpointConnectionResource + RedisEnterprisePrivateEndpointConnectionCollection collection = redisEnterpriseCluster.GetRedisEnterprisePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "pectest01"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + RedisEnterprisePrivateEndpointConnectionResource 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 + RedisEnterprisePrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RedisEnterprisePutPrivateEndpointConnection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterCollection.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterCollection.cs index fefa67b777c4..f5199c62dfc2 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterCollection.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName} + /// + /// + /// Operation Id + /// RedisEnterprise_Get + /// + /// + /// + /// The name of the RedisEnterprise cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _redisEnterpriseClusterRedisEnterpriseClientDiagnostics.CreateScope("RedisEnterpriseClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisEnterpriseClusterRedisEnterpriseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisEnterpriseClusterResource(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.Cache/redisEnterprise/{clusterName} + /// + /// + /// Operation Id + /// RedisEnterprise_Get + /// + /// + /// + /// The name of the RedisEnterprise cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _redisEnterpriseClusterRedisEnterpriseClientDiagnostics.CreateScope("RedisEnterpriseClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisEnterpriseClusterRedisEnterpriseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisEnterpriseClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseDatabaseCollection.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseDatabaseCollection.cs index 9ceef0c405ec..c3e45fa07f2e 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseDatabaseCollection.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseDatabaseCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _redisEnterpriseDatabaseDatabasesClientDiagnostics.CreateScope("RedisEnterpriseDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisEnterpriseDatabaseDatabasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisEnterpriseDatabaseResource(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.Cache/redisEnterprise/{clusterName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _redisEnterpriseDatabaseDatabasesClientDiagnostics.CreateScope("RedisEnterpriseDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisEnterpriseDatabaseDatabasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisEnterpriseDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterprisePrivateEndpointConnectionCollection.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterprisePrivateEndpointConnectionCollection.cs index 4b05545273da..ba4235f72c0e 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterprisePrivateEndpointConnectionCollection.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterprisePrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _redisEnterprisePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("RedisEnterprisePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisEnterprisePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisEnterprisePrivateEndpointConnectionResource(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.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _redisEnterprisePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("RedisEnterprisePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisEnterprisePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisEnterprisePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayHybridConnectionAuthorizationRuleCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayHybridConnectionAuthorizationRuleCollection.cs index b667026b7e69..e3033573fdb9 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayHybridConnectionAuthorizationRuleCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayHybridConnectionAuthorizationRuleCollection.cs @@ -167,5 +167,49 @@ public async Task Exists_RelayHybridConnectionAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // RelayHybridConnectionAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RelayHybridConnectionAuthorizationRuleGet() + { + // Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/HybridConnection/RelayHybridConnectionAuthorizationRuleGet.json + // this example is just showing the usage of "HybridConnections_GetAuthorizationRule" 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 RelayHybridConnectionResource created on azure + // for more information of creating RelayHybridConnectionResource, please refer to the document of RelayHybridConnectionResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "resourcegroup"; + string namespaceName = "example-RelayNamespace-01"; + string hybridConnectionName = "example-Relay-Hybrid-01"; + ResourceIdentifier relayHybridConnectionResourceId = RelayHybridConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, hybridConnectionName); + RelayHybridConnectionResource relayHybridConnection = client.GetRelayHybridConnectionResource(relayHybridConnectionResourceId); + + // get the collection of this RelayHybridConnectionAuthorizationRuleResource + RelayHybridConnectionAuthorizationRuleCollection collection = relayHybridConnection.GetRelayHybridConnectionAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "example-RelayAuthRules-01"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + RelayHybridConnectionAuthorizationRuleResource 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 + RelayAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayHybridConnectionCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayHybridConnectionCollection.cs index ed0a2fecacfe..254fcc6558ea 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayHybridConnectionCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayHybridConnectionCollection.cs @@ -159,5 +159,48 @@ public async Task Exists_RelayHybridConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + + // RelayHybridConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RelayHybridConnectionGet() + { + // Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/HybridConnection/RelayHybridConnectionGet.json + // this example is just showing the usage of "HybridConnections_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 RelayNamespaceResource created on azure + // for more information of creating RelayNamespaceResource, please refer to the document of RelayNamespaceResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "resourcegroup"; + string namespaceName = "example-RelayNamespace-01"; + ResourceIdentifier relayNamespaceResourceId = RelayNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + RelayNamespaceResource relayNamespace = client.GetRelayNamespaceResource(relayNamespaceResourceId); + + // get the collection of this RelayHybridConnectionResource + RelayHybridConnectionCollection collection = relayNamespace.GetRelayHybridConnections(); + + // invoke the operation + string hybridConnectionName = "example-Relay-Hybrid-01"; + NullableResponse response = await collection.GetIfExistsAsync(hybridConnectionName); + RelayHybridConnectionResource 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 + RelayHybridConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayNamespaceAuthorizationRuleCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayNamespaceAuthorizationRuleCollection.cs index 8a73239ce222..da7c81d889d1 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayNamespaceAuthorizationRuleCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayNamespaceAuthorizationRuleCollection.cs @@ -163,5 +163,48 @@ public async Task Exists_RelayNameSpaceAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // RelayNameSpaceAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RelayNameSpaceAuthorizationRuleGet() + { + // Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/NameSpaces/RelayNameSpaceAuthorizationRuleGet.json + // this example is just showing the usage of "Namespaces_GetAuthorizationRule" 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 RelayNamespaceResource created on azure + // for more information of creating RelayNamespaceResource, please refer to the document of RelayNamespaceResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "resourcegroup"; + string namespaceName = "example-RelayNamespace-01"; + ResourceIdentifier relayNamespaceResourceId = RelayNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + RelayNamespaceResource relayNamespace = client.GetRelayNamespaceResource(relayNamespaceResourceId); + + // get the collection of this RelayNamespaceAuthorizationRuleResource + RelayNamespaceAuthorizationRuleCollection collection = relayNamespace.GetRelayNamespaceAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "example-RelayAuthRules-01"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + RelayNamespaceAuthorizationRuleResource 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 + RelayAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayNamespaceCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayNamespaceCollection.cs index 0436d95d8623..d322c159bf39 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayNamespaceCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayNamespaceCollection.cs @@ -165,5 +165,47 @@ public async Task Exists_RelayNameSpaceGet() Console.WriteLine($"Succeeded: {result}"); } + + // RelayNameSpaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RelayNameSpaceGet() + { + // Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/NameSpaces/RelayNameSpaceGet.json + // this example is just showing the usage of "Namespaces_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "RG-eg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RelayNamespaceResource + RelayNamespaceCollection collection = resourceGroupResource.GetRelayNamespaces(); + + // invoke the operation + string namespaceName = "example-RelayRelayNamespace-01"; + NullableResponse response = await collection.GetIfExistsAsync(namespaceName); + RelayNamespaceResource 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 + RelayNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayPrivateEndpointConnectionCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayPrivateEndpointConnectionCollection.cs index 8b4f65b794f2..24a10bb17b7f 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayPrivateEndpointConnectionCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayPrivateEndpointConnectionCollection.cs @@ -165,5 +165,48 @@ public async Task Exists_NameSpacePrivateEndPointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + + // NameSpacePrivateEndPointConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpacePrivateEndPointConnectionGet() + { + // Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/PrivateEndpointConnections/PrivateEndpointConnectionsGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 RelayNamespaceResource created on azure + // for more information of creating RelayNamespaceResource, please refer to the document of RelayNamespaceResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "myResourceGroup"; + string namespaceName = "example-RelayNamespace-5849"; + ResourceIdentifier relayNamespaceResourceId = RelayNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + RelayNamespaceResource relayNamespace = client.GetRelayNamespaceResource(relayNamespaceResourceId); + + // get the collection of this RelayPrivateEndpointConnectionResource + RelayPrivateEndpointConnectionCollection collection = relayNamespace.GetRelayPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "{privateEndpointConnection name}"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + RelayPrivateEndpointConnectionResource 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 + RelayPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayPrivateLinkResourceCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayPrivateLinkResourceCollection.cs index c987879e0f18..863b5aa1147c 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayPrivateLinkResourceCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_RelayPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_NameSpacePrivateEndPointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // NameSpacePrivateEndPointConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpacePrivateEndPointConnectionGet() + { + // Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/PrivateEndpointConnections/PrivateLinkResourcesGet.json + // this example is just showing the usage of "PrivateLinkResources_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 RelayNamespaceResource created on azure + // for more information of creating RelayNamespaceResource, please refer to the document of RelayNamespaceResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "resourcegroup"; + string namespaceName = "example-RelayNamespace-5849"; + ResourceIdentifier relayNamespaceResourceId = RelayNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + RelayNamespaceResource relayNamespace = client.GetRelayNamespaceResource(relayNamespaceResourceId); + + // get the collection of this RelayPrivateLinkResource + RelayPrivateLinkResourceCollection collection = relayNamespace.GetRelayPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "{PrivateLinkResource name}"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + RelayPrivateLinkResource 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 + RelayPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // NameSpacePrivateLinkResourcesGet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_WcfRelayAuthorizationRuleCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_WcfRelayAuthorizationRuleCollection.cs index 36e69ba54dca..55fe6ad42be6 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_WcfRelayAuthorizationRuleCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_WcfRelayAuthorizationRuleCollection.cs @@ -167,5 +167,49 @@ public async Task Exists_RelayAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // RelayAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RelayAuthorizationRuleGet() + { + // Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/Relay/RelayAuthorizationRuleGet.json + // this example is just showing the usage of "WCFRelays_GetAuthorizationRule" 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 WcfRelayResource created on azure + // for more information of creating WcfRelayResource, please refer to the document of WcfRelayResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "resourcegroup"; + string namespaceName = "example-RelayNamespace-01"; + string relayName = "example-Relay-wcf-01"; + ResourceIdentifier wcfRelayResourceId = WcfRelayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, relayName); + WcfRelayResource wcfRelay = client.GetWcfRelayResource(wcfRelayResourceId); + + // get the collection of this WcfRelayAuthorizationRuleResource + WcfRelayAuthorizationRuleCollection collection = wcfRelay.GetWcfRelayAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "example-RelayAuthRules-01"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + WcfRelayAuthorizationRuleResource 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 + RelayAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_WcfRelayCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_WcfRelayCollection.cs index bc61538ee6f9..751ee3fd8777 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_WcfRelayCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/samples/Generated/Samples/Sample_WcfRelayCollection.cs @@ -162,5 +162,48 @@ public async Task Exists_RelayGet() Console.WriteLine($"Succeeded: {result}"); } + + // RelayGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RelayGet() + { + // Generated from example definition: specification/relay/resource-manager/Microsoft.Relay/stable/2021-11-01/examples/Relay/RelayGet.json + // this example is just showing the usage of "WCFRelays_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 RelayNamespaceResource created on azure + // for more information of creating RelayNamespaceResource, please refer to the document of RelayNamespaceResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "resourcegroup"; + string namespaceName = "example-RelayNamespace-9953"; + ResourceIdentifier relayNamespaceResourceId = RelayNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + RelayNamespaceResource relayNamespace = client.GetRelayNamespaceResource(relayNamespaceResourceId); + + // get the collection of this WcfRelayResource + WcfRelayCollection collection = relayNamespace.GetWcfRelays(); + + // invoke the operation + string relayName = "example-Relay-Wcf-1194"; + NullableResponse response = await collection.GetIfExistsAsync(relayName); + WcfRelayResource 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 + WcfRelayData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionAuthorizationRuleCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionAuthorizationRuleCollection.cs index 3f515bde8b42..5538b912e40b 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionAuthorizationRuleCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionAuthorizationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// HybridConnections_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _relayHybridConnectionAuthorizationRuleHybridConnectionsClientDiagnostics.CreateScope("RelayHybridConnectionAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _relayHybridConnectionAuthorizationRuleHybridConnectionsRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayHybridConnectionAuthorizationRuleResource(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.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// HybridConnections_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _relayHybridConnectionAuthorizationRuleHybridConnectionsClientDiagnostics.CreateScope("RelayHybridConnectionAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _relayHybridConnectionAuthorizationRuleHybridConnectionsRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayHybridConnectionAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionCollection.cs index 9a414e70833f..b0a24c015373 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string hybridConnectionName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName} + /// + /// + /// Operation Id + /// HybridConnections_Get + /// + /// + /// + /// The hybrid connection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hybridConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hybridConnectionName, nameof(hybridConnectionName)); + + using var scope = _relayHybridConnectionHybridConnectionsClientDiagnostics.CreateScope("RelayHybridConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _relayHybridConnectionHybridConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hybridConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayHybridConnectionResource(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.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName} + /// + /// + /// Operation Id + /// HybridConnections_Get + /// + /// + /// + /// The hybrid connection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hybridConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hybridConnectionName, nameof(hybridConnectionName)); + + using var scope = _relayHybridConnectionHybridConnectionsClientDiagnostics.CreateScope("RelayHybridConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _relayHybridConnectionHybridConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hybridConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayHybridConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceAuthorizationRuleCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceAuthorizationRuleCollection.cs index cba21973192f..29b809168840 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceAuthorizationRuleCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceAuthorizationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _relayNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("RelayNamespaceAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _relayNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayNamespaceAuthorizationRuleResource(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.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// Namespaces_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _relayNamespaceAuthorizationRuleNamespacesClientDiagnostics.CreateScope("RelayNamespaceAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _relayNamespaceAuthorizationRuleNamespacesRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceCollection.cs index 4269a2b46a8d..909d018ec7d8 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string namespaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _relayNamespaceNamespacesClientDiagnostics.CreateScope("RelayNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _relayNamespaceNamespacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayNamespaceResource(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.Relay/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _relayNamespaceNamespacesClientDiagnostics.CreateScope("RelayNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _relayNamespaceNamespacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayNamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateEndpointConnectionCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateEndpointConnectionCollection.cs index d98838184c1d..73a6f719c208 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateEndpointConnectionCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The PrivateEndpointConnection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _relayPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("RelayPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _relayPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayPrivateEndpointConnectionResource(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.Relay/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The PrivateEndpointConnection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _relayPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("RelayPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _relayPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateLinkResourceCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateLinkResourceCollection.cs index 6a914a30264a..11375bd107a7 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateLinkResourceCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The PrivateLinkResource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _relayPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("RelayPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _relayPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayPrivateLinkResource(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.Relay/namespaces/{namespaceName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The PrivateLinkResource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _relayPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("RelayPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _relayPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelayPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayAuthorizationRuleCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayAuthorizationRuleCollection.cs index 160b6e631509..e5d7aa08e76f 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayAuthorizationRuleCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayAuthorizationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// WCFRelays_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _wcfRelayAuthorizationRuleWCFRelaysClientDiagnostics.CreateScope("WcfRelayAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _wcfRelayAuthorizationRuleWCFRelaysRestClient.GetAuthorizationRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WcfRelayAuthorizationRuleResource(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.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// WCFRelays_GetAuthorizationRule + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _wcfRelayAuthorizationRuleWCFRelaysClientDiagnostics.CreateScope("WcfRelayAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _wcfRelayAuthorizationRuleWCFRelaysRestClient.GetAuthorizationRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WcfRelayAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayCollection.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayCollection.cs index d916906a7b6f..4944382b22bf 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayCollection.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string relayName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName} + /// + /// + /// Operation Id + /// WCFRelays_Get + /// + /// + /// + /// The relay name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string relayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(relayName, nameof(relayName)); + + using var scope = _wcfRelayWCFRelaysClientDiagnostics.CreateScope("WcfRelayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _wcfRelayWCFRelaysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, relayName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WcfRelayResource(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.Relay/namespaces/{namespaceName}/wcfRelays/{relayName} + /// + /// + /// Operation Id + /// WCFRelays_Get + /// + /// + /// + /// The relay name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string relayName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(relayName, nameof(relayName)); + + using var scope = _wcfRelayWCFRelaysClientDiagnostics.CreateScope("WcfRelayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _wcfRelayWCFRelaysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, relayName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WcfRelayResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs b/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs index 105bb925485d..546a1232e1db 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_QuotaRequestDetailCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -83,6 +84,49 @@ public async Task Exists_QuotaRequestFailed() Console.WriteLine($"Succeeded: {result}"); } + // QuotaRequestFailed + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotaRequestFailed() + { + // Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json + // this example is just showing the usage of "QuotaRequestStatus_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this QuotaRequestDetailResource + string providerId = "Microsoft.Compute"; + AzureLocation location = new AzureLocation("eastus"); + QuotaRequestDetailCollection collection = subscriptionResource.GetQuotaRequestDetails(providerId, location); + + // invoke the operation + Guid id = Guid.Parse("2B5C8515-37D8-4B6A-879B-CD641A2CF605"); + NullableResponse response = await collection.GetIfExistsAsync(id); + QuotaRequestDetailResource 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 + QuotaRequestDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QuotaRequestInProgress [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -149,6 +193,49 @@ public async Task Exists_QuotaRequestInProgress() Console.WriteLine($"Succeeded: {result}"); } + // QuotaRequestInProgress + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotaRequestInProgress() + { + // Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json + // this example is just showing the usage of "QuotaRequestStatus_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this QuotaRequestDetailResource + string providerId = "Microsoft.Compute"; + AzureLocation location = new AzureLocation("eastus"); + QuotaRequestDetailCollection collection = subscriptionResource.GetQuotaRequestDetails(providerId, location); + + // invoke the operation + Guid id = Guid.Parse("2B5C8515-37D8-4B6A-879B-CD641A2CF605"); + NullableResponse response = await collection.GetIfExistsAsync(id); + QuotaRequestDetailResource 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 + QuotaRequestDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QuotaRequestStatus [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -215,6 +302,49 @@ public async Task Exists_QuotaRequestStatus() Console.WriteLine($"Succeeded: {result}"); } + // QuotaRequestStatus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotaRequestStatus() + { + // Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json + // this example is just showing the usage of "QuotaRequestStatus_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this QuotaRequestDetailResource + string providerId = "Microsoft.Compute"; + AzureLocation location = new AzureLocation("eastus"); + QuotaRequestDetailCollection collection = subscriptionResource.GetQuotaRequestDetails(providerId, location); + + // invoke the operation + Guid id = Guid.Parse("2B5C8515-37D8-4B6A-879B-CD641A2CF605"); + NullableResponse response = await collection.GetIfExistsAsync(id); + QuotaRequestDetailResource 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 + QuotaRequestDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // QuotaRequestHistory [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationDetailCollection.cs b/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationDetailCollection.cs index 0b5ef06a8195..7228ee2362df 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationDetailCollection.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationDetailCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,6 +116,48 @@ public async Task Exists_GetReservation() Console.WriteLine($"Succeeded: {result}"); } + // GetReservation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetReservation() + { + // Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.json + // this example is just showing the usage of "Reservation_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 ReservationOrderResource created on azure + // for more information of creating ReservationOrderResource, please refer to the document of ReservationOrderResource + Guid reservationOrderId = Guid.Parse("276e7ae4-84d0-4da6-ab4b-d6b94f3557da"); + ResourceIdentifier reservationOrderResourceId = ReservationOrderResource.CreateResourceIdentifier(reservationOrderId); + ReservationOrderResource reservationOrder = client.GetReservationOrderResource(reservationOrderResourceId); + + // get the collection of this ReservationDetailResource + ReservationDetailCollection collection = reservationOrder.GetReservationDetails(); + + // invoke the operation + Guid reservationId = Guid.Parse("6ef59113-3482-40da-8d79-787f823e34bc"); + string expand = "renewProperties"; + NullableResponse response = await collection.GetIfExistsAsync(reservationId, expand: expand); + ReservationDetailResource 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 + ReservationDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ReservationRevisions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationOrderCollection.cs b/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationOrderCollection.cs index 1e0d5a625c6c..d31d10156bb4 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationOrderCollection.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationOrderCollection.cs @@ -158,6 +158,45 @@ public async Task Exists_GetReservationOrder() Console.WriteLine($"Succeeded: {result}"); } + // GetReservationOrder + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetReservationOrder() + { + // Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetails.json + // this example is just showing the usage of "ReservationOrder_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ReservationOrderResource + ReservationOrderCollection collection = tenantResource.GetReservationOrders(); + + // invoke the operation + Guid reservationOrderId = Guid.Parse("a075419f-44cc-497f-b68a-14ee811d48b9"); + NullableResponse response = await collection.GetIfExistsAsync(reservationOrderId); + ReservationOrderResource 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 + ReservationOrderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetReservationWithExpandPayments [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -217,5 +256,45 @@ public async Task Exists_GetReservationWithExpandPayments() Console.WriteLine($"Succeeded: {result}"); } + + // GetReservationWithExpandPayments + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetReservationWithExpandPayments() + { + // Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json + // this example is just showing the usage of "ReservationOrder_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ReservationOrderResource + ReservationOrderCollection collection = tenantResource.GetReservationOrders(); + + // invoke the operation + Guid reservationOrderId = Guid.Parse("a075419f-44cc-497f-b68a-14ee811d48b9"); + string expand = "schedule"; + NullableResponse response = await collection.GetIfExistsAsync(reservationOrderId, expand: expand); + ReservationOrderResource 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 + ReservationOrderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationQuotaCollection.cs b/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationQuotaCollection.cs index 7bee106fb810..662cb69dcc23 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationQuotaCollection.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/samples/Generated/Samples/Sample_ReservationQuotaCollection.cs @@ -85,6 +85,49 @@ public async Task Exists_QuotasRequestForCompute() Console.WriteLine($"Succeeded: {result}"); } + // Quotas_Request_ForCompute + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QuotasRequestForCompute() + { + // Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.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(); + // 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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ReservationQuotaResource + string providerId = "Microsoft.Compute"; + AzureLocation location = new AzureLocation("eastus"); + ReservationQuotaCollection collection = subscriptionResource.GetAllReservationQuota(providerId, location); + + // invoke the operation + string resourceName = "standardNDSFamily"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + ReservationQuotaResource 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 + ReservationQuotaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Quotas_Request_PutForCompute [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/QuotaRequestDetailCollection.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/QuotaRequestDetailCollection.cs index 0b50f9e6eced..750c8970d0c5 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/QuotaRequestDetailCollection.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/QuotaRequestDetailCollection.cs @@ -248,6 +248,72 @@ public virtual Response Exists(Guid id, CancellationToken cancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id} + /// + /// + /// Operation Id + /// QuotaRequestStatus_Get + /// + /// + /// + /// Quota Request ID. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid id, CancellationToken cancellationToken = default) + { + using var scope = _quotaRequestDetailQuotaRequestStatusClientDiagnostics.CreateScope("QuotaRequestDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _quotaRequestDetailQuotaRequestStatusRestClient.GetAsync(Id.SubscriptionId, _providerId, new AzureLocation(_location), id, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QuotaRequestDetailResource(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}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id} + /// + /// + /// Operation Id + /// QuotaRequestStatus_Get + /// + /// + /// + /// Quota Request ID. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid id, CancellationToken cancellationToken = default) + { + using var scope = _quotaRequestDetailQuotaRequestStatusClientDiagnostics.CreateScope("QuotaRequestDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = _quotaRequestDetailQuotaRequestStatusRestClient.Get(Id.SubscriptionId, _providerId, new AzureLocation(_location), id, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new QuotaRequestDetailResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationDetailCollection.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationDetailCollection.cs index 592ae8615ac7..5065243db107 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationDetailCollection.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationDetailCollection.cs @@ -275,6 +275,74 @@ public virtual Response Exists(Guid reservationId, string expand = null, C } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + /// + /// + /// Operation Id + /// Reservation_Get + /// + /// + /// + /// Id of the reservation item. + /// Supported value of this query is renewProperties. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid reservationId, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _reservationDetailReservationClientDiagnostics.CreateScope("ReservationDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _reservationDetailReservationRestClient.GetAsync(Guid.Parse(Id.Name), reservationId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReservationDetailResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + /// + /// + /// Operation Id + /// Reservation_Get + /// + /// + /// + /// Id of the reservation item. + /// Supported value of this query is renewProperties. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid reservationId, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _reservationDetailReservationClientDiagnostics.CreateScope("ReservationDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = _reservationDetailReservationRestClient.Get(Guid.Parse(Id.Name), reservationId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReservationDetailResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderCollection.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderCollection.cs index f7816b5dfc44..0ce76796117a 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderCollection.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderCollection.cs @@ -309,6 +309,74 @@ public virtual Response Exists(Guid reservationOrderId, string expand = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId} + /// + /// + /// Operation Id + /// ReservationOrder_Get + /// + /// + /// + /// Order Id of the reservation. + /// May be used to expand the planInformation. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid reservationOrderId, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _reservationOrderClientDiagnostics.CreateScope("ReservationOrderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _reservationOrderRestClient.GetAsync(reservationOrderId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReservationOrderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId} + /// + /// + /// Operation Id + /// ReservationOrder_Get + /// + /// + /// + /// Order Id of the reservation. + /// May be used to expand the planInformation. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid reservationOrderId, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _reservationOrderClientDiagnostics.CreateScope("ReservationOrderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _reservationOrderRestClient.Get(reservationOrderId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReservationOrderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationQuotaCollection.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationQuotaCollection.cs index 692e2e4fbe3f..62a33583269f 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationQuotaCollection.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationQuotaCollection.cs @@ -342,6 +342,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName} + /// + /// + /// Operation Id + /// Quota_Get + /// + /// + /// + /// The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _reservationQuotaQuotaClientDiagnostics.CreateScope("ReservationQuotaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _reservationQuotaQuotaRestClient.GetAsync(Id.SubscriptionId, _providerId, new AzureLocation(_location), resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReservationQuotaResource(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}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName} + /// + /// + /// Operation Id + /// Quota_Get + /// + /// + /// + /// The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _reservationQuotaQuotaClientDiagnostics.CreateScope("ReservationQuotaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _reservationQuotaQuotaRestClient.Get(Id.SubscriptionId, _providerId, new AzureLocation(_location), resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ReservationQuotaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/samples/Generated/Samples/Sample_ResourceConnectorApplianceCollection.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/samples/Generated/Samples/Sample_ResourceConnectorApplianceCollection.cs index 191d4dd9a970..5959abe6a3f2 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/samples/Generated/Samples/Sample_ResourceConnectorApplianceCollection.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/samples/Generated/Samples/Sample_ResourceConnectorApplianceCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetAppliance() Console.WriteLine($"Succeeded: {result}"); } + // Get Appliance + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppliance() + { + // Generated from example definition: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/stable/2022-10-27/examples/AppliancesGet.json + // this example is just showing the usage of "Appliances_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 = "11111111-2222-3333-4444-555555555555"; + string resourceGroupName = "testresourcegroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ResourceConnectorApplianceResource + ResourceConnectorApplianceCollection collection = resourceGroupResource.GetResourceConnectorAppliances(); + + // invoke the operation + string resourceName = "appliance01"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + ResourceConnectorApplianceResource 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 + ResourceConnectorApplianceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create/Update Appliance [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceCollection.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceCollection.cs index 4f269f298820..d6c98855a729 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceCollection.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName} + /// + /// + /// Operation Id + /// Appliances_Get + /// + /// + /// + /// Appliances name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _resourceConnectorApplianceAppliancesClientDiagnostics.CreateScope("ResourceConnectorApplianceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceConnectorApplianceAppliancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceConnectorApplianceResource(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.ResourceConnector/appliances/{resourceName} + /// + /// + /// Operation Id + /// Appliances_Get + /// + /// + /// + /// Appliances name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _resourceConnectorApplianceAppliancesClientDiagnostics.CreateScope("ResourceConnectorApplianceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceConnectorApplianceAppliancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceConnectorApplianceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventCollection.cs index 2aefc537f9f5..44aa4ec11b02 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,5 +120,48 @@ public async Task Exists_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() Console.WriteLine($"Succeeded: {result}"); } + + // SecurityAdvisoriesEventBySubscriptionIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + // this example is just showing the usage of "Event_GetBySubscriptionIdAndTrackingId" 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 = "subscriptionId"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ResourceHealthEventResource + ResourceHealthEventCollection collection = subscriptionResource.GetResourceHealthEvents(); + + // invoke the operation + string eventTrackingId = "eventTrackingId"; + string filter = "properties/status eq 'Active'"; + string queryStartTime = "7/10/2022"; + NullableResponse response = await collection.GetIfExistsAsync(eventTrackingId, filter: filter, queryStartTime: queryStartTime); + ResourceHealthEventResource 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 + ResourceHealthEventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResourceCollection.cs index 165b6d2a0c74..9c8c19b40058 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResourceCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_ImpactedResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // ImpactedResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ImpactedResourcesGet() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + // this example is just showing the usage of "ImpactedResources_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 ResourceHealthEventResource created on azure + // for more information of creating ResourceHealthEventResource, please refer to the document of ResourceHealthEventResource + string subscriptionId = "subscriptionId"; + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier resourceHealthEventResourceId = ResourceHealthEventResource.CreateResourceIdentifier(subscriptionId, eventTrackingId); + ResourceHealthEventResource resourceHealthEvent = client.GetResourceHealthEventResource(resourceHealthEventResourceId); + + // get the collection of this ResourceHealthEventImpactedResource + ResourceHealthEventImpactedResourceCollection collection = resourceHealthEvent.GetResourceHealthEventImpactedResources(); + + // invoke the operation + string impactedResourceName = "abc-123-ghj-456"; + NullableResponse response = await collection.GetIfExistsAsync(impactedResourceName); + ResourceHealthEventImpactedResource 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 + ResourceHealthEventImpactedResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityCollection.cs index a4f26a1ace2e..3a3ef0015d6c 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -106,5 +107,44 @@ public async Task Exists_GetMetadata() Console.WriteLine($"Succeeded: {result}"); } + + // GetMetadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMetadata() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + // this example is just showing the usage of "Metadata_GetEntity" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ResourceHealthMetadataEntityResource + ResourceHealthMetadataEntityCollection collection = tenantResource.GetResourceHealthMetadataEntities(); + + // invoke the operation + string name = "status"; + NullableResponse response = await collection.GetIfExistsAsync(name); + ResourceHealthMetadataEntityResource 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 + ResourceHealthMetadataEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueCollection.cs index d95170682a50..f62379619757 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -107,5 +108,44 @@ public async Task Exists_GetEmergingIssues() Console.WriteLine($"Succeeded: {result}"); } + + // GetEmergingIssues + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetEmergingIssues() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + // this example is just showing the usage of "EmergingIssues_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ServiceEmergingIssueResource + ServiceEmergingIssueCollection collection = tenantResource.GetServiceEmergingIssues(); + + // invoke the operation + EmergingIssueNameContent issueName = EmergingIssueNameContent.Default; + NullableResponse response = await collection.GetIfExistsAsync(issueName); + ServiceEmergingIssueResource 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 + ServiceEmergingIssueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventCollection.cs index 108f0cbc960f..f62aaa13392e 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -112,5 +113,46 @@ public async Task Exists_EventByTenantIdAndTrackingId() Console.WriteLine($"Succeeded: {result}"); } + + // EventByTenantIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_EventByTenantIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + // this example is just showing the usage of "Event_GetByTenantIdAndTrackingId" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantResourceHealthEventResource + TenantResourceHealthEventCollection collection = tenantResource.GetTenantResourceHealthEvents(); + + // invoke the operation + string eventTrackingId = "eventTrackingId"; + string filter = "properties/status eq 'Active'"; + string queryStartTime = "7/10/2022"; + NullableResponse response = await collection.GetIfExistsAsync(eventTrackingId, filter: filter, queryStartTime: queryStartTime); + TenantResourceHealthEventResource 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 + ResourceHealthEventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs index 26397d541111..fc87b9aa75a8 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_ImpactedResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // ImpactedResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ImpactedResourcesGet() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + // this example is just showing the usage of "ImpactedResources_GetByTenantId" 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 TenantResourceHealthEventResource created on azure + // for more information of creating TenantResourceHealthEventResource, please refer to the document of TenantResourceHealthEventResource + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier tenantResourceHealthEventResourceId = TenantResourceHealthEventResource.CreateResourceIdentifier(eventTrackingId); + TenantResourceHealthEventResource tenantResourceHealthEvent = client.GetTenantResourceHealthEventResource(tenantResourceHealthEventResourceId); + + // get the collection of this TenantResourceHealthEventImpactedResource + TenantResourceHealthEventImpactedResourceCollection collection = tenantResourceHealthEvent.GetTenantResourceHealthEventImpactedResources(); + + // invoke the operation + string impactedResourceName = "abc-123-ghj-456"; + NullableResponse response = await collection.GetIfExistsAsync(impactedResourceName); + TenantResourceHealthEventImpactedResource 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 + ResourceHealthEventImpactedResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventCollection.cs index a7a05eb8f27b..7b75aa0f3727 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventCollection.cs @@ -259,6 +259,84 @@ public virtual Response Exists(string eventTrackingId, string filter = nul } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _resourceHealthEventEventClientDiagnostics.CreateScope("ResourceHealthEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceHealthEventEventRestClient.GetBySubscriptionIdAndTrackingIdAsync(Id.SubscriptionId, eventTrackingId, filter, queryStartTime, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceHealthEventResource(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}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _resourceHealthEventEventClientDiagnostics.CreateScope("ResourceHealthEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceHealthEventEventRestClient.GetBySubscriptionIdAndTrackingId(Id.SubscriptionId, eventTrackingId, filter, queryStartTime, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceHealthEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResourceCollection.cs index a550f14ee4f7..57c1557b5e38 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResourceCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResourceCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string impactedResourceName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// Name of the Impacted 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 impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _resourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("ResourceHealthEventImpactedResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceHealthEventImpactedResourceImpactedResourcesRestClient.GetAsync(Id.SubscriptionId, Id.Name, impactedResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceHealthEventImpactedResource(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}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _resourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("ResourceHealthEventImpactedResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceHealthEventImpactedResourceImpactedResourcesRestClient.Get(Id.SubscriptionId, Id.Name, impactedResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthMetadataEntityCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthMetadataEntityCollection.cs index d40fcf159282..110bc1b6eb1e 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthMetadataEntityCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthMetadataEntityCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// Name of metadata entity. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _resourceHealthMetadataEntityMetadataClientDiagnostics.CreateScope("ResourceHealthMetadataEntityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceHealthMetadataEntityMetadataRestClient.GetEntityAsync(name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceHealthMetadataEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// Name of metadata entity. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _resourceHealthMetadataEntityMetadataClientDiagnostics.CreateScope("ResourceHealthMetadataEntityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceHealthMetadataEntityMetadataRestClient.GetEntity(name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceHealthMetadataEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ServiceEmergingIssueCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ServiceEmergingIssueCollection.cs index 4630a7a9a466..90e40f3d6691 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ServiceEmergingIssueCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ServiceEmergingIssueCollection.cs @@ -227,6 +227,72 @@ public virtual Response Exists(EmergingIssueNameContent issueName, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The name of the emerging issue. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(EmergingIssueNameContent issueName, CancellationToken cancellationToken = default) + { + using var scope = _serviceEmergingIssueEmergingIssuesClientDiagnostics.CreateScope("ServiceEmergingIssueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceEmergingIssueEmergingIssuesRestClient.GetAsync(issueName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceEmergingIssueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The name of the emerging issue. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(EmergingIssueNameContent issueName, CancellationToken cancellationToken = default) + { + using var scope = _serviceEmergingIssueEmergingIssuesClientDiagnostics.CreateScope("ServiceEmergingIssueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceEmergingIssueEmergingIssuesRestClient.Get(issueName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceEmergingIssueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventCollection.cs index 5d52477779c8..e4ae64f20d04 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventCollection.cs @@ -259,6 +259,84 @@ public virtual Response Exists(string eventTrackingId, string filter = nul } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _tenantResourceHealthEventEventClientDiagnostics.CreateScope("TenantResourceHealthEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantResourceHealthEventEventRestClient.GetByTenantIdAndTrackingIdAsync(eventTrackingId, filter, queryStartTime, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantResourceHealthEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _tenantResourceHealthEventEventClientDiagnostics.CreateScope("TenantResourceHealthEventCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantResourceHealthEventEventRestClient.GetByTenantIdAndTrackingId(eventTrackingId, filter, queryStartTime, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantResourceHealthEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResourceCollection.cs index 39f1436c4813..dc900bc177c0 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResourceCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResourceCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string impactedResourceName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// Name of the Impacted 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 impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("TenantResourceHealthEventImpactedResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetByTenantIdAsync(Id.Name, impactedResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("TenantResourceHealthEventImpactedResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetByTenantId(Id.Name, impactedResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_DataPolicyManifestCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_DataPolicyManifestCollection.cs index a90c4cb5a8d1..a8acc714c47a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_DataPolicyManifestCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_DataPolicyManifestCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -74,6 +75,45 @@ public async Task Exists_RetrieveADataPolicyManifestByPolicyMode() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a data policy manifest by policy mode + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveADataPolicyManifestByPolicyMode() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getDataPolicyManifest.json + // this example is just showing the usage of "DataPolicyManifests_GetByPolicyMode" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenant = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this DataPolicyManifestResource + DataPolicyManifestCollection collection = tenant.GetDataPolicyManifests(); + + // invoke the operation + string policyMode = "Microsoft.KeyVault.Data"; + NullableResponse response = await collection.GetIfExistsAsync(policyMode); + DataPolicyManifestResource 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 + DataPolicyManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List data policy manifests [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_FeatureCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_FeatureCollection.cs index edc447e1fc8d..13f0ef12aee1 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_FeatureCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_FeatureCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,5 +116,47 @@ public async Task Exists_GetFeature() Console.WriteLine($"Succeeded: {result}"); } + + // Get feature + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFeature() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Features/stable/2021-07-01/examples/getFeature.json + // this example is just showing the usage of "Features_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 ResourceProviderResource created on azure + // for more information of creating ResourceProviderResource, please refer to the document of ResourceProviderResource + string subscriptionId = "subid"; + string resourceProviderNamespace = "Resource Provider Namespace"; + ResourceIdentifier resourceProviderResourceId = ResourceProviderResource.CreateResourceIdentifier(subscriptionId, resourceProviderNamespace); + ResourceProviderResource resourceProvider = client.GetResourceProviderResource(resourceProviderResourceId); + + // get the collection of this FeatureResource + FeatureCollection collection = resourceProvider.GetFeatures(); + + // invoke the operation + string featureName = "feature"; + NullableResponse response = await collection.GetIfExistsAsync(featureName); + FeatureResource 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 + FeatureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupCollection.cs index cb8d188302a9..7ae0ce410fbc 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupCollection.cs @@ -113,6 +113,46 @@ public async Task Exists_GetManagementGroup() Console.WriteLine($"Succeeded: {result}"); } + // GetManagementGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagementGroup() + { + // Generated from example definition: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroup.json + // this example is just showing the usage of "ManagementGroups_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ManagementGroupResource + ManagementGroupCollection collection = tenantResource.GetManagementGroups(); + + // invoke the operation + string groupId = "20000000-0001-0000-0000-000000000000"; + string cacheControl = "no-cache"; + NullableResponse response = await collection.GetIfExistsAsync(groupId, cacheControl: cacheControl); + ManagementGroupResource 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 + ManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetManagementGroupWithAncestors [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -175,6 +215,47 @@ public async Task Exists_GetManagementGroupWithAncestors() Console.WriteLine($"Succeeded: {result}"); } + // GetManagementGroupWithAncestors + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagementGroupWithAncestors() + { + // Generated from example definition: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithAncestors.json + // this example is just showing the usage of "ManagementGroups_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ManagementGroupResource + ManagementGroupCollection collection = tenantResource.GetManagementGroups(); + + // invoke the operation + string groupId = "20000000-0001-0000-0000-00000000000"; + ManagementGroupExpandType? expand = ManagementGroupExpandType.Ancestors; + string cacheControl = "no-cache"; + NullableResponse response = await collection.GetIfExistsAsync(groupId, expand: expand, cacheControl: cacheControl); + ManagementGroupResource 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 + ManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetManagementGroupWithExpand [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -237,6 +318,47 @@ public async Task Exists_GetManagementGroupWithExpand() Console.WriteLine($"Succeeded: {result}"); } + // GetManagementGroupWithExpand + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagementGroupWithExpand() + { + // Generated from example definition: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithExpand.json + // this example is just showing the usage of "ManagementGroups_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ManagementGroupResource + ManagementGroupCollection collection = tenantResource.GetManagementGroups(); + + // invoke the operation + string groupId = "20000000-0001-0000-0000-000000000000"; + ManagementGroupExpandType? expand = ManagementGroupExpandType.Children; + string cacheControl = "no-cache"; + NullableResponse response = await collection.GetIfExistsAsync(groupId, expand: expand, cacheControl: cacheControl); + ManagementGroupResource 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 + ManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetManagementGroupWithPath [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -299,6 +421,47 @@ public async Task Exists_GetManagementGroupWithPath() Console.WriteLine($"Succeeded: {result}"); } + // GetManagementGroupWithPath + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagementGroupWithPath() + { + // Generated from example definition: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithPath.json + // this example is just showing the usage of "ManagementGroups_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ManagementGroupResource + ManagementGroupCollection collection = tenantResource.GetManagementGroups(); + + // invoke the operation + string groupId = "20000000-0001-0000-0000-000000000000"; + ManagementGroupExpandType? expand = ManagementGroupExpandType.Path; + string cacheControl = "no-cache"; + NullableResponse response = await collection.GetIfExistsAsync(groupId, expand: expand, cacheControl: cacheControl); + ManagementGroupResource 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 + ManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetManagementGroupsWithExpandAndRecurse [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -363,6 +526,48 @@ public async Task Exists_GetManagementGroupsWithExpandAndRecurse() Console.WriteLine($"Succeeded: {result}"); } + // GetManagementGroupsWithExpandAndRecurse + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagementGroupsWithExpandAndRecurse() + { + // Generated from example definition: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithExpandAndRecurse.json + // this example is just showing the usage of "ManagementGroups_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this ManagementGroupResource + ManagementGroupCollection collection = tenantResource.GetManagementGroups(); + + // invoke the operation + string groupId = "20000000-0001-0000-0000-000000000000"; + ManagementGroupExpandType? expand = ManagementGroupExpandType.Children; + bool? recurse = true; + string cacheControl = "no-cache"; + NullableResponse response = await collection.GetIfExistsAsync(groupId, expand: expand, recurse: recurse, cacheControl: cacheControl); + ManagementGroupResource 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 + ManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutManagementGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupPolicyDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupPolicyDefinitionCollection.cs index f699f6778922..7a96b89f5c3c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupPolicyDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupPolicyDefinitionCollection.cs @@ -162,6 +162,47 @@ public async Task Exists_RetrieveAPolicyDefinitionAtManagementGroupLevel() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy definition at management group level + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicyDefinitionAtManagementGroupLevel() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2021-06-01/examples/getPolicyDefinitionAtManagementGroup.json + // this example is just showing the usage of "PolicyDefinitions_GetAtManagementGroup" 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 ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "MyManagementGroup"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this ManagementGroupPolicyDefinitionResource + ManagementGroupPolicyDefinitionCollection collection = managementGroupResource.GetManagementGroupPolicyDefinitions(); + + // invoke the operation + string policyDefinitionName = "ResourceNaming"; + NullableResponse response = await collection.GetIfExistsAsync(policyDefinitionName); + ManagementGroupPolicyDefinitionResource 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 + PolicyDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List policy definitions by management group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupPolicySetDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupPolicySetDefinitionCollection.cs index d9db142c8c2d..a461409d713c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupPolicySetDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementGroupPolicySetDefinitionCollection.cs @@ -244,6 +244,47 @@ public async Task Exists_RetrieveAPolicySetDefinitionAtManagementGroupLevel() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy set definition at management group level + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicySetDefinitionAtManagementGroupLevel() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2021-06-01/examples/getPolicySetDefinitionAtManagementGroup.json + // this example is just showing the usage of "PolicySetDefinitions_GetAtManagementGroup" 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 ManagementGroupResource created on azure + // for more information of creating ManagementGroupResource, please refer to the document of ManagementGroupResource + string managementGroupId = "MyManagementGroup"; + ResourceIdentifier managementGroupResourceId = ManagementGroupResource.CreateResourceIdentifier(managementGroupId); + ManagementGroupResource managementGroupResource = client.GetManagementGroupResource(managementGroupResourceId); + + // get the collection of this ManagementGroupPolicySetDefinitionResource + ManagementGroupPolicySetDefinitionCollection collection = managementGroupResource.GetManagementGroupPolicySetDefinitions(); + + // invoke the operation + string policySetDefinitionName = "CostManagement"; + NullableResponse response = await collection.GetIfExistsAsync(policySetDefinitionName); + ManagementGroupPolicySetDefinitionResource 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 + PolicySetDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List policy set definitions at management group level [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementLockCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementLockCollection.cs index 08cc3fccd8f5..b11e6794913e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementLockCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ManagementLockCollection.cs @@ -112,6 +112,46 @@ public async Task Exists_GetManagementLockAtScope() Console.WriteLine($"Succeeded: {result}"); } + // Get management lock at scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagementLockAtScope() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtScope.json + // this example is just showing the usage of "ManagementLocks_GetByScope" 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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ManagementLockResource + string scope = "subscriptions/subscriptionId"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + ManagementLockCollection collection = client.GetGenericResource(scopeId).GetManagementLocks(); + + // invoke the operation + string lockName = "testlock"; + NullableResponse response = await collection.GetIfExistsAsync(lockName); + ManagementLockResource 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 + ManagementLockData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List management locks at scope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_PolicyAssignmentCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_PolicyAssignmentCollection.cs index b778467bb9c9..b0fff4d1a0b9 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_PolicyAssignmentCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_PolicyAssignmentCollection.cs @@ -484,6 +484,46 @@ public async Task Exists_RetrieveAPolicyAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicyAssignment() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2022-06-01/examples/getPolicyAssignment.json + // this example is just showing the usage of "PolicyAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this PolicyAssignmentResource + string scope = "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + PolicyAssignmentCollection collection = client.GetGenericResource(scopeId).GetPolicyAssignments(); + + // invoke the operation + string policyAssignmentName = "EnforceNaming"; + NullableResponse response = await collection.GetIfExistsAsync(policyAssignmentName); + PolicyAssignmentResource 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 + PolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Retrieve a policy assignment with a system assigned identity [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -544,6 +584,46 @@ public async Task Exists_RetrieveAPolicyAssignmentWithASystemAssignedIdentity() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy assignment with a system assigned identity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicyAssignmentWithASystemAssignedIdentity() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2022-06-01/examples/getPolicyAssignmentWithIdentity.json + // this example is just showing the usage of "PolicyAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this PolicyAssignmentResource + string scope = "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + PolicyAssignmentCollection collection = client.GetGenericResource(scopeId).GetPolicyAssignments(); + + // invoke the operation + string policyAssignmentName = "EnforceNaming"; + NullableResponse response = await collection.GetIfExistsAsync(policyAssignmentName); + PolicyAssignmentResource 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 + PolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Retrieve a policy assignment with a user assigned identity [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -604,6 +684,46 @@ public async Task Exists_RetrieveAPolicyAssignmentWithAUserAssignedIdentity() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy assignment with a user assigned identity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicyAssignmentWithAUserAssignedIdentity() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2022-06-01/examples/getPolicyAssignmentWithUserAssignedIdentity.json + // this example is just showing the usage of "PolicyAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this PolicyAssignmentResource + string scope = "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + PolicyAssignmentCollection collection = client.GetGenericResource(scopeId).GetPolicyAssignments(); + + // invoke the operation + string policyAssignmentName = "EnforceNaming"; + NullableResponse response = await collection.GetIfExistsAsync(policyAssignmentName); + PolicyAssignmentResource 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 + PolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Retrieve a policy assignment with overrides [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -664,6 +784,46 @@ public async Task Exists_RetrieveAPolicyAssignmentWithOverrides() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy assignment with overrides + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicyAssignmentWithOverrides() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2022-06-01/examples/getPolicyAssignmentWithOverrides.json + // this example is just showing the usage of "PolicyAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this PolicyAssignmentResource + string scope = "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + PolicyAssignmentCollection collection = client.GetGenericResource(scopeId).GetPolicyAssignments(); + + // invoke the operation + string policyAssignmentName = "CostManagement"; + NullableResponse response = await collection.GetIfExistsAsync(policyAssignmentName); + PolicyAssignmentResource 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 + PolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Retrieve a policy assignment with resource selectors [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -724,6 +884,46 @@ public async Task Exists_RetrieveAPolicyAssignmentWithResourceSelectors() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy assignment with resource selectors + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicyAssignmentWithResourceSelectors() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2022-06-01/examples/getPolicyAssignmentWithResourceSelectors.json + // this example is just showing the usage of "PolicyAssignments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this PolicyAssignmentResource + string scope = "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + PolicyAssignmentCollection collection = client.GetGenericResource(scopeId).GetPolicyAssignments(); + + // invoke the operation + string policyAssignmentName = "CostManagement"; + NullableResponse response = await collection.GetIfExistsAsync(policyAssignmentName); + PolicyAssignmentResource 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 + PolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List policy assignments that apply to a resource group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ResourceProviderCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ResourceProviderCollection.cs index fe07e670fa83..69b7180f0397 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ResourceProviderCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_ResourceProviderCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -112,5 +113,46 @@ public async Task Exists_GetProvider() Console.WriteLine($"Succeeded: {result}"); } + + // Get provider. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetProvider() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/stable/2022-09-01/examples/GetProvider.json + // this example is just showing the usage of "Providers_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscription = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ResourceProviderResource + ResourceProviderCollection collection = subscription.GetResourceProviders(); + + // invoke the operation + string resourceProviderNamespace = "Microsoft.TestRP1"; + NullableResponse response = await collection.GetIfExistsAsync(resourceProviderNamespace); + ResourceProviderResource 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 + ResourceProviderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionCollection.cs index 944538b30484..2b18fb5ccd4c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -74,6 +75,45 @@ public async Task Exists_GetASingleSubscription() Console.WriteLine($"Succeeded: {result}"); } + // GetASingleSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASingleSubscription() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetSubscription.json + // this example is just showing the usage of "Subscriptions_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenant = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this SubscriptionResource + SubscriptionCollection collection = tenant.GetSubscriptions(); + + // invoke the operation + string subscriptionId = "291bba3f-e0a5-47bc-a099-3bdcb2a50a05"; + NullableResponse response = await collection.GetIfExistsAsync(subscriptionId); + SubscriptionResource 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 + SubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GetAllSubscriptions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionPolicyDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionPolicyDefinitionCollection.cs index ab07f423b45b..5d9c072b75e6 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionPolicyDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionPolicyDefinitionCollection.cs @@ -248,6 +248,47 @@ public async Task Exists_RetrieveAPolicyDefinition() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy definition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicyDefinition() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2021-06-01/examples/getPolicyDefinition.json + // this example is just showing the usage of "PolicyDefinitions_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ae640e6b-ba3e-4256-9d62-2993eecfa6f2"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscription = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionPolicyDefinitionResource + SubscriptionPolicyDefinitionCollection collection = subscription.GetSubscriptionPolicyDefinitions(); + + // invoke the operation + string policyDefinitionName = "ResourceNaming"; + NullableResponse response = await collection.GetIfExistsAsync(policyDefinitionName); + SubscriptionPolicyDefinitionResource 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 + PolicyDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List policy definitions by subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionPolicySetDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionPolicySetDefinitionCollection.cs index 8b30ba94b45b..b6599577c6cf 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionPolicySetDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_SubscriptionPolicySetDefinitionCollection.cs @@ -255,6 +255,47 @@ public async Task Exists_RetrieveAPolicySetDefinition() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a policy set definition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveAPolicySetDefinition() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2021-06-01/examples/getPolicySetDefinition.json + // this example is just showing the usage of "PolicySetDefinitions_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ae640e6b-ba3e-4256-9d62-2993eecfa6f2"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscription = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionPolicySetDefinitionResource + SubscriptionPolicySetDefinitionCollection collection = subscription.GetSubscriptionPolicySetDefinitions(); + + // invoke the operation + string policySetDefinitionName = "CostManagement"; + NullableResponse response = await collection.GetIfExistsAsync(policySetDefinitionName); + SubscriptionPolicySetDefinitionResource 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 + PolicySetDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List policy set definitions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_TenantPolicyDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_TenantPolicyDefinitionCollection.cs index 4c02b00e9293..6442a664a0d0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_TenantPolicyDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_TenantPolicyDefinitionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -74,6 +75,45 @@ public async Task Exists_RetrieveABuiltInPolicyDefinition() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a built-in policy definition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveABuiltInPolicyDefinition() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2021-06-01/examples/getBuiltinPolicyDefinition.json + // this example is just showing the usage of "PolicyDefinitions_GetBuiltIn" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenant = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantPolicyDefinitionResource + TenantPolicyDefinitionCollection collection = tenant.GetTenantPolicyDefinitions(); + + // invoke the operation + string policyDefinitionName = "7433c107-6db4-4ad1-b57a-a76dce0154a1"; + NullableResponse response = await collection.GetIfExistsAsync(policyDefinitionName); + TenantPolicyDefinitionResource 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 + PolicyDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List built-in policy definitions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_TenantPolicySetDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_TenantPolicySetDefinitionCollection.cs index ee2d77f202f3..c71cae024fec 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_TenantPolicySetDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/samples/Generated/Samples/Sample_TenantPolicySetDefinitionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -74,6 +75,45 @@ public async Task Exists_RetrieveABuiltInPolicySetDefinition() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a built-in policy set definition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveABuiltInPolicySetDefinition() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Authorization/stable/2021-06-01/examples/getBuiltInPolicySetDefinition.json + // this example is just showing the usage of "PolicySetDefinitions_GetBuiltIn" 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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenant = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantPolicySetDefinitionResource + TenantPolicySetDefinitionCollection collection = tenant.GetTenantPolicySetDefinitions(); + + // invoke the operation + string policySetDefinitionName = "1f3afdf9-d0c9-4c3d-847f-89da613e70a8"; + NullableResponse response = await collection.GetIfExistsAsync(policySetDefinitionName); + TenantPolicySetDefinitionResource 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 + PolicySetDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List built-in policy set definitions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/ManagementGroupCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/ManagementGroupCollection.cs index b1aa8b836613..e8a78dc4f76e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/ManagementGroupCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/ManagementGroupCollection.cs @@ -431,6 +431,88 @@ public virtual Response Exists(string groupId, ManagementGroupExpandType? } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{groupId} + /// + /// + /// Operation Id + /// ManagementGroups_Get + /// + /// + /// + /// Management Group ID. + /// The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group. + /// The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + /// A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription'). + /// Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _managementGroupClientDiagnostics.CreateScope("ManagementGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managementGroupRestClient.GetAsync(groupId, expand, recurse, filter, cacheControl, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{groupId} + /// + /// + /// Operation Id + /// ManagementGroups_Get + /// + /// + /// + /// Management Group ID. + /// The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group. + /// The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + /// A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription'). + /// Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _managementGroupClientDiagnostics.CreateScope("ManagementGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managementGroupRestClient.Get(groupId, expand, recurse, filter, cacheControl, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/DataPolicyManifestCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/DataPolicyManifestCollection.cs index 127358f9f040..81a7ca60ba08 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/DataPolicyManifestCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/DataPolicyManifestCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string policyMode, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/dataPolicyManifests/{policyMode} + /// + /// + /// Operation Id + /// DataPolicyManifests_GetByPolicyMode + /// + /// + /// + /// The policy mode of the data policy manifest to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyMode, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyMode, nameof(policyMode)); + + using var scope = _dataPolicyManifestClientDiagnostics.CreateScope("DataPolicyManifestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataPolicyManifestRestClient.GetByPolicyModeAsync(policyMode, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataPolicyManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/dataPolicyManifests/{policyMode} + /// + /// + /// Operation Id + /// DataPolicyManifests_GetByPolicyMode + /// + /// + /// + /// The policy mode of the data policy manifest to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyMode, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyMode, nameof(policyMode)); + + using var scope = _dataPolicyManifestClientDiagnostics.CreateScope("DataPolicyManifestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataPolicyManifestRestClient.GetByPolicyMode(policyMode, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataPolicyManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/FeatureCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/FeatureCollection.cs index ed93b4cd4851..5f1f3fa594c5 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/FeatureCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/FeatureCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string featureName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName} + /// + /// + /// Operation Id + /// Features_Get + /// + /// + /// + /// The name of the feature to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string featureName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(featureName, nameof(featureName)); + + using var scope = _featureClientDiagnostics.CreateScope("FeatureCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _featureRestClient.GetAsync(Id.SubscriptionId, Id.Provider, featureName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FeatureResource(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}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName} + /// + /// + /// Operation Id + /// Features_Get + /// + /// + /// + /// The name of the feature to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string featureName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(featureName, nameof(featureName)); + + using var scope = _featureClientDiagnostics.CreateScope("FeatureCollection.GetIfExists"); + scope.Start(); + try + { + var response = _featureRestClient.Get(Id.SubscriptionId, Id.Provider, featureName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FeatureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicyDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicyDefinitionCollection.cs index 57a6f81172e9..12a1b02437af 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicyDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicyDefinitionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string policyDefinitionName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName} + /// + /// + /// Operation Id + /// PolicyDefinitions_GetAtManagementGroup + /// + /// + /// + /// The name of the policy definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + using var scope = _managementGroupPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("ManagementGroupPolicyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managementGroupPolicyDefinitionPolicyDefinitionsRestClient.GetAtManagementGroupAsync(Id.Name, policyDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementGroupPolicyDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName} + /// + /// + /// Operation Id + /// PolicyDefinitions_GetAtManagementGroup + /// + /// + /// + /// The name of the policy definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + using var scope = _managementGroupPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("ManagementGroupPolicyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managementGroupPolicyDefinitionPolicyDefinitionsRestClient.GetAtManagementGroup(Id.Name, policyDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementGroupPolicyDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicySetDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicySetDefinitionCollection.cs index e2a5fbfdcc8a..d3897c7cd659 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicySetDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicySetDefinitionCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string policySetDefinitionName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName} + /// + /// + /// Operation Id + /// PolicySetDefinitions_GetAtManagementGroup + /// + /// + /// + /// The name of the policy set definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + using var scope = _managementGroupPolicySetDefinitionPolicySetDefinitionsClientDiagnostics.CreateScope("ManagementGroupPolicySetDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managementGroupPolicySetDefinitionPolicySetDefinitionsRestClient.GetAtManagementGroupAsync(Id.Name, policySetDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementGroupPolicySetDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName} + /// + /// + /// Operation Id + /// PolicySetDefinitions_GetAtManagementGroup + /// + /// + /// + /// The name of the policy set definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + using var scope = _managementGroupPolicySetDefinitionPolicySetDefinitionsClientDiagnostics.CreateScope("ManagementGroupPolicySetDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managementGroupPolicySetDefinitionPolicySetDefinitionsRestClient.GetAtManagementGroup(Id.Name, policySetDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementGroupPolicySetDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementLockCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementLockCollection.cs index 28a5525ba705..e81568872ca5 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementLockCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementLockCollection.cs @@ -315,6 +315,80 @@ public virtual Response Exists(string lockName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/locks/{lockName} + /// + /// + /// Operation Id + /// ManagementLocks_GetByScope + /// + /// + /// + /// The name of lock. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string lockName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(lockName, nameof(lockName)); + + using var scope = _managementLockClientDiagnostics.CreateScope("ManagementLockCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managementLockRestClient.GetByScopeAsync(Id, lockName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementLockResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/locks/{lockName} + /// + /// + /// Operation Id + /// ManagementLocks_GetByScope + /// + /// + /// + /// The name of lock. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string lockName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(lockName, nameof(lockName)); + + using var scope = _managementLockClientDiagnostics.CreateScope("ManagementLockCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managementLockRestClient.GetByScope(Id, lockName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagementLockResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/PolicyAssignmentCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/PolicyAssignmentCollection.cs index 0cdb2c72dfb9..da97b6b372c1 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/PolicyAssignmentCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/PolicyAssignmentCollection.cs @@ -409,6 +409,80 @@ public virtual Response Exists(string policyAssignmentName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName} + /// + /// + /// Operation Id + /// PolicyAssignments_Get + /// + /// + /// + /// The name of the policy assignment to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + using var scope = _policyAssignmentClientDiagnostics.CreateScope("PolicyAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _policyAssignmentRestClient.GetAsync(Id, policyAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName} + /// + /// + /// Operation Id + /// PolicyAssignments_Get + /// + /// + /// + /// The name of the policy assignment to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + using var scope = _policyAssignmentClientDiagnostics.CreateScope("PolicyAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _policyAssignmentRestClient.Get(Id, policyAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceGroupCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceGroupCollection.cs index 7136b6109617..b88fc292148d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceGroupCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceGroupCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string resourceGroupName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName} + /// + /// + /// Operation Id + /// ResourceGroups_Get + /// + /// + /// + /// The name of the resource group to get. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var scope = _resourceGroupClientDiagnostics.CreateScope("ResourceGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceGroupRestClient.GetAsync(Id.SubscriptionId, resourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupResource(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} + /// + /// + /// Operation Id + /// ResourceGroups_Get + /// + /// + /// + /// The name of the resource group to get. The name is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var scope = _resourceGroupClientDiagnostics.CreateScope("ResourceGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceGroupRestClient.Get(Id.SubscriptionId, resourceGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderCollection.cs index 22edfe466b78..312e64877dfa 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderCollection.cs @@ -234,6 +234,82 @@ public virtual Response Exists(string resourceProviderNamespace, string ex } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{resourceProviderNamespace} + /// + /// + /// Operation Id + /// Providers_Get + /// + /// + /// + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderNamespace, nameof(resourceProviderNamespace)); + + using var scope = _resourceProviderProvidersClientDiagnostics.CreateScope("ResourceProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceProviderProvidersRestClient.GetAsync(Id.SubscriptionId, resourceProviderNamespace, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceProviderResource(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}/providers/{resourceProviderNamespace} + /// + /// + /// Operation Id + /// Providers_Get + /// + /// + /// + /// The namespace of the resource provider. + /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceProviderNamespace, nameof(resourceProviderNamespace)); + + using var scope = _resourceProviderProvidersClientDiagnostics.CreateScope("ResourceProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceProviderProvidersRestClient.Get(Id.SubscriptionId, resourceProviderNamespace, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionCollection.cs index 9a4055b7a903..acb9f7f088fd 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string subscriptionId, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId} + /// + /// + /// Operation Id + /// Subscriptions_Get + /// + /// + /// + /// The ID of the target subscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _subscriptionClientDiagnostics.CreateScope("SubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionRestClient.GetAsync(subscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResource(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} + /// + /// + /// Operation Id + /// Subscriptions_Get + /// + /// + /// + /// The ID of the target subscription. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = _subscriptionClientDiagnostics.CreateScope("SubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionRestClient.Get(subscriptionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicyDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicyDefinitionCollection.cs index 2f41a511dd1e..f30e2a7c2cfa 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicyDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicyDefinitionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string policyDefinitionName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName} + /// + /// + /// Operation Id + /// PolicyDefinitions_Get + /// + /// + /// + /// The name of the policy definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + using var scope = _subscriptionPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionPolicyDefinitionPolicyDefinitionsRestClient.GetAsync(Id.SubscriptionId, policyDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionPolicyDefinitionResource(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}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName} + /// + /// + /// Operation Id + /// PolicyDefinitions_Get + /// + /// + /// + /// The name of the policy definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + using var scope = _subscriptionPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionPolicyDefinitionPolicyDefinitionsRestClient.Get(Id.SubscriptionId, policyDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionPolicyDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicySetDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicySetDefinitionCollection.cs index cff5cc9d34f7..006ac15be3b3 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicySetDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicySetDefinitionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string policySetDefinitionName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName} + /// + /// + /// Operation Id + /// PolicySetDefinitions_Get + /// + /// + /// + /// The name of the policy set definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + using var scope = _subscriptionPolicySetDefinitionPolicySetDefinitionsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionPolicySetDefinitionPolicySetDefinitionsRestClient.GetAsync(Id.SubscriptionId, policySetDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionPolicySetDefinitionResource(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}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName} + /// + /// + /// Operation Id + /// PolicySetDefinitions_Get + /// + /// + /// + /// The name of the policy set definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + using var scope = _subscriptionPolicySetDefinitionPolicySetDefinitionsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionPolicySetDefinitionPolicySetDefinitionsRestClient.Get(Id.SubscriptionId, policySetDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionPolicySetDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantCollection.cs index ecfe2beffb27..65037f283141 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantCollection.cs @@ -93,6 +93,70 @@ public virtual Pageable GetAll(CancellationToken cancellationTok return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TenantResource(Client, TenantData.DeserializeTenantData(e)), _tenantClientDiagnostics, Pipeline, "TenantCollection.GetAll", "value", "nextLink", cancellationToken); } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// / + /// + /// + /// Operation Id + /// Tenants_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(CancellationToken cancellationToken = default) + { + using var scope = _tenantClientDiagnostics.CreateScope("TenantCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantRestClient.GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// / + /// + /// + /// Operation Id + /// Tenants_Get + /// + /// + /// + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(CancellationToken cancellationToken = default) + { + using var scope = _tenantClientDiagnostics.CreateScope("TenantCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantRestClient.Get(cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicyDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicyDefinitionCollection.cs index d3842d73eaba..92265d4ac220 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicyDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicyDefinitionCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string policyDefinitionName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName} + /// + /// + /// Operation Id + /// PolicyDefinitions_GetBuiltIn + /// + /// + /// + /// The name of the built-in policy definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + using var scope = _tenantPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("TenantPolicyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantPolicyDefinitionPolicyDefinitionsRestClient.GetBuiltInAsync(policyDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantPolicyDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName} + /// + /// + /// Operation Id + /// PolicyDefinitions_GetBuiltIn + /// + /// + /// + /// The name of the built-in policy definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + using var scope = _tenantPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("TenantPolicyDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantPolicyDefinitionPolicyDefinitionsRestClient.GetBuiltIn(policyDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantPolicyDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicySetDefinitionCollection.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicySetDefinitionCollection.cs index 35445e5ce7ea..95d51d5b04b8 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicySetDefinitionCollection.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicySetDefinitionCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string policySetDefinitionName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName} + /// + /// + /// Operation Id + /// PolicySetDefinitions_GetBuiltIn + /// + /// + /// + /// The name of the policy set definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + using var scope = _tenantPolicySetDefinitionPolicySetDefinitionsClientDiagnostics.CreateScope("TenantPolicySetDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantPolicySetDefinitionPolicySetDefinitionsRestClient.GetBuiltInAsync(policySetDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantPolicySetDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName} + /// + /// + /// Operation Id + /// PolicySetDefinitions_GetBuiltIn + /// + /// + /// + /// The name of the policy set definition to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policySetDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + using var scope = _tenantPolicySetDefinitionPolicySetDefinitionsClientDiagnostics.CreateScope("TenantPolicySetDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantPolicySetDefinitionPolicySetDefinitionsRestClient.GetBuiltIn(policySetDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantPolicySetDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/samples/Generated/Samples/Sample_MoverResourceCollection.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/samples/Generated/Samples/Sample_MoverResourceCollection.cs index 480ab504c10c..2903505e85be 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/samples/Generated/Samples/Sample_MoverResourceCollection.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/samples/Generated/Samples/Sample_MoverResourceCollection.cs @@ -181,5 +181,48 @@ public async Task Exists_MoveResourcesGet() Console.WriteLine($"Succeeded: {result}"); } + + // MoveResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MoveResourcesGet() + { + // Generated from example definition: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2023-08-01/examples/MoveResources_Get.json + // this example is just showing the usage of "MoveResources_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 MoverResourceSetResource created on azure + // for more information of creating MoverResourceSetResource, please refer to the document of MoverResourceSetResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string moverResourceSetName = "movecollection1"; + ResourceIdentifier moverResourceSetResourceId = MoverResourceSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, moverResourceSetName); + MoverResourceSetResource moverResourceSet = client.GetMoverResourceSetResource(moverResourceSetResourceId); + + // get the collection of this MoverResource + MoverResourceCollection collection = moverResourceSet.GetMoverResources(); + + // invoke the operation + string moverResourceName = "moveresourcename1"; + NullableResponse response = await collection.GetIfExistsAsync(moverResourceName); + MoverResource 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 + MoverResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/samples/Generated/Samples/Sample_MoverResourceSetCollection.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/samples/Generated/Samples/Sample_MoverResourceSetCollection.cs index b42eebb9a1dd..601faa6ac248 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/samples/Generated/Samples/Sample_MoverResourceSetCollection.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/samples/Generated/Samples/Sample_MoverResourceSetCollection.cs @@ -129,6 +129,48 @@ public async Task Exists_MoveCollectionsGet() Console.WriteLine($"Succeeded: {result}"); } + // MoveCollections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MoveCollectionsGet() + { + // Generated from example definition: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2023-08-01/examples/MoveCollections_Get.json + // this example is just showing the usage of "MoveCollections_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MoverResourceSetResource + MoverResourceSetCollection collection = resourceGroupResource.GetMoverResourceSets(); + + // invoke the operation + string moverResourceSetName = "movecollection1"; + NullableResponse response = await collection.GetIfExistsAsync(moverResourceSetName); + MoverResourceSetResource 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 + MoverResourceSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // MoveCollections_ListMoveCollectionsByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceCollection.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceCollection.cs index 48816fc336c8..8d854aebf57a 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceCollection.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string moverResourceName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName} + /// + /// + /// Operation Id + /// MoveResources_Get + /// + /// + /// + /// The Move Resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string moverResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(moverResourceName, nameof(moverResourceName)); + + using var scope = _moverResourceMoveResourcesClientDiagnostics.CreateScope("MoverResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _moverResourceMoveResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, moverResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MoverResource(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.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName} + /// + /// + /// Operation Id + /// MoveResources_Get + /// + /// + /// + /// The Move Resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string moverResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(moverResourceName, nameof(moverResourceName)); + + using var scope = _moverResourceMoveResourcesClientDiagnostics.CreateScope("MoverResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _moverResourceMoveResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, moverResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MoverResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetCollection.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetCollection.cs index d35e3fcd9b77..e261f1af2cc0 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetCollection.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string moverResourceSetName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName} + /// + /// + /// Operation Id + /// MoveCollections_Get + /// + /// + /// + /// The Move Collection Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string moverResourceSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(moverResourceSetName, nameof(moverResourceSetName)); + + using var scope = _moverResourceSetMoveCollectionsClientDiagnostics.CreateScope("MoverResourceSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _moverResourceSetMoveCollectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, moverResourceSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MoverResourceSetResource(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.Migrate/moveCollections/{moveCollectionName} + /// + /// + /// Operation Id + /// MoveCollections_Get + /// + /// + /// + /// The Move Collection Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string moverResourceSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(moverResourceSetName, nameof(moverResourceSetName)); + + using var scope = _moverResourceSetMoveCollectionsClientDiagnostics.CreateScope("MoverResourceSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _moverResourceSetMoveCollectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, moverResourceSetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MoverResourceSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmApplicationCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmApplicationCollection.cs index 3a6120e4fb03..fd0959dec1a9 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmApplicationCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmApplicationCollection.cs @@ -81,6 +81,48 @@ public async Task Exists_GetAManagedApplication() Console.WriteLine($"Succeeded: {result}"); } + // Get a managed application + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAManagedApplication() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Solutions/stable/2019-07-01/examples/getApplication.json + // this example is just showing the usage of "Applications_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ArmApplicationResource + ArmApplicationCollection collection = resourceGroupResource.GetArmApplications(); + + // invoke the operation + string applicationName = "myManagedApplication"; + NullableResponse response = await collection.GetIfExistsAsync(applicationName); + ArmApplicationResource 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 + ArmApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update managed application [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmApplicationDefinitionCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmApplicationDefinitionCollection.cs index b14e54546d5e..509d54696e8b 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmApplicationDefinitionCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmApplicationDefinitionCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetManagedApplicationDefinition() Console.WriteLine($"Succeeded: {result}"); } + // Get managed application definition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedApplicationDefinition() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Solutions/stable/2019-07-01/examples/getApplicationDefinition.json + // this example is just showing the usage of "ApplicationDefinitions_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 = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ArmApplicationDefinitionResource + ArmApplicationDefinitionCollection collection = resourceGroupResource.GetArmApplicationDefinitions(); + + // invoke the operation + string applicationDefinitionName = "myManagedApplicationDef"; + NullableResponse response = await collection.GetIfExistsAsync(applicationDefinitionName); + ArmApplicationDefinitionResource 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 + ArmApplicationDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update managed application definition [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmDeploymentScriptCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmDeploymentScriptCollection.cs index 6712bbbf4c46..2717bb7c95a0 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmDeploymentScriptCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_ArmDeploymentScriptCollection.cs @@ -346,6 +346,48 @@ public async Task Exists_DeploymentScriptsGet() Console.WriteLine($"Succeeded: {result}"); } + // DeploymentScriptsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DeploymentScriptsGet() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Get.json + // this example is just showing the usage of "DeploymentScripts_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 = "script-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ArmDeploymentScriptResource + ArmDeploymentScriptCollection collection = resourceGroupResource.GetArmDeploymentScripts(); + + // invoke the operation + string scriptName = "MyDeploymentScript"; + NullableResponse response = await collection.GetIfExistsAsync(scriptName); + ArmDeploymentScriptResource 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 + ArmDeploymentScriptData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DeploymentScriptsList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_TemplateSpecCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_TemplateSpecCollection.cs index b1b0a3281e35..025fcd7ee520 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_TemplateSpecCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_TemplateSpecCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_TemplateSpecsGet() Console.WriteLine($"Succeeded: {result}"); } + // TemplateSpecsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TemplateSpecsGet() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/stable/2021-05-01/examples/TemplateSpecsGet.json + // this example is just showing the usage of "TemplateSpecs_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 = "templateSpecRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this TemplateSpecResource + TemplateSpecCollection collection = resourceGroupResource.GetTemplateSpecs(); + + // invoke the operation + string templateSpecName = "simpleTemplateSpec"; + NullableResponse response = await collection.GetIfExistsAsync(templateSpecName); + TemplateSpecResource 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 + TemplateSpecData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TemplateSpecsListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_TemplateSpecVersionCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_TemplateSpecVersionCollection.cs index fc9bf84d4414..54531087b68b 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_TemplateSpecVersionCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/samples/Generated/Samples/Sample_TemplateSpecVersionCollection.cs @@ -133,6 +133,49 @@ public async Task Exists_TemplateSpecVersionsGet() Console.WriteLine($"Succeeded: {result}"); } + // TemplateSpecVersionsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TemplateSpecVersionsGet() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/stable/2021-05-01/examples/TemplateSpecVersionsGet.json + // this example is just showing the usage of "TemplateSpecVersions_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 TemplateSpecResource created on azure + // for more information of creating TemplateSpecResource, please refer to the document of TemplateSpecResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "templateSpecRG"; + string templateSpecName = "simpleTemplateSpec"; + ResourceIdentifier templateSpecResourceId = TemplateSpecResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, templateSpecName); + TemplateSpecResource templateSpec = client.GetTemplateSpecResource(templateSpecResourceId); + + // get the collection of this TemplateSpecVersionResource + TemplateSpecVersionCollection collection = templateSpec.GetTemplateSpecVersions(); + + // invoke the operation + string templateSpecVersion = "v1.0"; + NullableResponse response = await collection.GetIfExistsAsync(templateSpecVersion); + TemplateSpecVersionResource 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 + TemplateSpecVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TemplateSpecVersions_List [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationCollection.cs index e8d94670e74d..bf9695321b9d 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string applicationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the managed application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _armApplicationApplicationsClientDiagnostics.CreateScope("ArmApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _armApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, applicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmApplicationResource(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.Solutions/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the managed application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _armApplicationApplicationsClientDiagnostics.CreateScope("ArmApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _armApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, applicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationDefinitionCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationDefinitionCollection.cs index d8be1bfe8da1..669aac679b64 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationDefinitionCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationDefinitionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string applicationDefinitionName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName} + /// + /// + /// Operation Id + /// ApplicationDefinitions_Get + /// + /// + /// + /// The name of the managed application definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationDefinitionName, nameof(applicationDefinitionName)); + + using var scope = _armApplicationDefinitionApplicationDefinitionsClientDiagnostics.CreateScope("ArmApplicationDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _armApplicationDefinitionApplicationDefinitionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, applicationDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmApplicationDefinitionResource(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.Solutions/applicationDefinitions/{applicationDefinitionName} + /// + /// + /// Operation Id + /// ApplicationDefinitions_Get + /// + /// + /// + /// The name of the managed application definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationDefinitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationDefinitionName, nameof(applicationDefinitionName)); + + using var scope = _armApplicationDefinitionApplicationDefinitionsClientDiagnostics.CreateScope("ArmApplicationDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _armApplicationDefinitionApplicationDefinitionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, applicationDefinitionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmApplicationDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentCollection.cs index 1257a104b67b..0bd281b128a9 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentCollection.cs @@ -319,6 +319,80 @@ public virtual Response Exists(string deploymentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.GetAtScopeAsync(Id, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.GetAtScope(Id, deploymentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentScriptCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentScriptCollection.cs index 53f3c9efc24d..944af7b9fb16 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentScriptCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentScriptCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string scriptName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName} + /// + /// + /// Operation Id + /// DeploymentScripts_Get + /// + /// + /// + /// Name of the deployment script. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scriptName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptName, nameof(scriptName)); + + using var scope = _armDeploymentScriptDeploymentScriptsClientDiagnostics.CreateScope("ArmDeploymentScriptCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _armDeploymentScriptDeploymentScriptsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, scriptName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentScriptResource(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.Resources/deploymentScripts/{scriptName} + /// + /// + /// Operation Id + /// DeploymentScripts_Get + /// + /// + /// + /// Name of the deployment script. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scriptName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scriptName, nameof(scriptName)); + + using var scope = _armDeploymentScriptDeploymentScriptsClientDiagnostics.CreateScope("ArmDeploymentScriptCollection.GetIfExists"); + scope.Start(); + try + { + var response = _armDeploymentScriptDeploymentScriptsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, scriptName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentScriptResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/JitRequestCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/JitRequestCollection.cs index 7f4cee76c190..8a54d5e54b2d 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/JitRequestCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/JitRequestCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string jitRequestName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName} + /// + /// + /// Operation Id + /// JitRequests_Get + /// + /// + /// + /// The name of the JIT request. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jitRequestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jitRequestName, nameof(jitRequestName)); + + using var scope = _jitRequestClientDiagnostics.CreateScope("JitRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _jitRequestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, jitRequestName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JitRequestResource(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.Solutions/jitRequests/{jitRequestName} + /// + /// + /// Operation Id + /// JitRequests_Get + /// + /// + /// + /// The name of the JIT request. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jitRequestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jitRequestName, nameof(jitRequestName)); + + using var scope = _jitRequestClientDiagnostics.CreateScope("JitRequestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _jitRequestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, jitRequestName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JitRequestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecCollection.cs index 247796801ad6..3bdc778f6b23 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecCollection.cs @@ -330,6 +330,82 @@ public virtual Response Exists(string templateSpecName, TemplateSpecExpand } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName} + /// + /// + /// Operation Id + /// TemplateSpecs_Get + /// + /// + /// + /// Name of the Template Spec. + /// Allows for expansion of additional Template Spec details in the response. Optional. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string templateSpecName, TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(templateSpecName, nameof(templateSpecName)); + + using var scope = _templateSpecClientDiagnostics.CreateScope("TemplateSpecCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _templateSpecRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, templateSpecName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TemplateSpecResource(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.Resources/templateSpecs/{templateSpecName} + /// + /// + /// Operation Id + /// TemplateSpecs_Get + /// + /// + /// + /// Name of the Template Spec. + /// Allows for expansion of additional Template Spec details in the response. Optional. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string templateSpecName, TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(templateSpecName, nameof(templateSpecName)); + + using var scope = _templateSpecClientDiagnostics.CreateScope("TemplateSpecCollection.GetIfExists"); + scope.Start(); + try + { + var response = _templateSpecRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, templateSpecName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TemplateSpecResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecVersionCollection.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecVersionCollection.cs index 79cf8e0f3afb..dfcd857f2797 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecVersionCollection.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecVersionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string templateSpecVersion, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion} + /// + /// + /// Operation Id + /// TemplateSpecVersions_Get + /// + /// + /// + /// The version of the Template Spec. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string templateSpecVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(templateSpecVersion, nameof(templateSpecVersion)); + + using var scope = _templateSpecVersionClientDiagnostics.CreateScope("TemplateSpecVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _templateSpecVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, templateSpecVersion, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TemplateSpecVersionResource(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.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion} + /// + /// + /// Operation Id + /// TemplateSpecVersions_Get + /// + /// + /// + /// The version of the Template Spec. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string templateSpecVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(templateSpecVersion, nameof(templateSpecVersion)); + + using var scope = _templateSpecVersionClientDiagnostics.CreateScope("TemplateSpecVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _templateSpecVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, templateSpecVersion, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TemplateSpecVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionCollection.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionCollection.cs index 6c091e262a38..24355c348672 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionCollection.cs @@ -131,6 +131,49 @@ public async Task Exists_PrivateEndpointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionGet() + { + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnections_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 SearchServiceResource created on azure + // for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string searchServiceName = "mysearchservice"; + ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName); + SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId); + + // get the collection of this SearchPrivateEndpointConnectionResource + SearchPrivateEndpointConnectionCollection collection = searchService.GetSearchPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + SearchPrivateEndpointConnectionResource 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 + SearchPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListPrivateEndpointConnectionsByService [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceCollection.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceCollection.cs index f1f403e16fc7..458d3ae822b3 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceCollection.cs @@ -427,6 +427,48 @@ public async Task Exists_SearchGetService() Console.WriteLine($"Succeeded: {result}"); } + // SearchGetService + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SearchGetService() + { + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetService.json + // this example is just showing the usage of "Services_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SearchServiceResource + SearchServiceCollection collection = resourceGroupResource.GetSearchServices(); + + // invoke the operation + string searchServiceName = "mysearchservice"; + NullableResponse response = await collection.GetIfExistsAsync(searchServiceName); + SearchServiceResource 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 + SearchServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SearchListServicesByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResourceCollection.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResourceCollection.cs index 0fe05f0190fe..b2faff876621 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResourceCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResourceCollection.cs @@ -130,6 +130,49 @@ public async Task Exists_SharedPrivateLinkResourceGet() Console.WriteLine($"Succeeded: {result}"); } + // SharedPrivateLinkResourceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SharedPrivateLinkResourceGet() + { + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetSharedPrivateLinkResource.json + // this example is just showing the usage of "SharedPrivateLinkResources_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 SearchServiceResource created on azure + // for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string searchServiceName = "mysearchservice"; + ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName); + SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId); + + // get the collection of this SharedSearchServicePrivateLinkResource + SharedSearchServicePrivateLinkResourceCollection collection = searchService.GetSharedSearchServicePrivateLinkResources(); + + // invoke the operation + string sharedPrivateLinkResourceName = "testResource"; + NullableResponse response = await collection.GetIfExistsAsync(sharedPrivateLinkResourceName); + SharedSearchServicePrivateLinkResource 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 + SharedSearchServicePrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListSharedPrivateLinkResourcesByService [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchPrivateEndpointConnectionCollection.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchPrivateEndpointConnectionCollection.cs index 6e7e52ebb86a..2bf1f5f252e9 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchPrivateEndpointConnectionCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchPrivateEndpointConnectionCollection.cs @@ -332,6 +332,82 @@ public virtual Response Exists(string privateEndpointConnectionName, Searc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection to the Azure Cognitive Search service with the specified resource group. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _searchPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("SearchPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _searchPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, searchManagementRequestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SearchPrivateEndpointConnectionResource(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.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection to the Azure Cognitive Search service with the specified resource group. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _searchPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("SearchPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _searchPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, searchManagementRequestOptions, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SearchPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceCollection.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceCollection.cs index e0bbd7753b71..a8d03a9395ef 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceCollection.cs @@ -333,6 +333,82 @@ public virtual Response Exists(string searchServiceName, SearchManagementR } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the Azure Cognitive Search service associated with the specified resource group. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(searchServiceName, nameof(searchServiceName)); + + using var scope = _searchServiceServicesClientDiagnostics.CreateScope("SearchServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _searchServiceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, searchServiceName, searchManagementRequestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SearchServiceResource(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.Search/searchServices/{searchServiceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the Azure Cognitive Search service associated with the specified resource group. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(searchServiceName, nameof(searchServiceName)); + + using var scope = _searchServiceServicesClientDiagnostics.CreateScope("SearchServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _searchServiceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, searchServiceName, searchManagementRequestOptions, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SearchServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/SharedSearchServicePrivateLinkResourceCollection.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/SharedSearchServicePrivateLinkResourceCollection.cs index db95c3ab6d72..c17ad28d8989 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/SharedSearchServicePrivateLinkResourceCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/SharedSearchServicePrivateLinkResourceCollection.cs @@ -332,6 +332,82 @@ public virtual Response Exists(string sharedPrivateLinkResourceName, Searc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResources_Get + /// + /// + /// + /// The name of the shared private link resource managed by the Azure Cognitive Search service within the specified resource group. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sharedPrivateLinkResourceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _sharedSearchServicePrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("SharedSearchServicePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sharedSearchServicePrivateLinkResourceSharedPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, searchManagementRequestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SharedSearchServicePrivateLinkResource(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.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResources_Get + /// + /// + /// + /// The name of the shared private link resource managed by the Azure Cognitive Search service within the specified resource group. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sharedPrivateLinkResourceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _sharedSearchServicePrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("SharedSearchServicePrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sharedSearchServicePrivateLinkResourceSharedPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, searchManagementRequestOptions, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SharedSearchServicePrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AdaptiveApplicationControlGroupCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AdaptiveApplicationControlGroupCollection.cs index d9326408cdca..4bca789f4069 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AdaptiveApplicationControlGroupCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AdaptiveApplicationControlGroupCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetsAConfiguredApplicationControlVMServerGroup() Console.WriteLine($"Succeeded: {result}"); } + // Gets a configured application control VM/server group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAConfiguredApplicationControlVMServerGroup() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/GetAdaptiveApplicationControlsGroup_example.json + // this example is just showing the usage of "AdaptiveApplicationControls_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 SecurityCenterLocationResource created on azure + // for more information of creating SecurityCenterLocationResource, please refer to the document of SecurityCenterLocationResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + AzureLocation ascLocation = new AzureLocation("centralus"); + ResourceIdentifier securityCenterLocationResourceId = SecurityCenterLocationResource.CreateResourceIdentifier(subscriptionId, ascLocation); + SecurityCenterLocationResource securityCenterLocation = client.GetSecurityCenterLocationResource(securityCenterLocationResourceId); + + // get the collection of this AdaptiveApplicationControlGroupResource + AdaptiveApplicationControlGroupCollection collection = securityCenterLocation.GetAdaptiveApplicationControlGroups(); + + // invoke the operation + string groupName = "ERELGROUP1"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + AdaptiveApplicationControlGroupResource 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 + AdaptiveApplicationControlGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update an application control machine group by adding a new application [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AdaptiveNetworkHardeningCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AdaptiveNetworkHardeningCollection.cs index ec598e1e8165..05dfed9bf622 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AdaptiveNetworkHardeningCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AdaptiveNetworkHardeningCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -125,5 +126,50 @@ public async Task Exists_GetASingleAdaptiveNetworkHardeningResource() Console.WriteLine($"Succeeded: {result}"); } + + // Get a single Adaptive Network Hardening resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASingleAdaptiveNetworkHardeningResource() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AdaptiveNetworkHardenings/GetAdaptiveNetworkHardening_example.json + // this example is just showing the usage of "AdaptiveNetworkHardenings_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 = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AdaptiveNetworkHardeningResource + string resourceNamespace = "Microsoft.Compute"; + string resourceType = "virtualMachines"; + string resourceName = "vm1"; + AdaptiveNetworkHardeningCollection collection = resourceGroupResource.GetAdaptiveNetworkHardenings(resourceNamespace, resourceType, resourceName); + + // invoke the operation + string adaptiveNetworkHardeningResourceName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(adaptiveNetworkHardeningResourceName); + AdaptiveNetworkHardeningResource 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 + AdaptiveNetworkHardeningData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AutoProvisioningSettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AutoProvisioningSettingCollection.cs index fd6a72915bbd..53f4b04a2950 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AutoProvisioningSettingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_AutoProvisioningSettingCollection.cs @@ -116,6 +116,47 @@ public async Task Exists_GetAnAutoProvisioningSettingForSubscription() Console.WriteLine($"Succeeded: {result}"); } + // Get an auto provisioning setting for subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnAutoProvisioningSettingForSubscription() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/GetAutoProvisioningSettingSubscription_example.json + // this example is just showing the usage of "AutoProvisioningSettings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this AutoProvisioningSettingResource + AutoProvisioningSettingCollection collection = subscriptionResource.GetAutoProvisioningSettings(); + + // invoke the operation + string settingName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(settingName); + AutoProvisioningSettingResource 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 + AutoProvisioningSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create auto provisioning settings for subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ComplianceResultCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ComplianceResultCollection.cs index 436e4826c806..1c8583831089 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ComplianceResultCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ComplianceResultCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -109,5 +110,45 @@ public async Task Exists_GetComplianceResultsOnSubscription() Console.WriteLine($"Succeeded: {result}"); } + + // Get compliance results on subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetComplianceResultsOnSubscription() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/GetComplianceResults_example.json + // this example is just showing the usage of "ComplianceResults_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ComplianceResultResource + string resourceId = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + ComplianceResultCollection collection = client.GetComplianceResults(scopeId); + + // invoke the operation + string complianceResultName = "DesignateMoreThanOneOwner"; + NullableResponse response = await collection.GetIfExistsAsync(complianceResultName); + ComplianceResultResource 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 + ComplianceResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_CustomAssessmentAutomationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_CustomAssessmentAutomationCollection.cs index fe99fe609763..a71ff48c64a7 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_CustomAssessmentAutomationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_CustomAssessmentAutomationCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetACustomAssessmentAutomation() Console.WriteLine($"Succeeded: {result}"); } + // Get a Custom Assessment Automation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACustomAssessmentAutomation() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationGet_example.json + // this example is just showing the usage of "CustomAssessmentAutomations_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 = "e5d1b86c-3051-44d5-8802-aa65d45a279b"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CustomAssessmentAutomationResource + CustomAssessmentAutomationCollection collection = resourceGroupResource.GetCustomAssessmentAutomations(); + + // invoke the operation + string customAssessmentAutomationName = "MyCustomAssessmentAutomation"; + NullableResponse response = await collection.GetIfExistsAsync(customAssessmentAutomationName); + CustomAssessmentAutomationResource 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 + CustomAssessmentAutomationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a Custom Assessment Automation [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_CustomEntityStoreAssignmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_CustomEntityStoreAssignmentCollection.cs index e09814cebd6d..d6ef9d256a5c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_CustomEntityStoreAssignmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_CustomEntityStoreAssignmentCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetACustomEntityStoreAssignment() Console.WriteLine($"Succeeded: {result}"); } + // Get a custom entity store assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACustomEntityStoreAssignment() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentGet_example.json + // this example is just showing the usage of "CustomEntityStoreAssignments_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 = "e5d1b86c-3051-44d5-8802-aa65d45a279b"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CustomEntityStoreAssignmentResource + CustomEntityStoreAssignmentCollection collection = resourceGroupResource.GetCustomEntityStoreAssignments(); + + // invoke the operation + string customEntityStoreAssignmentName = "33e7cc6e-a139-4723-a0e5-76993aee0771"; + NullableResponse response = await collection.GetIfExistsAsync(customEntityStoreAssignmentName); + CustomEntityStoreAssignmentResource 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 + CustomEntityStoreAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a custom entity store assignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_DeviceSecurityGroupCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_DeviceSecurityGroupCollection.cs index 497ea7e06872..ef2389ea61fb 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_DeviceSecurityGroupCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_DeviceSecurityGroupCollection.cs @@ -113,6 +113,46 @@ public async Task Exists_GetADeviceSecurityGroupForTheSpecifiedIoTHubResource() Console.WriteLine($"Succeeded: {result}"); } + // Get a device security group for the specified IoT Hub resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADeviceSecurityGroupForTheSpecifiedIoTHubResource() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/GetDeviceSecurityGroups_example.json + // this example is just showing the usage of "DeviceSecurityGroups_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DeviceSecurityGroupResource + string resourceId = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + DeviceSecurityGroupCollection collection = client.GetDeviceSecurityGroups(scopeId); + + // invoke the operation + string deviceSecurityGroupName = "samplesecuritygroup"; + NullableResponse response = await collection.GetIfExistsAsync(deviceSecurityGroupName); + DeviceSecurityGroupResource 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 + DeviceSecurityGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a device security group for the specified IoT hub resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_GovernanceAssignmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_GovernanceAssignmentCollection.cs index 8437a39f5328..9852719106ae 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_GovernanceAssignmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_GovernanceAssignmentCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetGovernanceAssignmentBySpecificGovernanceAssignmentKe Console.WriteLine($"Succeeded: {result}"); } + // Get governanceAssignment by specific governanceAssignmentKey + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetGovernanceAssignmentBySpecificGovernanceAssignmentKey() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/GetGovernanceAssignment_example.json + // this example is just showing the usage of "GovernanceAssignments_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 SecurityAssessmentResource created on azure + // for more information of creating SecurityAssessmentResource, please refer to the document of SecurityAssessmentResource + string scope = "subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012"; + string assessmentName = "6b9421dd-5555-2251-9b3d-2be58e2f82cd"; + ResourceIdentifier securityAssessmentResourceId = SecurityAssessmentResource.CreateResourceIdentifier(scope, assessmentName); + SecurityAssessmentResource securityAssessment = client.GetSecurityAssessmentResource(securityAssessmentResourceId); + + // get the collection of this GovernanceAssignmentResource + GovernanceAssignmentCollection collection = securityAssessment.GetGovernanceAssignments(); + + // invoke the operation + string assignmentKey = "6634ff9f-127b-4bf2-8e6e-b1737f5e789c"; + NullableResponse response = await collection.GetIfExistsAsync(assignmentKey); + GovernanceAssignmentResource 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 + GovernanceAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Governance assignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_GovernanceRuleCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_GovernanceRuleCollection.cs index c8d4efbb7781..90a7ab88e12b 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_GovernanceRuleCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_GovernanceRuleCollection.cs @@ -181,6 +181,46 @@ public async Task Exists_GetAGovernanceRuleOverManagementGroupScope() Console.WriteLine($"Succeeded: {result}"); } + // Get a governance rule over management group scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGovernanceRuleOverManagementGroupScope() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetManagementGroupGovernanceRule_example.json + // this example is just showing the usage of "GovernanceRules_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GovernanceRuleResource + string scope = "providers/Microsoft.Management/managementGroups/contoso"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + GovernanceRuleCollection collection = client.GetGovernanceRules(scopeId); + + // invoke the operation + string ruleId = "ad9a8e26-29d9-4829-bb30-e597a58cdbb8"; + NullableResponse response = await collection.GetIfExistsAsync(ruleId); + GovernanceRuleResource 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 + GovernanceRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a governance rule over security connector scope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -241,6 +281,46 @@ public async Task Exists_GetAGovernanceRuleOverSecurityConnectorScope() Console.WriteLine($"Succeeded: {result}"); } + // Get a governance rule over security connector scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGovernanceRuleOverSecurityConnectorScope() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRule_example.json + // this example is just showing the usage of "GovernanceRules_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GovernanceRuleResource + string scope = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + GovernanceRuleCollection collection = client.GetGovernanceRules(scopeId); + + // invoke the operation + string ruleId = "ad9a8e26-29d9-4829-bb30-e597a58cdbb8"; + NullableResponse response = await collection.GetIfExistsAsync(ruleId); + GovernanceRuleResource 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 + GovernanceRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a governance rule over subscription scope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -301,6 +381,46 @@ public async Task Exists_GetAGovernanceRuleOverSubscriptionScope() Console.WriteLine($"Succeeded: {result}"); } + // Get a governance rule over subscription scope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGovernanceRuleOverSubscriptionScope() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetGovernanceRule_example.json + // this example is just showing the usage of "GovernanceRules_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GovernanceRuleResource + string scope = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + GovernanceRuleCollection collection = client.GetGovernanceRules(scopeId); + + // invoke the operation + string ruleId = "ad9a8e26-29d9-4829-bb30-e597a58cdbb8"; + NullableResponse response = await collection.GetIfExistsAsync(ruleId); + GovernanceRuleResource 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 + GovernanceRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update governance rule over management group scope [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingCollection.cs index 29b861fda933..fd6036f586a0 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingCollection.cs @@ -115,6 +115,47 @@ public async Task Exists_GetAIngestionSettingOnSubscription() Console.WriteLine($"Succeeded: {result}"); } + // Get a ingestion setting on subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAIngestionSettingOnSubscription() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/GetIngestionSetting_example.json + // this example is just showing the usage of "IngestionSettings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this IngestionSettingResource + IngestionSettingCollection collection = subscriptionResource.GetIngestionSettings(); + + // invoke the operation + string ingestionSettingName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(ingestionSettingName); + IngestionSettingResource 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 + IngestionSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create an ingestion setting for subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecurityAggregatedAlertCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecurityAggregatedAlertCollection.cs index e87dea291e54..532e87184551 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecurityAggregatedAlertCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecurityAggregatedAlertCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetTheAggregatedSecurityAnalyticsAlertOfYoursIoTSecurit Console.WriteLine($"Succeeded: {result}"); } + + // Get the aggregated security analytics alert of yours IoT Security solution. This aggregation is performed by alert name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheAggregatedSecurityAnalyticsAlertOfYoursIoTSecuritySolutionThisAggregationIsPerformedByAlertName() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlert.json + // this example is just showing the usage of "IotSecuritySolutionsAnalyticsAggregatedAlert_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 IotSecuritySolutionAnalyticsModelResource created on azure + // for more information of creating IotSecuritySolutionAnalyticsModelResource, please refer to the document of IotSecuritySolutionAnalyticsModelResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string resourceGroupName = "MyGroup"; + string solutionName = "default"; + ResourceIdentifier iotSecuritySolutionAnalyticsModelResourceId = IotSecuritySolutionAnalyticsModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, solutionName); + IotSecuritySolutionAnalyticsModelResource iotSecuritySolutionAnalyticsModel = client.GetIotSecuritySolutionAnalyticsModelResource(iotSecuritySolutionAnalyticsModelResourceId); + + // get the collection of this IotSecurityAggregatedAlertResource + IotSecurityAggregatedAlertCollection collection = iotSecuritySolutionAnalyticsModel.GetIotSecurityAggregatedAlerts(); + + // invoke the operation + string aggregatedAlertName = "IoT_Bruteforce_Fail/2019-02-02"; + NullableResponse response = await collection.GetIfExistsAsync(aggregatedAlertName); + IotSecurityAggregatedAlertResource 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 + IotSecurityAggregatedAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecurityAggregatedRecommendationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecurityAggregatedRecommendationCollection.cs index ff19fd2aabe5..b4d36351960f 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecurityAggregatedRecommendationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecurityAggregatedRecommendationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetTheAggregatedSecurityAnalyticsRecommendationOfYoursI Console.WriteLine($"Succeeded: {result}"); } + // Get the aggregated security analytics recommendation of yours IoT Security solution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheAggregatedSecurityAnalyticsRecommendationOfYoursIoTSecuritySolution() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendation.json + // this example is just showing the usage of "IotSecuritySolutionsAnalyticsRecommendation_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 IotSecuritySolutionAnalyticsModelResource created on azure + // for more information of creating IotSecuritySolutionAnalyticsModelResource, please refer to the document of IotSecuritySolutionAnalyticsModelResource + string subscriptionId = "075423e9-7d33-4166-8bdf-3920b04e3735"; + string resourceGroupName = "IoTEdgeResources"; + string solutionName = "default"; + ResourceIdentifier iotSecuritySolutionAnalyticsModelResourceId = IotSecuritySolutionAnalyticsModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, solutionName); + IotSecuritySolutionAnalyticsModelResource iotSecuritySolutionAnalyticsModel = client.GetIotSecuritySolutionAnalyticsModelResource(iotSecuritySolutionAnalyticsModelResourceId); + + // get the collection of this IotSecurityAggregatedRecommendationResource + IotSecurityAggregatedRecommendationCollection collection = iotSecuritySolutionAnalyticsModel.GetIotSecurityAggregatedRecommendations(); + + // invoke the operation + string aggregatedRecommendationName = "OpenPortsOnDevice"; + NullableResponse response = await collection.GetIfExistsAsync(aggregatedRecommendationName); + IotSecurityAggregatedRecommendationResource 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 + IotSecurityAggregatedRecommendationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get the list of aggregated security analytics recommendations of yours IoT Security solution [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecuritySolutionCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecuritySolutionCollection.cs index 799c458b2c3d..44472b2f9104 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecuritySolutionCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IotSecuritySolutionCollection.cs @@ -156,6 +156,48 @@ public async Task Exists_GetAIoTSecuritySolution() Console.WriteLine($"Succeeded: {result}"); } + // Get a IoT security solution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAIoTSecuritySolution() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolution.json + // this example is just showing the usage of "IotSecuritySolution_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 = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string resourceGroupName = "MyGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this IotSecuritySolutionResource + IotSecuritySolutionCollection collection = resourceGroupResource.GetIotSecuritySolutions(); + + // invoke the operation + string solutionName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(solutionName); + IotSecuritySolutionResource 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 + IotSecuritySolutionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a IoT security solution [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_JitNetworkAccessPolicyCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_JitNetworkAccessPolicyCollection.cs index ac12e4a2751b..72d63640ce49 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_JitNetworkAccessPolicyCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_JitNetworkAccessPolicyCollection.cs @@ -123,6 +123,49 @@ public async Task Exists_GetJITNetworkAccessPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get JIT network access policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetJITNetworkAccessPolicy() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPolicy_example.json + // this example is just showing the usage of "JitNetworkAccessPolicies_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 = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string resourceGroupName = "myRg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this JitNetworkAccessPolicyResource + AzureLocation ascLocation = new AzureLocation("westeurope"); + JitNetworkAccessPolicyCollection collection = resourceGroupResource.GetJitNetworkAccessPolicies(ascLocation); + + // invoke the operation + string jitNetworkAccessPolicyName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(jitNetworkAccessPolicyName); + JitNetworkAccessPolicyResource 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 + JitNetworkAccessPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create JIT network access policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceAssessmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceAssessmentCollection.cs index 5d7a1c554cf6..320d30250db9 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceAssessmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceAssessmentCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetSelectedRegulatoryComplianceAssessmentDetailsAndStat Console.WriteLine($"Succeeded: {result}"); } + + // Get selected regulatory compliance assessment details and state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSelectedRegulatoryComplianceAssessmentDetailsAndState() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceAssessment_example.json + // this example is just showing the usage of "RegulatoryComplianceAssessments_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 RegulatoryComplianceControlResource created on azure + // for more information of creating RegulatoryComplianceControlResource, please refer to the document of RegulatoryComplianceControlResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string regulatoryComplianceStandardName = "PCI-DSS-3.2"; + string regulatoryComplianceControlName = "1.1"; + ResourceIdentifier regulatoryComplianceControlResourceId = RegulatoryComplianceControlResource.CreateResourceIdentifier(subscriptionId, regulatoryComplianceStandardName, regulatoryComplianceControlName); + RegulatoryComplianceControlResource regulatoryComplianceControl = client.GetRegulatoryComplianceControlResource(regulatoryComplianceControlResourceId); + + // get the collection of this RegulatoryComplianceAssessmentResource + RegulatoryComplianceAssessmentCollection collection = regulatoryComplianceControl.GetRegulatoryComplianceAssessments(); + + // invoke the operation + string regulatoryComplianceAssessmentName = "968548cb-02b3-8cd2-11f8-0cf64ab1a347"; + NullableResponse response = await collection.GetIfExistsAsync(regulatoryComplianceAssessmentName); + RegulatoryComplianceAssessmentResource 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 + RegulatoryComplianceAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceControlCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceControlCollection.cs index 6c37037d02c1..1952afcb045c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceControlCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceControlCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,5 +116,47 @@ public async Task Exists_GetSelectedRegulatoryComplianceControlDetailsAndState() Console.WriteLine($"Succeeded: {result}"); } + + // Get selected regulatory compliance control details and state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSelectedRegulatoryComplianceControlDetailsAndState() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceControl_example.json + // this example is just showing the usage of "RegulatoryComplianceControls_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 RegulatoryComplianceStandardResource created on azure + // for more information of creating RegulatoryComplianceStandardResource, please refer to the document of RegulatoryComplianceStandardResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string regulatoryComplianceStandardName = "PCI-DSS-3.2"; + ResourceIdentifier regulatoryComplianceStandardResourceId = RegulatoryComplianceStandardResource.CreateResourceIdentifier(subscriptionId, regulatoryComplianceStandardName); + RegulatoryComplianceStandardResource regulatoryComplianceStandard = client.GetRegulatoryComplianceStandardResource(regulatoryComplianceStandardResourceId); + + // get the collection of this RegulatoryComplianceControlResource + RegulatoryComplianceControlCollection collection = regulatoryComplianceStandard.GetRegulatoryComplianceControls(); + + // invoke the operation + string regulatoryComplianceControlName = "1.1"; + NullableResponse response = await collection.GetIfExistsAsync(regulatoryComplianceControlName); + RegulatoryComplianceControlResource 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 + RegulatoryComplianceControlData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceStandardCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceStandardCollection.cs index 70b4b63c8dfd..0945e06bf547 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceStandardCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_RegulatoryComplianceStandardCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_GetSelectedRegulatoryComplianceStandardDetailsAndState( Console.WriteLine($"Succeeded: {result}"); } + + // Get selected regulatory compliance standard details and state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSelectedRegulatoryComplianceStandardDetailsAndState() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceStandard_example.json + // this example is just showing the usage of "RegulatoryComplianceStandards_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this RegulatoryComplianceStandardResource + RegulatoryComplianceStandardCollection collection = subscriptionResource.GetRegulatoryComplianceStandards(); + + // invoke the operation + string regulatoryComplianceStandardName = "PCI-DSS-3.2"; + NullableResponse response = await collection.GetIfExistsAsync(regulatoryComplianceStandardName); + RegulatoryComplianceStandardResource 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 + RegulatoryComplianceStandardData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ResourceGroupSecurityAlertCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ResourceGroupSecurityAlertCollection.cs index fc1d0db10219..8f1cd504acf7 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ResourceGroupSecurityAlertCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ResourceGroupSecurityAlertCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,5 +120,48 @@ public async Task Exists_GetSecurityAlertOnAResourceGroupFromASecurityDataLocati Console.WriteLine($"Succeeded: {result}"); } + + // Get security alert on a resource group from a security data location + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityAlertOnAResourceGroupFromASecurityDataLocation() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertResourceGroupLocation_example.json + // this example is just showing the usage of "Alerts_GetResourceGroupLevel" 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 = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string resourceGroupName = "myRg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ResourceGroupSecurityAlertResource + AzureLocation ascLocation = new AzureLocation("westeurope"); + ResourceGroupSecurityAlertCollection collection = resourceGroupResource.GetResourceGroupSecurityAlerts(ascLocation); + + // invoke the operation + string alertName = "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"; + NullableResponse response = await collection.GetIfExistsAsync(alertName); + ResourceGroupSecurityAlertResource 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 + SecurityAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ResourceGroupSecurityTaskCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ResourceGroupSecurityTaskCollection.cs index a605aa6f185b..78e3113791a6 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ResourceGroupSecurityTaskCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ResourceGroupSecurityTaskCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,5 +120,48 @@ public async Task Exists_GetSecurityRecommendationTaskInAResourceGroup() Console.WriteLine($"Succeeded: {result}"); } + + // Get security recommendation task in a resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityRecommendationTaskInAResourceGroup() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTaskResourceGroupLocation_example.json + // this example is just showing the usage of "Tasks_GetResourceGroupLevelTask" 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 = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string resourceGroupName = "myRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ResourceGroupSecurityTaskResource + AzureLocation ascLocation = new AzureLocation("westeurope"); + ResourceGroupSecurityTaskCollection collection = resourceGroupResource.GetResourceGroupSecurityTasks(ascLocation); + + // invoke the operation + string taskName = "d55b4dc0-779c-c66c-33e5-d7bce24c4222"; + NullableResponse response = await collection.GetIfExistsAsync(taskName); + ResourceGroupSecurityTaskResource 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 + SecurityTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecureScoreCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecureScoreCollection.cs index b1e826980110..a01123c29fd2 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecureScoreCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecureScoreCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_GetSingleSecureScore() Console.WriteLine($"Succeeded: {result}"); } + + // Get single secure score + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSingleSecureScore() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/GetSecureScoresSingle_example.json + // this example is just showing the usage of "SecureScores_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecureScoreResource + SecureScoreCollection collection = subscriptionResource.GetSecureScores(); + + // invoke the operation + string secureScoreName = "ascScore"; + NullableResponse response = await collection.GetIfExistsAsync(secureScoreName); + SecureScoreResource 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 + SecureScoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAlertsSuppressionRuleCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAlertsSuppressionRuleCollection.cs index 7b7842068ca1..1a0f8745ab2f 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAlertsSuppressionRuleCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAlertsSuppressionRuleCollection.cs @@ -151,6 +151,47 @@ public async Task Exists_GetSuppressionAlertRuleForSubscription() Console.WriteLine($"Succeeded: {result}"); } + // Get suppression alert rule for subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSuppressionAlertRuleForSubscription() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRule_example.json + // this example is just showing the usage of "AlertsSuppressionRules_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityAlertsSuppressionRuleResource + SecurityAlertsSuppressionRuleCollection collection = subscriptionResource.GetSecurityAlertsSuppressionRules(); + + // invoke the operation + string alertsSuppressionRuleName = "dismissIpAnomalyAlerts"; + NullableResponse response = await collection.GetIfExistsAsync(alertsSuppressionRuleName); + SecurityAlertsSuppressionRuleResource 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 + SecurityAlertsSuppressionRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update or create suppression rule for subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAssessmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAssessmentCollection.cs index d1c923606171..7a63c7c4c23c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAssessmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAssessmentCollection.cs @@ -78,6 +78,46 @@ public async Task Exists_GetSecurityRecommendationTaskFromSecurityDataLocation() Console.WriteLine($"Succeeded: {result}"); } + // Get security recommendation task from security data location + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityRecommendationTaskFromSecurityDataLocation() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/GetAssessment_example.json + // this example is just showing the usage of "Assessments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SecurityAssessmentResource + string resourceId = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + SecurityAssessmentCollection collection = client.GetSecurityAssessments(scopeId); + + // invoke the operation + string assessmentName = "21300918-b2e3-0346-785f-c77ff57d243b"; + NullableResponse response = await collection.GetIfExistsAsync(assessmentName); + SecurityAssessmentResource 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 + SecurityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get security recommendation task from security data location with expand parameter [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -140,6 +180,47 @@ public async Task Exists_GetSecurityRecommendationTaskFromSecurityDataLocationWi Console.WriteLine($"Succeeded: {result}"); } + // Get security recommendation task from security data location with expand parameter + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityRecommendationTaskFromSecurityDataLocationWithExpandParameter() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/GetAssessmentWithExpand_example.json + // this example is just showing the usage of "Assessments_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SecurityAssessmentResource + string resourceId = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + SecurityAssessmentCollection collection = client.GetSecurityAssessments(scopeId); + + // invoke the operation + string assessmentName = "21300918-b2e3-0346-785f-c77ff57d243b"; + SecurityAssessmentODataExpand? expand = SecurityAssessmentODataExpand.Links; + NullableResponse response = await collection.GetIfExistsAsync(assessmentName, expand: expand); + SecurityAssessmentResource 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 + SecurityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create security recommendation task on a resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAutomationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAutomationCollection.cs index 0c63957ada03..be55b7b56796 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAutomationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityAutomationCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_RetrieveASecurityAutomation() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a security automation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveASecurityAutomation() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/Automations/GetAutomationResourceGroup_example.json + // this example is just showing the usage of "Automations_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 = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; + string resourceGroupName = "exampleResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecurityAutomationResource + SecurityAutomationCollection collection = resourceGroupResource.GetSecurityAutomations(); + + // invoke the operation + string automationName = "exampleAutomation"; + NullableResponse response = await collection.GetIfExistsAsync(automationName); + SecurityAutomationResource 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 + SecurityAutomationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a security automation for all assessments (including all severities) [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCenterLocationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCenterLocationCollection.cs index b5194bacc2fb..9956387fed8f 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCenterLocationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCenterLocationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -113,5 +114,46 @@ public async Task Exists_GetSecurityDataLocation() Console.WriteLine($"Succeeded: {result}"); } + + // Get security data location + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityDataLocation() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/GetLocation_example.json + // this example is just showing the usage of "Locations_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityCenterLocationResource + SecurityCenterLocationCollection collection = subscriptionResource.GetSecurityCenterLocations(); + + // invoke the operation + AzureLocation ascLocation = new AzureLocation("centralus"); + NullableResponse response = await collection.GetIfExistsAsync(ascLocation); + SecurityCenterLocationResource 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 + SecurityCenterLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCenterPricingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCenterPricingCollection.cs index 78bdd9877087..651bbd45689e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCenterPricingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCenterPricingCollection.cs @@ -116,6 +116,47 @@ public async Task Exists_GetPricingsOnSubscriptionCloudPosturePlan() Console.WriteLine($"Succeeded: {result}"); } + // Get pricings on subscription - CloudPosture plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPricingsOnSubscriptionCloudPosturePlan() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameCloudPosture_example.json + // this example is just showing the usage of "Pricings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityCenterPricingResource + SecurityCenterPricingCollection collection = subscriptionResource.GetSecurityCenterPricings(); + + // invoke the operation + string pricingName = "CloudPosture"; + NullableResponse response = await collection.GetIfExistsAsync(pricingName); + SecurityCenterPricingResource 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 + SecurityCenterPricingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get pricings on subscription - Containers plan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -178,6 +219,47 @@ public async Task Exists_GetPricingsOnSubscriptionContainersPlan() Console.WriteLine($"Succeeded: {result}"); } + // Get pricings on subscription - Containers plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPricingsOnSubscriptionContainersPlan() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameContainers_example.json + // this example is just showing the usage of "Pricings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityCenterPricingResource + SecurityCenterPricingCollection collection = subscriptionResource.GetSecurityCenterPricings(); + + // invoke the operation + string pricingName = "Containers"; + NullableResponse response = await collection.GetIfExistsAsync(pricingName); + SecurityCenterPricingResource 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 + SecurityCenterPricingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get pricings on subscription - Dns plan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -240,6 +322,47 @@ public async Task Exists_GetPricingsOnSubscriptionDnsPlan() Console.WriteLine($"Succeeded: {result}"); } + // Get pricings on subscription - Dns plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPricingsOnSubscriptionDnsPlan() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameDns_example.json + // this example is just showing the usage of "Pricings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityCenterPricingResource + SecurityCenterPricingCollection collection = subscriptionResource.GetSecurityCenterPricings(); + + // invoke the operation + string pricingName = "Dns"; + NullableResponse response = await collection.GetIfExistsAsync(pricingName); + SecurityCenterPricingResource 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 + SecurityCenterPricingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get pricings on subscription - StorageAccounts plan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -302,6 +425,47 @@ public async Task Exists_GetPricingsOnSubscriptionStorageAccountsPlan() Console.WriteLine($"Succeeded: {result}"); } + // Get pricings on subscription - StorageAccounts plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPricingsOnSubscriptionStorageAccountsPlan() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameStorageAccounts_example.json + // this example is just showing the usage of "Pricings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityCenterPricingResource + SecurityCenterPricingCollection collection = subscriptionResource.GetSecurityCenterPricings(); + + // invoke the operation + string pricingName = "StorageAccounts"; + NullableResponse response = await collection.GetIfExistsAsync(pricingName); + SecurityCenterPricingResource 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 + SecurityCenterPricingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get pricings on subscription - VirtualMachines plan [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -364,6 +528,47 @@ public async Task Exists_GetPricingsOnSubscriptionVirtualMachinesPlan() Console.WriteLine($"Succeeded: {result}"); } + // Get pricings on subscription - VirtualMachines plan + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPricingsOnSubscriptionVirtualMachinesPlan() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameVirtualMachines_example.json + // this example is just showing the usage of "Pricings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityCenterPricingResource + SecurityCenterPricingCollection collection = subscriptionResource.GetSecurityCenterPricings(); + + // invoke the operation + string pricingName = "VirtualMachines"; + NullableResponse response = await collection.GetIfExistsAsync(pricingName); + SecurityCenterPricingResource 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 + SecurityCenterPricingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update pricing on subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCloudConnectorCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCloudConnectorCollection.cs index 24b90ec12fb6..120c33238ba6 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCloudConnectorCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityCloudConnectorCollection.cs @@ -116,6 +116,47 @@ public async Task Exists_DetailsOfASpecificCloudAccountConnector() Console.WriteLine($"Succeeded: {result}"); } + // Details of a specific cloud account connector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DetailsOfASpecificCloudAccountConnector() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/GetConnectorSubscription_example.json + // this example is just showing the usage of "Connectors_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityCloudConnectorResource + SecurityCloudConnectorCollection collection = subscriptionResource.GetSecurityCloudConnectors(); + + // invoke the operation + string connectorName = "aws_dev1"; + NullableResponse response = await collection.GetIfExistsAsync(connectorName); + SecurityCloudConnectorResource 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 + SecurityCloudConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AwsAssumeRole - Create a cloud account connector for a subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityComplianceCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityComplianceCollection.cs index 35360bb3c796..9da14bb60b16 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityComplianceCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityComplianceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -109,5 +110,45 @@ public async Task Exists_GetSecurityComplianceDataForADay() Console.WriteLine($"Succeeded: {result}"); } + + // Get security compliance data for a day + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityComplianceDataForADay() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/GetCompliance_example.json + // this example is just showing the usage of "Compliances_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SecurityComplianceResource + string scope = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + SecurityComplianceCollection collection = client.GetSecurityCompliances(scopeId); + + // invoke the operation + string complianceName = "2018-01-01Z"; + NullableResponse response = await collection.GetIfExistsAsync(complianceName); + SecurityComplianceResource 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 + SecurityComplianceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityConnectorApplicationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityConnectorApplicationCollection.cs index 3c3dc3624698..db9e1d6e0f54 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityConnectorApplicationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityConnectorApplicationCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetSecurityApplicationsBySpecificApplicationId() Console.WriteLine($"Succeeded: {result}"); } + // Get security applications by specific applicationId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityApplicationsBySpecificApplicationId() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/GetSecurityConnectorApplication_example.json + // this example is just showing the usage of "SecurityConnectorApplications_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 SecurityConnectorResource created on azure + // for more information of creating SecurityConnectorResource, please refer to the document of SecurityConnectorResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string resourceGroupName = "gcpResourceGroup"; + string securityConnectorName = "gcpconnector"; + ResourceIdentifier securityConnectorResourceId = SecurityConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, securityConnectorName); + SecurityConnectorResource securityConnector = client.GetSecurityConnectorResource(securityConnectorResourceId); + + // get the collection of this SecurityConnectorApplicationResource + SecurityConnectorApplicationCollection collection = securityConnector.GetSecurityConnectorApplications(); + + // invoke the operation + string applicationId = "ad9a8e26-29d9-4829-bb30-e597a58cdbb8"; + NullableResponse response = await collection.GetIfExistsAsync(applicationId); + SecurityConnectorApplicationResource 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 + SecurityApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create Application [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityConnectorCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityConnectorCollection.cs index d483c5c31d9a..587a731cbd5b 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityConnectorCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityConnectorCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_RetrieveASecurityConnector() Console.WriteLine($"Succeeded: {result}"); } + // Retrieve a security connector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RetrieveASecurityConnector() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json + // this example is just showing the usage of "SecurityConnectors_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 = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; + string resourceGroupName = "exampleResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecurityConnectorResource + SecurityConnectorCollection collection = resourceGroupResource.GetSecurityConnectors(); + + // invoke the operation + string securityConnectorName = "exampleSecurityConnectorName"; + NullableResponse response = await collection.GetIfExistsAsync(securityConnectorName); + SecurityConnectorResource 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 + SecurityConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a security connector [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityContactCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityContactCollection.cs index 990292e0882a..e5ace125aeb2 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityContactCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityContactCollection.cs @@ -116,6 +116,47 @@ public async Task Exists_GetASecurityContact() Console.WriteLine($"Succeeded: {result}"); } + // Get a security contact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASecurityContact() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/SecurityContacts/GetSecurityContact_example.json + // this example is just showing the usage of "SecurityContacts_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityContactResource + SecurityContactCollection collection = subscriptionResource.GetSecurityContacts(); + + // invoke the operation + string securityContactName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(securityContactName); + SecurityContactResource 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 + SecurityContactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create security contact data [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecuritySettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecuritySettingCollection.cs index 3d10a7356599..419260c7b370 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecuritySettingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecuritySettingCollection.cs @@ -116,6 +116,47 @@ public async Task Exists_GetASettingOnSubscription() Console.WriteLine($"Succeeded: {result}"); } + // Get a setting on subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASettingOnSubscription() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSetting_example.json + // this example is just showing the usage of "Settings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecuritySettingResource + SecuritySettingCollection collection = subscriptionResource.GetSecuritySettings(); + + // invoke the operation + SecuritySettingName settingName = SecuritySettingName.Wdatp; + NullableResponse response = await collection.GetIfExistsAsync(settingName); + SecuritySettingResource 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 + SecuritySettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a setting for subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecuritySubAssessmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecuritySubAssessmentCollection.cs index 6ec26576bed3..07c4b542d3ab 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecuritySubAssessmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecuritySubAssessmentCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,5 +116,47 @@ public async Task Exists_GetSecurityRecommendationTaskFromSecurityDataLocation() Console.WriteLine($"Succeeded: {result}"); } + + // Get security recommendation task from security data location + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityRecommendationTaskFromSecurityDataLocation() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/GetSubAssessment_example.json + // this example is just showing the usage of "SubAssessments_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 SecurityAssessmentResource created on azure + // for more information of creating SecurityAssessmentResource, please refer to the document of SecurityAssessmentResource + string scope = "subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/vm2"; + string assessmentName = "1195afff-c881-495e-9bc5-1486211ae03f"; + ResourceIdentifier securityAssessmentResourceId = SecurityAssessmentResource.CreateResourceIdentifier(scope, assessmentName); + SecurityAssessmentResource securityAssessment = client.GetSecurityAssessmentResource(securityAssessmentResourceId); + + // get the collection of this SecuritySubAssessmentResource + SecuritySubAssessmentCollection collection = securityAssessment.GetSecuritySubAssessments(); + + // invoke the operation + string subAssessmentName = "95f7da9c-a2a4-1322-0758-fcd24ef09b85"; + NullableResponse response = await collection.GetIfExistsAsync(subAssessmentName); + SecuritySubAssessmentResource 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 + SecuritySubAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityWorkspaceSettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityWorkspaceSettingCollection.cs index 8aa2d9036a6e..8dbbb5ab0a6c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityWorkspaceSettingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SecurityWorkspaceSettingCollection.cs @@ -115,6 +115,47 @@ public async Task Exists_GetAWorkspaceSettingOnSubscription() Console.WriteLine($"Succeeded: {result}"); } + // Get a workspace setting on subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkspaceSettingOnSubscription() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/GetWorkspaceSetting_example.json + // this example is just showing the usage of "WorkspaceSettings_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SecurityWorkspaceSettingResource + SecurityWorkspaceSettingCollection collection = subscriptionResource.GetSecurityWorkspaceSettings(); + + // invoke the operation + string workspaceSettingName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceSettingName); + SecurityWorkspaceSettingResource 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 + SecurityWorkspaceSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a workspace setting data for subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ServerVulnerabilityAssessmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ServerVulnerabilityAssessmentCollection.cs index 3367ed61a783..f602e6dd2f4c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ServerVulnerabilityAssessmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_ServerVulnerabilityAssessmentCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_GetAServerVulnerabilityAssessmentsOnboardingStatusOnARe Console.WriteLine($"Succeeded: {result}"); } + // Get a server vulnerability assessments onboarding status on a resource. Currently Microsoft.Security only supports the single 'default' resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerVulnerabilityAssessmentsOnboardingStatusOnAResourceCurrentlyMicrosoftSecurityOnlySupportsTheSingleDefaultResource() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/GetServerVulnerabilityAssessments_example.json + // this example is just showing the usage of "ServerVulnerabilityAssessment_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 = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ServerVulnerabilityAssessmentResource + string resourceNamespace = "Microsoft.Compute"; + string resourceType = "virtualMachines"; + string resourceName = "vm1"; + ServerVulnerabilityAssessmentCollection collection = resourceGroupResource.GetServerVulnerabilityAssessments(resourceNamespace, resourceType, resourceName); + + // invoke the operation + NullableResponse response = await collection.GetIfExistsAsync(); + ServerVulnerabilityAssessmentResource 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 + ServerVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a server vulnerability assessments on a resource. Only 'default' resource is supported. Once creating the resource, the server will be onboarded to vulnerability assessment by Microsoft.Security [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SoftwareInventoryCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SoftwareInventoryCollection.cs index f9325842ebc5..f56849a830cb 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SoftwareInventoryCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SoftwareInventoryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -125,5 +126,50 @@ public async Task Exists_GetsASingleSoftwareDataOfTheVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a single software data of the virtual machine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsASingleSoftwareDataOfTheVirtualMachine() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/GetSoftware_example.json + // this example is just showing the usage of "SoftwareInventories_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 = "e5d1b86c-3051-44d5-8802-aa65d45a279b"; + string resourceGroupName = "EITAN-TESTS"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SoftwareInventoryResource + string resourceNamespace = "Microsoft.Compute"; + string resourceType = "virtualMachines"; + string resourceName = "Eitan-Test1"; + SoftwareInventoryCollection collection = resourceGroupResource.GetSoftwareInventories(resourceNamespace, resourceType, resourceName); + + // invoke the operation + string softwareName = "outlook_16.0.10371.20060"; + NullableResponse response = await collection.GetIfExistsAsync(softwareName); + SoftwareInventoryResource 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 + SoftwareInventoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SqlVulnerabilityAssessmentBaselineRuleCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SqlVulnerabilityAssessmentBaselineRuleCollection.cs index a633a81531c6..4c2c2dc875f8 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SqlVulnerabilityAssessmentBaselineRuleCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SqlVulnerabilityAssessmentBaselineRuleCollection.cs @@ -170,6 +170,47 @@ public async Task Exists_GetTheBaseline() Console.WriteLine($"Succeeded: {result}"); } + // Get the baseline + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheBaseline() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Get.json + // this example is just showing the usage of "SqlVulnerabilityAssessmentBaselineRules_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SqlVulnerabilityAssessmentBaselineRuleResource + string resourceId = "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + SqlVulnerabilityAssessmentBaselineRuleCollection collection = client.GetSqlVulnerabilityAssessmentBaselineRules(scopeId); + + // invoke the operation + string ruleId = "VA1234"; + Guid workspaceId = Guid.Parse("55555555-6666-7777-8888-999999999999"); + NullableResponse response = await collection.GetIfExistsAsync(ruleId, workspaceId); + SqlVulnerabilityAssessmentBaselineRuleResource 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 + SqlVulnerabilityAssessmentBaselineRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List baseline for all rules [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SqlVulnerabilityAssessmentScanCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SqlVulnerabilityAssessmentScanCollection.cs index 0f20cb924cba..11cc77b41050 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SqlVulnerabilityAssessmentScanCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SqlVulnerabilityAssessmentScanCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -78,6 +79,47 @@ public async Task Exists_GetScanDetailsOfAScanRecord() Console.WriteLine($"Succeeded: {result}"); } + // Get scan details of a scan record + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetScanDetailsOfAScanRecord() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_Get.json + // this example is just showing the usage of "SqlVulnerabilityAssessmentScans_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SqlVulnerabilityAssessmentScanResource + string resourceId = "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + SqlVulnerabilityAssessmentScanCollection collection = client.GetSqlVulnerabilityAssessmentScans(scopeId); + + // invoke the operation + string scanId = "Scheduled-20200623"; + Guid workspaceId = Guid.Parse("55555555-6666-7777-8888-999999999999"); + NullableResponse response = await collection.GetIfExistsAsync(scanId, workspaceId); + SqlVulnerabilityAssessmentScanResource 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 + SqlVulnerabilityAssessmentScanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get scan details of the latest scan record [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -140,6 +182,47 @@ public async Task Exists_GetScanDetailsOfTheLatestScanRecord() Console.WriteLine($"Succeeded: {result}"); } + // Get scan details of the latest scan record + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetScanDetailsOfTheLatestScanRecord() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_GetLatest.json + // this example is just showing the usage of "SqlVulnerabilityAssessmentScans_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SqlVulnerabilityAssessmentScanResource + string resourceId = "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceId)); + SqlVulnerabilityAssessmentScanCollection collection = client.GetSqlVulnerabilityAssessmentScans(scopeId); + + // invoke the operation + string scanId = "latest"; + Guid workspaceId = Guid.Parse("55555555-6666-7777-8888-999999999999"); + NullableResponse response = await collection.GetIfExistsAsync(scanId, workspaceId); + SqlVulnerabilityAssessmentScanResource 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 + SqlVulnerabilityAssessmentScanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List scan details [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionAssessmentMetadataCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionAssessmentMetadataCollection.cs index 99722c8153d1..ac175b7ddd72 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionAssessmentMetadataCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionAssessmentMetadataCollection.cs @@ -116,6 +116,47 @@ public async Task Exists_GetSecurityAssessmentMetadataForSubscription() Console.WriteLine($"Succeeded: {result}"); } + // Get security assessment metadata for subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityAssessmentMetadataForSubscription() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/GetAssessmentsMetadata_subscription_example.json + // this example is just showing the usage of "AssessmentsMetadata_GetInSubscription" 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 = "0980887d-03d6-408c-9566-532f3456804e"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionAssessmentMetadataResource + SubscriptionAssessmentMetadataCollection collection = subscriptionResource.GetAllSubscriptionAssessmentMetadata(); + + // invoke the operation + string assessmentMetadataName = "21300918-b2e3-0346-785f-c77ff57d243b"; + NullableResponse response = await collection.GetIfExistsAsync(assessmentMetadataName); + SubscriptionAssessmentMetadataResource 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 + SecurityAssessmentMetadataData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create security assessment metadata for subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityAlertCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityAlertCollection.cs index f676f398da43..8eb6560a50f3 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityAlertCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityAlertCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetSecurityAlertOnASubscriptionFromASecurityDataLocatio Console.WriteLine($"Succeeded: {result}"); } + // Get security alert on a subscription from a security data location + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityAlertOnASubscriptionFromASecurityDataLocation() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertSubscriptionLocation_example.json + // this example is just showing the usage of "Alerts_GetSubscriptionLevel" 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 SecurityCenterLocationResource created on azure + // for more information of creating SecurityCenterLocationResource, please refer to the document of SecurityCenterLocationResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + AzureLocation ascLocation = new AzureLocation("westeurope"); + ResourceIdentifier securityCenterLocationResourceId = SecurityCenterLocationResource.CreateResourceIdentifier(subscriptionId, ascLocation); + SecurityCenterLocationResource securityCenterLocation = client.GetSecurityCenterLocationResource(securityCenterLocationResourceId); + + // get the collection of this SubscriptionSecurityAlertResource + SubscriptionSecurityAlertCollection collection = securityCenterLocation.GetSubscriptionSecurityAlerts(); + + // invoke the operation + string alertName = "2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA"; + NullableResponse response = await collection.GetIfExistsAsync(alertName); + SubscriptionSecurityAlertResource 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 + SecurityAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Simulate security alerts on a subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityApplicationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityApplicationCollection.cs index c36073b02e36..5ed07ba8618b 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityApplicationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityApplicationCollection.cs @@ -117,6 +117,47 @@ public async Task Exists_GetSecurityApplicationBySpecificApplicationId() Console.WriteLine($"Succeeded: {result}"); } + // Get security application by specific applicationId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityApplicationBySpecificApplicationId() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/GetApplication_example.json + // this example is just showing the usage of "Application_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionSecurityApplicationResource + SubscriptionSecurityApplicationCollection collection = subscriptionResource.GetSubscriptionSecurityApplications(); + + // invoke the operation + string applicationId = "ad9a8e26-29d9-4829-bb30-e597a58cdbb8"; + NullableResponse response = await collection.GetIfExistsAsync(applicationId); + SubscriptionSecurityApplicationResource 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 + SecurityApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create application [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityTaskCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityTaskCollection.cs index 4920cc001af3..7f98c6a976cf 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityTaskCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_SubscriptionSecurityTaskCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -115,5 +116,47 @@ public async Task Exists_GetSecurityRecommendationTaskFromSecurityDataLocation() Console.WriteLine($"Succeeded: {result}"); } + + // Get security recommendation task from security data location + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityRecommendationTaskFromSecurityDataLocation() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTaskSubscriptionLocation_example.json + // this example is just showing the usage of "Tasks_GetSubscriptionLevelTask" 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 SecurityCenterLocationResource created on azure + // for more information of creating SecurityCenterLocationResource, please refer to the document of SecurityCenterLocationResource + string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; + AzureLocation ascLocation = new AzureLocation("westeurope"); + ResourceIdentifier securityCenterLocationResourceId = SecurityCenterLocationResource.CreateResourceIdentifier(subscriptionId, ascLocation); + SecurityCenterLocationResource securityCenterLocation = client.GetSecurityCenterLocationResource(securityCenterLocationResourceId); + + // get the collection of this SubscriptionSecurityTaskResource + SubscriptionSecurityTaskCollection collection = securityCenterLocation.GetSubscriptionSecurityTasks(); + + // invoke the operation + string taskName = "62609ee7-d0a5-8616-9fe4-1df5cca7758d"; + NullableResponse response = await collection.GetIfExistsAsync(taskName); + SubscriptionSecurityTaskResource 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 + SecurityTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_TenantAssessmentMetadataCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_TenantAssessmentMetadataCollection.cs index cef61d9e49ab..4fd113cf13a9 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_TenantAssessmentMetadataCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_TenantAssessmentMetadataCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -106,5 +107,44 @@ public async Task Exists_GetSecurityAssessmentMetadata() Console.WriteLine($"Succeeded: {result}"); } + + // Get security assessment metadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSecurityAssessmentMetadata() + { + // Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/GetAssessmentsMetadata_example.json + // this example is just showing the usage of "AssessmentsMetadata_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantAssessmentMetadataResource + TenantAssessmentMetadataCollection collection = tenantResource.GetAllTenantAssessmentMetadata(); + + // invoke the operation + string assessmentMetadataName = "21300918-b2e3-0346-785f-c77ff57d243b"; + NullableResponse response = await collection.GetIfExistsAsync(assessmentMetadataName); + TenantAssessmentMetadataResource 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 + SecurityAssessmentMetadataData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveApplicationControlGroupCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveApplicationControlGroupCollection.cs index 5fc878b27aff..5c596bf088b6 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveApplicationControlGroupCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveApplicationControlGroupCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string groupName, CancellationToken cancell throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName} + /// + /// + /// Operation Id + /// AdaptiveApplicationControls_Get + /// + /// + /// + /// Name of an application control machine group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _adaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics.CreateScope("AdaptiveApplicationControlGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _adaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Name), groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AdaptiveApplicationControlGroupResource(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}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName} + /// + /// + /// Operation Id + /// AdaptiveApplicationControls_Get + /// + /// + /// + /// Name of an application control machine group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _adaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics.CreateScope("AdaptiveApplicationControlGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _adaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Name), groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AdaptiveApplicationControlGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveNetworkHardeningCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveNetworkHardeningCollection.cs index 92d6cb5428ca..30c4066a9f2e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveNetworkHardeningCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveNetworkHardeningCollection.cs @@ -253,6 +253,80 @@ public virtual Response Exists(string adaptiveNetworkHardeningResourceName } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName} + /// + /// + /// Operation Id + /// AdaptiveNetworkHardenings_Get + /// + /// + /// + /// The name of the Adaptive Network Hardening 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 adaptiveNetworkHardeningResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(adaptiveNetworkHardeningResourceName, nameof(adaptiveNetworkHardeningResourceName)); + + using var scope = _adaptiveNetworkHardeningClientDiagnostics.CreateScope("AdaptiveNetworkHardeningCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _adaptiveNetworkHardeningRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceNamespace, _resourceType, _resourceName, adaptiveNetworkHardeningResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AdaptiveNetworkHardeningResource(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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName} + /// + /// + /// Operation Id + /// AdaptiveNetworkHardenings_Get + /// + /// + /// + /// The name of the Adaptive Network Hardening resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string adaptiveNetworkHardeningResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(adaptiveNetworkHardeningResourceName, nameof(adaptiveNetworkHardeningResourceName)); + + using var scope = _adaptiveNetworkHardeningClientDiagnostics.CreateScope("AdaptiveNetworkHardeningCollection.GetIfExists"); + scope.Start(); + try + { + var response = _adaptiveNetworkHardeningRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceNamespace, _resourceType, _resourceName, adaptiveNetworkHardeningResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AdaptiveNetworkHardeningResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AutoProvisioningSettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AutoProvisioningSettingCollection.cs index 9b666e4cfde7..8f095f787f3a 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AutoProvisioningSettingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AutoProvisioningSettingCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string settingName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName} + /// + /// + /// Operation Id + /// AutoProvisioningSettings_Get + /// + /// + /// + /// Auto provisioning setting key. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string settingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(settingName, nameof(settingName)); + + using var scope = _autoProvisioningSettingClientDiagnostics.CreateScope("AutoProvisioningSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _autoProvisioningSettingRestClient.GetAsync(Id.SubscriptionId, settingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutoProvisioningSettingResource(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}/providers/Microsoft.Security/autoProvisioningSettings/{settingName} + /// + /// + /// Operation Id + /// AutoProvisioningSettings_Get + /// + /// + /// + /// Auto provisioning setting key. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string settingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(settingName, nameof(settingName)); + + using var scope = _autoProvisioningSettingClientDiagnostics.CreateScope("AutoProvisioningSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _autoProvisioningSettingRestClient.Get(Id.SubscriptionId, settingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutoProvisioningSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ComplianceResultCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ComplianceResultCollection.cs index 97731061d6c2..fe245817a019 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ComplianceResultCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ComplianceResultCollection.cs @@ -231,6 +231,80 @@ public virtual Response Exists(string complianceResultName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName} + /// + /// + /// Operation Id + /// ComplianceResults_Get + /// + /// + /// + /// name of the desired assessment compliance result. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string complianceResultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(complianceResultName, nameof(complianceResultName)); + + using var scope = _complianceResultClientDiagnostics.CreateScope("ComplianceResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _complianceResultRestClient.GetAsync(Id, complianceResultName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComplianceResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName} + /// + /// + /// Operation Id + /// ComplianceResults_Get + /// + /// + /// + /// name of the desired assessment compliance result. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string complianceResultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(complianceResultName, nameof(complianceResultName)); + + using var scope = _complianceResultClientDiagnostics.CreateScope("ComplianceResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _complianceResultRestClient.Get(Id, complianceResultName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComplianceResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomAssessmentAutomationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomAssessmentAutomationCollection.cs index 84b1877a0af6..f404f0d3cace 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomAssessmentAutomationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomAssessmentAutomationCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string customAssessmentAutomationName, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName} + /// + /// + /// Operation Id + /// CustomAssessmentAutomations_Get + /// + /// + /// + /// Name of the Custom Assessment Automation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string customAssessmentAutomationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customAssessmentAutomationName, nameof(customAssessmentAutomationName)); + + using var scope = _customAssessmentAutomationClientDiagnostics.CreateScope("CustomAssessmentAutomationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _customAssessmentAutomationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, customAssessmentAutomationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomAssessmentAutomationResource(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.Security/customAssessmentAutomations/{customAssessmentAutomationName} + /// + /// + /// Operation Id + /// CustomAssessmentAutomations_Get + /// + /// + /// + /// Name of the Custom Assessment Automation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string customAssessmentAutomationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customAssessmentAutomationName, nameof(customAssessmentAutomationName)); + + using var scope = _customAssessmentAutomationClientDiagnostics.CreateScope("CustomAssessmentAutomationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _customAssessmentAutomationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, customAssessmentAutomationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomAssessmentAutomationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomEntityStoreAssignmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomEntityStoreAssignmentCollection.cs index 2d0ff1f99241..745938c92f54 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomEntityStoreAssignmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomEntityStoreAssignmentCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string customEntityStoreAssignmentName, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName} + /// + /// + /// Operation Id + /// CustomEntityStoreAssignments_Get + /// + /// + /// + /// Name of the custom entity store assignment. Generated name is GUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string customEntityStoreAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customEntityStoreAssignmentName, nameof(customEntityStoreAssignmentName)); + + using var scope = _customEntityStoreAssignmentClientDiagnostics.CreateScope("CustomEntityStoreAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _customEntityStoreAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, customEntityStoreAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomEntityStoreAssignmentResource(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.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName} + /// + /// + /// Operation Id + /// CustomEntityStoreAssignments_Get + /// + /// + /// + /// Name of the custom entity store assignment. Generated name is GUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string customEntityStoreAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(customEntityStoreAssignmentName, nameof(customEntityStoreAssignmentName)); + + using var scope = _customEntityStoreAssignmentClientDiagnostics.CreateScope("CustomEntityStoreAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _customEntityStoreAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, customEntityStoreAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CustomEntityStoreAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/DeviceSecurityGroupCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/DeviceSecurityGroupCollection.cs index ee8ecad69917..12f40abe3f63 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/DeviceSecurityGroupCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/DeviceSecurityGroupCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string deviceSecurityGroupName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName} + /// + /// + /// Operation Id + /// DeviceSecurityGroups_Get + /// + /// + /// + /// The name of the device security group. Note that the name of the device security group is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deviceSecurityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deviceSecurityGroupName, nameof(deviceSecurityGroupName)); + + using var scope = _deviceSecurityGroupClientDiagnostics.CreateScope("DeviceSecurityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deviceSecurityGroupRestClient.GetAsync(Id, deviceSecurityGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceSecurityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName} + /// + /// + /// Operation Id + /// DeviceSecurityGroups_Get + /// + /// + /// + /// The name of the device security group. Note that the name of the device security group is case insensitive. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deviceSecurityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deviceSecurityGroupName, nameof(deviceSecurityGroupName)); + + using var scope = _deviceSecurityGroupClientDiagnostics.CreateScope("DeviceSecurityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deviceSecurityGroupRestClient.Get(Id, deviceSecurityGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeviceSecurityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceAssignmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceAssignmentCollection.cs index 23a654b2931f..d98b35ff576e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceAssignmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceAssignmentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string assignmentKey, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey} + /// + /// + /// Operation Id + /// GovernanceAssignments_Get + /// + /// + /// + /// The governance assignment key - the assessment key of the required governance assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assignmentKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assignmentKey, nameof(assignmentKey)); + + using var scope = _governanceAssignmentClientDiagnostics.CreateScope("GovernanceAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _governanceAssignmentRestClient.GetAsync(Id.Parent, Id.Name, assignmentKey, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GovernanceAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey} + /// + /// + /// Operation Id + /// GovernanceAssignments_Get + /// + /// + /// + /// The governance assignment key - the assessment key of the required governance assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assignmentKey, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assignmentKey, nameof(assignmentKey)); + + using var scope = _governanceAssignmentClientDiagnostics.CreateScope("GovernanceAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _governanceAssignmentRestClient.Get(Id.Parent, Id.Name, assignmentKey, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GovernanceAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceRuleCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceRuleCollection.cs index a85261159f39..b5e7a16a8c8f 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceRuleCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceRuleCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string ruleId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/governanceRules/{ruleId} + /// + /// + /// Operation Id + /// GovernanceRules_Get + /// + /// + /// + /// The governance rule key - unique key for the standard governance rule (GUID). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _governanceRuleClientDiagnostics.CreateScope("GovernanceRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _governanceRuleRestClient.GetAsync(Id, ruleId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GovernanceRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/governanceRules/{ruleId} + /// + /// + /// Operation Id + /// GovernanceRules_Get + /// + /// + /// + /// The governance rule key - unique key for the standard governance rule (GUID). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _governanceRuleClientDiagnostics.CreateScope("GovernanceRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _governanceRuleRestClient.Get(Id, ruleId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GovernanceRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingCollection.cs index 5b5e2b4c059d..cdcd772fcf2c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string ingestionSettingName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} + /// + /// + /// Operation Id + /// IngestionSettings_Get + /// + /// + /// + /// Name of the ingestion setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ingestionSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); + + using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _ingestionSettingRestClient.GetAsync(Id.SubscriptionId, ingestionSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IngestionSettingResource(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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} + /// + /// + /// Operation Id + /// IngestionSettings_Get + /// + /// + /// + /// Name of the ingestion setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ingestionSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); + + using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _ingestionSettingRestClient.Get(Id.SubscriptionId, ingestionSettingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IngestionSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedAlertCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedAlertCollection.cs index 8a183dbe62c6..6087f14cc0e6 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedAlertCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedAlertCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string aggregatedAlertName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName} + /// + /// + /// Operation Id + /// IotSecuritySolutionsAnalyticsAggregatedAlert_Get + /// + /// + /// + /// Identifier of the aggregated alert. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string aggregatedAlertName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(aggregatedAlertName, nameof(aggregatedAlertName)); + + using var scope = _iotSecurityAggregatedAlertIotSecuritySolutionsAnalyticsAggregatedAlertClientDiagnostics.CreateScope("IotSecurityAggregatedAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotSecurityAggregatedAlertIotSecuritySolutionsAnalyticsAggregatedAlertRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, aggregatedAlertName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotSecurityAggregatedAlertResource(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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName} + /// + /// + /// Operation Id + /// IotSecuritySolutionsAnalyticsAggregatedAlert_Get + /// + /// + /// + /// Identifier of the aggregated alert. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string aggregatedAlertName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(aggregatedAlertName, nameof(aggregatedAlertName)); + + using var scope = _iotSecurityAggregatedAlertIotSecuritySolutionsAnalyticsAggregatedAlertClientDiagnostics.CreateScope("IotSecurityAggregatedAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotSecurityAggregatedAlertIotSecuritySolutionsAnalyticsAggregatedAlertRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, aggregatedAlertName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotSecurityAggregatedAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedRecommendationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedRecommendationCollection.cs index f729b7c48390..3a8aeecc3a73 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedRecommendationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedRecommendationCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string aggregatedRecommendationName, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName} + /// + /// + /// Operation Id + /// IotSecuritySolutionsAnalyticsRecommendation_Get + /// + /// + /// + /// Name of the recommendation aggregated for this query. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string aggregatedRecommendationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(aggregatedRecommendationName, nameof(aggregatedRecommendationName)); + + using var scope = _iotSecurityAggregatedRecommendationIotSecuritySolutionsAnalyticsRecommendationClientDiagnostics.CreateScope("IotSecurityAggregatedRecommendationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotSecurityAggregatedRecommendationIotSecuritySolutionsAnalyticsRecommendationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, aggregatedRecommendationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotSecurityAggregatedRecommendationResource(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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName} + /// + /// + /// Operation Id + /// IotSecuritySolutionsAnalyticsRecommendation_Get + /// + /// + /// + /// Name of the recommendation aggregated for this query. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string aggregatedRecommendationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(aggregatedRecommendationName, nameof(aggregatedRecommendationName)); + + using var scope = _iotSecurityAggregatedRecommendationIotSecuritySolutionsAnalyticsRecommendationClientDiagnostics.CreateScope("IotSecurityAggregatedRecommendationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotSecurityAggregatedRecommendationIotSecuritySolutionsAnalyticsRecommendationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, aggregatedRecommendationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotSecurityAggregatedRecommendationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionCollection.cs index fa1e0d4d2e4f..0c46ce82a409 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string solutionName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName} + /// + /// + /// Operation Id + /// IotSecuritySolution_Get + /// + /// + /// + /// The name of the IoT Security solution. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string solutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionName, nameof(solutionName)); + + using var scope = _iotSecuritySolutionClientDiagnostics.CreateScope("IotSecuritySolutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iotSecuritySolutionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, solutionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotSecuritySolutionResource(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.Security/iotSecuritySolutions/{solutionName} + /// + /// + /// Operation Id + /// IotSecuritySolution_Get + /// + /// + /// + /// The name of the IoT Security solution. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string solutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionName, nameof(solutionName)); + + using var scope = _iotSecuritySolutionClientDiagnostics.CreateScope("IotSecuritySolutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iotSecuritySolutionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, solutionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IotSecuritySolutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/JitNetworkAccessPolicyCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/JitNetworkAccessPolicyCollection.cs index 6f4508d052f7..de16e096c7a1 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/JitNetworkAccessPolicyCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/JitNetworkAccessPolicyCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string jitNetworkAccessPolicyName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName} + /// + /// + /// Operation Id + /// JitNetworkAccessPolicies_Get + /// + /// + /// + /// Name of a Just-in-Time access configuration policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jitNetworkAccessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jitNetworkAccessPolicyName, nameof(jitNetworkAccessPolicyName)); + + using var scope = _jitNetworkAccessPolicyClientDiagnostics.CreateScope("JitNetworkAccessPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _jitNetworkAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_ascLocation), jitNetworkAccessPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JitNetworkAccessPolicyResource(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.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName} + /// + /// + /// Operation Id + /// JitNetworkAccessPolicies_Get + /// + /// + /// + /// Name of a Just-in-Time access configuration policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jitNetworkAccessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jitNetworkAccessPolicyName, nameof(jitNetworkAccessPolicyName)); + + using var scope = _jitNetworkAccessPolicyClientDiagnostics.CreateScope("JitNetworkAccessPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _jitNetworkAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_ascLocation), jitNetworkAccessPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JitNetworkAccessPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentCollection.cs index f622050441e8..095c8eddcb9b 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string regulatoryComplianceAssessmentName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName} + /// + /// + /// Operation Id + /// RegulatoryComplianceAssessments_Get + /// + /// + /// + /// Name of the regulatory compliance assessment object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string regulatoryComplianceAssessmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(regulatoryComplianceAssessmentName, nameof(regulatoryComplianceAssessmentName)); + + using var scope = _regulatoryComplianceAssessmentClientDiagnostics.CreateScope("RegulatoryComplianceAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _regulatoryComplianceAssessmentRestClient.GetAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, regulatoryComplianceAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RegulatoryComplianceAssessmentResource(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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName} + /// + /// + /// Operation Id + /// RegulatoryComplianceAssessments_Get + /// + /// + /// + /// Name of the regulatory compliance assessment object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string regulatoryComplianceAssessmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(regulatoryComplianceAssessmentName, nameof(regulatoryComplianceAssessmentName)); + + using var scope = _regulatoryComplianceAssessmentClientDiagnostics.CreateScope("RegulatoryComplianceAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _regulatoryComplianceAssessmentRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, regulatoryComplianceAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RegulatoryComplianceAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlCollection.cs index 1de35ab587fa..b93749ff9df7 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string regulatoryComplianceControlName, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName} + /// + /// + /// Operation Id + /// RegulatoryComplianceControls_Get + /// + /// + /// + /// Name of the regulatory compliance control object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string regulatoryComplianceControlName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(regulatoryComplianceControlName, nameof(regulatoryComplianceControlName)); + + using var scope = _regulatoryComplianceControlClientDiagnostics.CreateScope("RegulatoryComplianceControlCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _regulatoryComplianceControlRestClient.GetAsync(Id.SubscriptionId, Id.Name, regulatoryComplianceControlName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RegulatoryComplianceControlResource(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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName} + /// + /// + /// Operation Id + /// RegulatoryComplianceControls_Get + /// + /// + /// + /// Name of the regulatory compliance control object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string regulatoryComplianceControlName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(regulatoryComplianceControlName, nameof(regulatoryComplianceControlName)); + + using var scope = _regulatoryComplianceControlClientDiagnostics.CreateScope("RegulatoryComplianceControlCollection.GetIfExists"); + scope.Start(); + try + { + var response = _regulatoryComplianceControlRestClient.Get(Id.SubscriptionId, Id.Name, regulatoryComplianceControlName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RegulatoryComplianceControlResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardCollection.cs index 326b25612e4a..7a9f447e7cca 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardCollection.cs @@ -244,6 +244,80 @@ public virtual Response Exists(string regulatoryComplianceStandardName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName} + /// + /// + /// Operation Id + /// RegulatoryComplianceStandards_Get + /// + /// + /// + /// Name of the regulatory compliance standard object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string regulatoryComplianceStandardName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(regulatoryComplianceStandardName, nameof(regulatoryComplianceStandardName)); + + using var scope = _regulatoryComplianceStandardClientDiagnostics.CreateScope("RegulatoryComplianceStandardCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _regulatoryComplianceStandardRestClient.GetAsync(Id.SubscriptionId, regulatoryComplianceStandardName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RegulatoryComplianceStandardResource(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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName} + /// + /// + /// Operation Id + /// RegulatoryComplianceStandards_Get + /// + /// + /// + /// Name of the regulatory compliance standard object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string regulatoryComplianceStandardName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(regulatoryComplianceStandardName, nameof(regulatoryComplianceStandardName)); + + using var scope = _regulatoryComplianceStandardClientDiagnostics.CreateScope("RegulatoryComplianceStandardCollection.GetIfExists"); + scope.Start(); + try + { + var response = _regulatoryComplianceStandardRestClient.Get(Id.SubscriptionId, regulatoryComplianceStandardName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RegulatoryComplianceStandardResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityAlertCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityAlertCollection.cs index d5143cc6600f..ad60a499070f 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityAlertCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityAlertCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string alertName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName} + /// + /// + /// Operation Id + /// Alerts_GetResourceGroupLevel + /// + /// + /// + /// Name of the alert object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string alertName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertName, nameof(alertName)); + + using var scope = _resourceGroupSecurityAlertAlertsClientDiagnostics.CreateScope("ResourceGroupSecurityAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceGroupSecurityAlertAlertsRestClient.GetResourceGroupLevelAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_ascLocation), alertName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupSecurityAlertResource(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.Security/locations/{ascLocation}/alerts/{alertName} + /// + /// + /// Operation Id + /// Alerts_GetResourceGroupLevel + /// + /// + /// + /// Name of the alert object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string alertName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertName, nameof(alertName)); + + using var scope = _resourceGroupSecurityAlertAlertsClientDiagnostics.CreateScope("ResourceGroupSecurityAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceGroupSecurityAlertAlertsRestClient.GetResourceGroupLevel(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_ascLocation), alertName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupSecurityAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityTaskCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityTaskCollection.cs index 82aa001262f8..8a402987c0d6 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityTaskCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityTaskCollection.cs @@ -247,6 +247,80 @@ public virtual Response Exists(string taskName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_GetResourceGroupLevelTask + /// + /// + /// + /// Name of the task object, will be a GUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string taskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _resourceGroupSecurityTaskTasksClientDiagnostics.CreateScope("ResourceGroupSecurityTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceGroupSecurityTaskTasksRestClient.GetResourceGroupLevelTaskAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_ascLocation), taskName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupSecurityTaskResource(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.Security/locations/{ascLocation}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_GetResourceGroupLevelTask + /// + /// + /// + /// Name of the task object, will be a GUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string taskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _resourceGroupSecurityTaskTasksClientDiagnostics.CreateScope("ResourceGroupSecurityTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceGroupSecurityTaskTasksRestClient.GetResourceGroupLevelTask(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_ascLocation), taskName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupSecurityTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecureScoreCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecureScoreCollection.cs index bf70aa93da85..37dce566494d 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecureScoreCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecureScoreCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string secureScoreName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName} + /// + /// + /// Operation Id + /// SecureScores_Get + /// + /// + /// + /// The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string secureScoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secureScoreName, nameof(secureScoreName)); + + using var scope = _secureScoreClientDiagnostics.CreateScope("SecureScoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _secureScoreRestClient.GetAsync(Id.SubscriptionId, secureScoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecureScoreResource(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}/providers/Microsoft.Security/secureScores/{secureScoreName} + /// + /// + /// Operation Id + /// SecureScores_Get + /// + /// + /// + /// The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string secureScoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secureScoreName, nameof(secureScoreName)); + + using var scope = _secureScoreClientDiagnostics.CreateScope("SecureScoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _secureScoreRestClient.Get(Id.SubscriptionId, secureScoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecureScoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAlertsSuppressionRuleCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAlertsSuppressionRuleCollection.cs index 28856e788a96..97ca0d390093 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAlertsSuppressionRuleCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAlertsSuppressionRuleCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string alertsSuppressionRuleName, Cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName} + /// + /// + /// Operation Id + /// AlertsSuppressionRules_Get + /// + /// + /// + /// The unique name of the suppression alert rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string alertsSuppressionRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertsSuppressionRuleName, nameof(alertsSuppressionRuleName)); + + using var scope = _securityAlertsSuppressionRuleAlertsSuppressionRulesClientDiagnostics.CreateScope("SecurityAlertsSuppressionRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityAlertsSuppressionRuleAlertsSuppressionRulesRestClient.GetAsync(Id.SubscriptionId, alertsSuppressionRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityAlertsSuppressionRuleResource(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}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName} + /// + /// + /// Operation Id + /// AlertsSuppressionRules_Get + /// + /// + /// + /// The unique name of the suppression alert rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string alertsSuppressionRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertsSuppressionRuleName, nameof(alertsSuppressionRuleName)); + + using var scope = _securityAlertsSuppressionRuleAlertsSuppressionRulesClientDiagnostics.CreateScope("SecurityAlertsSuppressionRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityAlertsSuppressionRuleAlertsSuppressionRulesRestClient.Get(Id.SubscriptionId, alertsSuppressionRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityAlertsSuppressionRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentCollection.cs index 3012e38909b0..3073bef71f38 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentCollection.cs @@ -270,5 +270,81 @@ public virtual Response Exists(string assessmentName, SecurityAssessmentOD throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/assessments/{assessmentName} + /// + /// + /// Operation Id + /// Assessments_Get + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// OData expand. Optional. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assessmentName, SecurityAssessmentODataExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assessmentName, nameof(assessmentName)); + + using var scope = _securityAssessmentAssessmentsClientDiagnostics.CreateScope("SecurityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityAssessmentAssessmentsRestClient.GetAsync(Id, assessmentName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/assessments/{assessmentName} + /// + /// + /// Operation Id + /// Assessments_Get + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// OData expand. Optional. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assessmentName, SecurityAssessmentODataExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assessmentName, nameof(assessmentName)); + + using var scope = _securityAssessmentAssessmentsClientDiagnostics.CreateScope("SecurityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityAssessmentAssessmentsRestClient.Get(Id, assessmentName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAutomationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAutomationCollection.cs index e077208ed67a..eaae309a1a77 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAutomationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAutomationCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string automationName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName} + /// + /// + /// Operation Id + /// Automations_Get + /// + /// + /// + /// The security automation name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string automationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(automationName, nameof(automationName)); + + using var scope = _securityAutomationAutomationsClientDiagnostics.CreateScope("SecurityAutomationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityAutomationAutomationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, automationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityAutomationResource(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.Security/automations/{automationName} + /// + /// + /// Operation Id + /// Automations_Get + /// + /// + /// + /// The security automation name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string automationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(automationName, nameof(automationName)); + + using var scope = _securityAutomationAutomationsClientDiagnostics.CreateScope("SecurityAutomationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityAutomationAutomationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, automationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityAutomationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationCollection.cs index 77d643cddc12..b7ce8b4ca63a 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationCollection.cs @@ -226,6 +226,72 @@ public virtual Response Exists(AzureLocation ascLocation, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation} + /// + /// + /// Operation Id + /// Locations_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AzureLocation ascLocation, CancellationToken cancellationToken = default) + { + using var scope = _securityCenterLocationLocationsClientDiagnostics.CreateScope("SecurityCenterLocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityCenterLocationLocationsRestClient.GetAsync(Id.SubscriptionId, ascLocation, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityCenterLocationResource(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}/providers/Microsoft.Security/locations/{ascLocation} + /// + /// + /// Operation Id + /// Locations_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AzureLocation ascLocation, CancellationToken cancellationToken = default) + { + using var scope = _securityCenterLocationLocationsClientDiagnostics.CreateScope("SecurityCenterLocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityCenterLocationLocationsRestClient.Get(Id.SubscriptionId, ascLocation, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityCenterLocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterPricingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterPricingCollection.cs index 3969c21c85a6..175d95b70831 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterPricingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterPricingCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string pricingName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName} + /// + /// + /// Operation Id + /// Pricings_Get + /// + /// + /// + /// name of the pricing configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string pricingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(pricingName, nameof(pricingName)); + + using var scope = _securityCenterPricingPricingsClientDiagnostics.CreateScope("SecurityCenterPricingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityCenterPricingPricingsRestClient.GetAsync(Id.SubscriptionId, pricingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityCenterPricingResource(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}/providers/Microsoft.Security/pricings/{pricingName} + /// + /// + /// Operation Id + /// Pricings_Get + /// + /// + /// + /// name of the pricing configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string pricingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(pricingName, nameof(pricingName)); + + using var scope = _securityCenterPricingPricingsClientDiagnostics.CreateScope("SecurityCenterPricingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityCenterPricingPricingsRestClient.Get(Id.SubscriptionId, pricingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityCenterPricingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCloudConnectorCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCloudConnectorCollection.cs index 565b422dcfce..03f48b6bae51 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCloudConnectorCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCloudConnectorCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string connectorName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connectors_Get + /// + /// + /// + /// Name of the cloud account connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _securityCloudConnectorConnectorsClientDiagnostics.CreateScope("SecurityCloudConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityCloudConnectorConnectorsRestClient.GetAsync(Id.SubscriptionId, connectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityCloudConnectorResource(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}/providers/Microsoft.Security/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connectors_Get + /// + /// + /// + /// Name of the cloud account connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _securityCloudConnectorConnectorsClientDiagnostics.CreateScope("SecurityCloudConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityCloudConnectorConnectorsRestClient.Get(Id.SubscriptionId, connectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityCloudConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityComplianceCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityComplianceCollection.cs index 11b1aa874370..a2eb8d03ece8 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityComplianceCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityComplianceCollection.cs @@ -231,6 +231,80 @@ public virtual Response Exists(string complianceName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/compliances/{complianceName} + /// + /// + /// Operation Id + /// Compliances_Get + /// + /// + /// + /// name of the Compliance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string complianceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(complianceName, nameof(complianceName)); + + using var scope = _securityComplianceCompliancesClientDiagnostics.CreateScope("SecurityComplianceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityComplianceCompliancesRestClient.GetAsync(Id, complianceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityComplianceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/compliances/{complianceName} + /// + /// + /// Operation Id + /// Compliances_Get + /// + /// + /// + /// name of the Compliance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string complianceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(complianceName, nameof(complianceName)); + + using var scope = _securityComplianceCompliancesClientDiagnostics.CreateScope("SecurityComplianceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityComplianceCompliancesRestClient.Get(Id, complianceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityComplianceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorApplicationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorApplicationCollection.cs index e87be1345bf2..aaf83d7de93e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorApplicationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorApplicationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string applicationId, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId} + /// + /// + /// Operation Id + /// SecurityConnectorApplications_Get + /// + /// + /// + /// The security Application key - unique key for the standard application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationId, nameof(applicationId)); + + using var scope = _securityConnectorApplicationClientDiagnostics.CreateScope("SecurityConnectorApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityConnectorApplicationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityConnectorApplicationResource(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.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId} + /// + /// + /// Operation Id + /// SecurityConnectorApplications_Get + /// + /// + /// + /// The security Application key - unique key for the standard application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationId, nameof(applicationId)); + + using var scope = _securityConnectorApplicationClientDiagnostics.CreateScope("SecurityConnectorApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityConnectorApplicationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityConnectorApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorCollection.cs index d7f72826f028..7f2930343046 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string securityConnectorName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName} + /// + /// + /// Operation Id + /// SecurityConnectors_Get + /// + /// + /// + /// The security connector name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string securityConnectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityConnectorName, nameof(securityConnectorName)); + + using var scope = _securityConnectorClientDiagnostics.CreateScope("SecurityConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, securityConnectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityConnectorResource(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.Security/securityConnectors/{securityConnectorName} + /// + /// + /// Operation Id + /// SecurityConnectors_Get + /// + /// + /// + /// The security connector name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string securityConnectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityConnectorName, nameof(securityConnectorName)); + + using var scope = _securityConnectorClientDiagnostics.CreateScope("SecurityConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, securityConnectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityContactCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityContactCollection.cs index 29d365036d40..de9efcfe6ac5 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityContactCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityContactCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string securityContactName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName} + /// + /// + /// Operation Id + /// SecurityContacts_Get + /// + /// + /// + /// Name of the security contact object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string securityContactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityContactName, nameof(securityContactName)); + + using var scope = _securityContactClientDiagnostics.CreateScope("SecurityContactCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityContactRestClient.GetAsync(Id.SubscriptionId, securityContactName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityContactResource(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}/providers/Microsoft.Security/securityContacts/{securityContactName} + /// + /// + /// Operation Id + /// SecurityContacts_Get + /// + /// + /// + /// Name of the security contact object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string securityContactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securityContactName, nameof(securityContactName)); + + using var scope = _securityContactClientDiagnostics.CreateScope("SecurityContactCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityContactRestClient.Get(Id.SubscriptionId, securityContactName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityContactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySettingCollection.cs index ec0d151a68ba..3e9a67f2f419 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySettingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySettingCollection.cs @@ -305,6 +305,72 @@ public virtual Response Exists(SecuritySettingName settingName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName} + /// + /// + /// Operation Id + /// Settings_Get + /// + /// + /// + /// The name of the setting. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SecuritySettingName settingName, CancellationToken cancellationToken = default) + { + using var scope = _securitySettingSettingsClientDiagnostics.CreateScope("SecuritySettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securitySettingSettingsRestClient.GetAsync(Id.SubscriptionId, settingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecuritySettingResource(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}/providers/Microsoft.Security/settings/{settingName} + /// + /// + /// Operation Id + /// Settings_Get + /// + /// + /// + /// The name of the setting. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SecuritySettingName settingName, CancellationToken cancellationToken = default) + { + using var scope = _securitySettingSettingsClientDiagnostics.CreateScope("SecuritySettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securitySettingSettingsRestClient.Get(Id.SubscriptionId, settingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecuritySettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySubAssessmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySubAssessmentCollection.cs index fe971a99f766..6b0cd075b51e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySubAssessmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySubAssessmentCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string subAssessmentName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName} + /// + /// + /// Operation Id + /// SubAssessments_Get + /// + /// + /// + /// The Sub-Assessment Key - Unique key for the sub-assessment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string subAssessmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subAssessmentName, nameof(subAssessmentName)); + + using var scope = _securitySubAssessmentSubAssessmentsClientDiagnostics.CreateScope("SecuritySubAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securitySubAssessmentSubAssessmentsRestClient.GetAsync(Id.Parent, Id.Name, subAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecuritySubAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName} + /// + /// + /// Operation Id + /// SubAssessments_Get + /// + /// + /// + /// The Sub-Assessment Key - Unique key for the sub-assessment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string subAssessmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subAssessmentName, nameof(subAssessmentName)); + + using var scope = _securitySubAssessmentSubAssessmentsClientDiagnostics.CreateScope("SecuritySubAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securitySubAssessmentSubAssessmentsRestClient.Get(Id.Parent, Id.Name, subAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecuritySubAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityWorkspaceSettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityWorkspaceSettingCollection.cs index c2a3d9bf00f4..2ba60f221ef9 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityWorkspaceSettingCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityWorkspaceSettingCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string workspaceSettingName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName} + /// + /// + /// Operation Id + /// WorkspaceSettings_Get + /// + /// + /// + /// Name of the security setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceSettingName, nameof(workspaceSettingName)); + + using var scope = _securityWorkspaceSettingWorkspaceSettingsClientDiagnostics.CreateScope("SecurityWorkspaceSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityWorkspaceSettingWorkspaceSettingsRestClient.GetAsync(Id.SubscriptionId, workspaceSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityWorkspaceSettingResource(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}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName} + /// + /// + /// Operation Id + /// WorkspaceSettings_Get + /// + /// + /// + /// Name of the security setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceSettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceSettingName, nameof(workspaceSettingName)); + + using var scope = _securityWorkspaceSettingWorkspaceSettingsClientDiagnostics.CreateScope("SecurityWorkspaceSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityWorkspaceSettingWorkspaceSettingsRestClient.Get(Id.SubscriptionId, workspaceSettingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityWorkspaceSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentCollection.cs index c3deedfb3227..29b9a7636f0c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentCollection.cs @@ -299,6 +299,70 @@ public virtual Response Exists(CancellationToken cancellationToken = defau } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment} + /// + /// + /// Operation Id + /// ServerVulnerabilityAssessment_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(CancellationToken cancellationToken = default) + { + using var scope = _serverVulnerabilityAssessmentClientDiagnostics.CreateScope("ServerVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serverVulnerabilityAssessmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceNamespace, _resourceType, _resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServerVulnerabilityAssessmentResource(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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment} + /// + /// + /// Operation Id + /// ServerVulnerabilityAssessment_Get + /// + /// + /// + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(CancellationToken cancellationToken = default) + { + using var scope = _serverVulnerabilityAssessmentClientDiagnostics.CreateScope("ServerVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serverVulnerabilityAssessmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceNamespace, _resourceType, _resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServerVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SoftwareInventoryCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SoftwareInventoryCollection.cs index a84ebc2449ed..4fa7f1289ad3 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SoftwareInventoryCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SoftwareInventoryCollection.cs @@ -253,6 +253,80 @@ public virtual Response Exists(string softwareName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName} + /// + /// + /// Operation Id + /// SoftwareInventories_Get + /// + /// + /// + /// Name of the installed software. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string softwareName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(softwareName, nameof(softwareName)); + + using var scope = _softwareInventoryClientDiagnostics.CreateScope("SoftwareInventoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _softwareInventoryRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _resourceNamespace, _resourceType, _resourceName, softwareName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SoftwareInventoryResource(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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName} + /// + /// + /// Operation Id + /// SoftwareInventories_Get + /// + /// + /// + /// Name of the installed software. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string softwareName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(softwareName, nameof(softwareName)); + + using var scope = _softwareInventoryClientDiagnostics.CreateScope("SoftwareInventoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _softwareInventoryRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _resourceNamespace, _resourceType, _resourceName, softwareName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SoftwareInventoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRuleCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRuleCollection.cs index ca0cbd459d09..8e87016146be 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRuleCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRuleCollection.cs @@ -317,5 +317,81 @@ public virtual Response Exists(string ruleId, Guid workspaceId, Cancellati throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentBaselineRules_Get + /// + /// + /// + /// The rule Id. + /// The workspace Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleId, Guid workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _sqlVulnerabilityAssessmentBaselineRuleClientDiagnostics.CreateScope("SqlVulnerabilityAssessmentBaselineRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlVulnerabilityAssessmentBaselineRuleRestClient.GetAsync(Id, ruleId, workspaceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlVulnerabilityAssessmentBaselineRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentBaselineRules_Get + /// + /// + /// + /// The rule Id. + /// The workspace Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleId, Guid workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _sqlVulnerabilityAssessmentBaselineRuleClientDiagnostics.CreateScope("SqlVulnerabilityAssessmentBaselineRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlVulnerabilityAssessmentBaselineRuleRestClient.Get(Id, ruleId, workspaceId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlVulnerabilityAssessmentBaselineRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanCollection.cs index 947b8103ea83..2abd5586e1b7 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanCollection.cs @@ -232,5 +232,81 @@ public virtual Response Exists(string scanId, Guid workspaceId, Cancellati throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The scan Id. Type 'latest' to get the scan record for the latest scan. + /// The workspace Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scanId, Guid workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _sqlVulnerabilityAssessmentScanClientDiagnostics.CreateScope("SqlVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlVulnerabilityAssessmentScanRestClient.GetAsync(Id, scanId, workspaceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlVulnerabilityAssessmentScanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The scan Id. Type 'latest' to get the scan record for the latest scan. + /// The workspace Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scanId, Guid workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _sqlVulnerabilityAssessmentScanClientDiagnostics.CreateScope("SqlVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlVulnerabilityAssessmentScanRestClient.Get(Id, scanId, workspaceId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlVulnerabilityAssessmentScanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionAssessmentMetadataCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionAssessmentMetadataCollection.cs index 6a763923d6b0..f14ec7b3f9e5 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionAssessmentMetadataCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionAssessmentMetadataCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string assessmentMetadataName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName} + /// + /// + /// Operation Id + /// AssessmentsMetadata_GetInSubscription + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assessmentMetadataName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assessmentMetadataName, nameof(assessmentMetadataName)); + + using var scope = _subscriptionAssessmentMetadataAssessmentsMetadataClientDiagnostics.CreateScope("SubscriptionAssessmentMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionAssessmentMetadataAssessmentsMetadataRestClient.GetInSubscriptionAsync(Id.SubscriptionId, assessmentMetadataName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionAssessmentMetadataResource(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}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName} + /// + /// + /// Operation Id + /// AssessmentsMetadata_GetInSubscription + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assessmentMetadataName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assessmentMetadataName, nameof(assessmentMetadataName)); + + using var scope = _subscriptionAssessmentMetadataAssessmentsMetadataClientDiagnostics.CreateScope("SubscriptionAssessmentMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionAssessmentMetadataAssessmentsMetadataRestClient.GetInSubscription(Id.SubscriptionId, assessmentMetadataName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionAssessmentMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityAlertCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityAlertCollection.cs index d126d42adb56..480c5d505d1e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityAlertCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityAlertCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string alertName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName} + /// + /// + /// Operation Id + /// Alerts_GetSubscriptionLevel + /// + /// + /// + /// Name of the alert object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string alertName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertName, nameof(alertName)); + + using var scope = _subscriptionSecurityAlertAlertsClientDiagnostics.CreateScope("SubscriptionSecurityAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionSecurityAlertAlertsRestClient.GetSubscriptionLevelAsync(Id.SubscriptionId, new AzureLocation(Id.Name), alertName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionSecurityAlertResource(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}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName} + /// + /// + /// Operation Id + /// Alerts_GetSubscriptionLevel + /// + /// + /// + /// Name of the alert object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string alertName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertName, nameof(alertName)); + + using var scope = _subscriptionSecurityAlertAlertsClientDiagnostics.CreateScope("SubscriptionSecurityAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionSecurityAlertAlertsRestClient.GetSubscriptionLevel(Id.SubscriptionId, new AzureLocation(Id.Name), alertName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionSecurityAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityApplicationCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityApplicationCollection.cs index 3ab54a8881e6..ee04ffb96fd1 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityApplicationCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityApplicationCollection.cs @@ -329,6 +329,80 @@ public virtual Response Exists(string applicationId, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId} + /// + /// + /// Operation Id + /// Application_Get + /// + /// + /// + /// The security Application key - unique key for the standard application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationId, nameof(applicationId)); + + using var scope = _subscriptionSecurityApplicationApplicationClientDiagnostics.CreateScope("SubscriptionSecurityApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionSecurityApplicationApplicationRestClient.GetAsync(Id.SubscriptionId, applicationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionSecurityApplicationResource(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}/providers/Microsoft.Security/applications/{applicationId} + /// + /// + /// Operation Id + /// Application_Get + /// + /// + /// + /// The security Application key - unique key for the standard application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationId, nameof(applicationId)); + + using var scope = _subscriptionSecurityApplicationApplicationClientDiagnostics.CreateScope("SubscriptionSecurityApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionSecurityApplicationApplicationRestClient.Get(Id.SubscriptionId, applicationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionSecurityApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityTaskCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityTaskCollection.cs index 5758452180d4..4a2b7bd83296 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityTaskCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityTaskCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string taskName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_GetSubscriptionLevelTask + /// + /// + /// + /// Name of the task object, will be a GUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string taskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _subscriptionSecurityTaskTasksClientDiagnostics.CreateScope("SubscriptionSecurityTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionSecurityTaskTasksRestClient.GetSubscriptionLevelTaskAsync(Id.SubscriptionId, new AzureLocation(Id.Name), taskName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionSecurityTaskResource(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}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_GetSubscriptionLevelTask + /// + /// + /// + /// Name of the task object, will be a GUID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string taskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _subscriptionSecurityTaskTasksClientDiagnostics.CreateScope("SubscriptionSecurityTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionSecurityTaskTasksRestClient.GetSubscriptionLevelTask(Id.SubscriptionId, new AzureLocation(Id.Name), taskName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionSecurityTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/TenantAssessmentMetadataCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/TenantAssessmentMetadataCollection.cs index c89eb6af64e1..bdfcba35392b 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/TenantAssessmentMetadataCollection.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/TenantAssessmentMetadataCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string assessmentMetadataName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName} + /// + /// + /// Operation Id + /// AssessmentsMetadata_Get + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assessmentMetadataName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assessmentMetadataName, nameof(assessmentMetadataName)); + + using var scope = _tenantAssessmentMetadataAssessmentsMetadataClientDiagnostics.CreateScope("TenantAssessmentMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantAssessmentMetadataAssessmentsMetadataRestClient.GetAsync(assessmentMetadataName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantAssessmentMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName} + /// + /// + /// Operation Id + /// AssessmentsMetadata_Get + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assessmentMetadataName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assessmentMetadataName, nameof(assessmentMetadataName)); + + using var scope = _tenantAssessmentMetadataAssessmentsMetadataClientDiagnostics.CreateScope("TenantAssessmentMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantAssessmentMetadataAssessmentsMetadataRestClient.Get(assessmentMetadataName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantAssessmentMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs index a597489deb85..27c0944f6cad 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_AzureDevOpsConnectorGet() Console.WriteLine($"Succeeded: {result}"); } + // AzureDevOpsConnector_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AzureDevOpsConnectorGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorGet.json + // this example is just showing the usage of "AzureDevOpsConnector_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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureDevOpsConnectorResource + AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); + + // invoke the operation + string azureDevOpsConnectorName = "testconnector"; + NullableResponse response = await collection.GetIfExistsAsync(azureDevOpsConnectorName); + AzureDevOpsConnectorResource 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 + AzureDevOpsConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AzureDevOpsConnector_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs index 201e3fc4d808..0ac24f12b823 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_AzureDevOpsOrgGet() Console.WriteLine($"Succeeded: {result}"); } + // AzureDevOpsOrg_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AzureDevOpsOrgGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgGet.json + // this example is just showing the usage of "AzureDevOpsOrg_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 AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // get the collection of this AzureDevOpsOrgResource + AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); + + // invoke the operation + string azureDevOpsOrgName = "myOrg"; + NullableResponse response = await collection.GetIfExistsAsync(azureDevOpsOrgName); + AzureDevOpsOrgResource 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 + AzureDevOpsOrgData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AzureDevOpsOrg_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs index 2cab02189181..7ced23b2628c 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_AzureDevOpsProjectGet() Console.WriteLine($"Succeeded: {result}"); } + // AzureDevOpsProject_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AzureDevOpsProjectGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectGet.json + // this example is just showing the usage of "AzureDevOpsProject_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 AzureDevOpsOrgResource created on azure + // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); + AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); + + // get the collection of this AzureDevOpsProjectResource + AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); + + // invoke the operation + string azureDevOpsProjectName = "myProject"; + NullableResponse response = await collection.GetIfExistsAsync(azureDevOpsProjectName); + AzureDevOpsProjectResource 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 + AzureDevOpsProjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AzureDevOpsProject_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs index 04471e6e5b70..8587ef734160 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_AzureDevOpsRepoGet() Console.WriteLine($"Succeeded: {result}"); } + // AzureDevOpsRepo_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AzureDevOpsRepoGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoGet.json + // this example is just showing the usage of "AzureDevOpsRepo_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 AzureDevOpsProjectResource created on azure + // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); + AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); + + // get the collection of this AzureDevOpsRepoResource + AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); + + // invoke the operation + string azureDevOpsRepoName = "myRepo"; + NullableResponse response = await collection.GetIfExistsAsync(azureDevOpsRepoName); + AzureDevOpsRepoResource 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 + AzureDevOpsRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AzureDevOpsRepo_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorCollection.cs index 1bb50c0ac1e1..4b294d5ec006 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GitHubConnectorGet() Console.WriteLine($"Succeeded: {result}"); } + // GitHubConnector_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GitHubConnectorGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorGet.json + // this example is just showing the usage of "GitHubConnector_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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GitHubConnectorResource + GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); + + // invoke the operation + string gitHubConnectorName = "testconnector"; + NullableResponse response = await collection.GetIfExistsAsync(gitHubConnectorName); + GitHubConnectorResource 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 + GitHubConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GitHubConnector_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerCollection.cs index 48ea3172edeb..f9f6ba82210f 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GitHubOwnerGet() Console.WriteLine($"Succeeded: {result}"); } + // GitHubOwner_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GitHubOwnerGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerGet.json + // this example is just showing the usage of "GitHubOwner_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 GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // get the collection of this GitHubOwnerResource + GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); + + // invoke the operation + string gitHubOwnerName = "Azure"; + NullableResponse response = await collection.GetIfExistsAsync(gitHubOwnerName); + GitHubOwnerResource 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 + GitHubOwnerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GitHubOwner_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoCollection.cs index ae10a7634bf8..3ce02a8403bd 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_GitHubRepoGet() Console.WriteLine($"Succeeded: {result}"); } + // GitHubRepo_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GitHubRepoGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoGet.json + // this example is just showing the usage of "GitHubRepo_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 GitHubOwnerResource created on azure + // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); + GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); + + // get the collection of this GitHubRepoResource + GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); + + // invoke the operation + string gitHubRepoName = "39093389"; + NullableResponse response = await collection.GetIfExistsAsync(gitHubRepoName); + GitHubRepoResource 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 + GitHubRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GitHubRepo_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorCollection.cs index 61ef1f0b9c73..590a809a15c1 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string azureDevOpsConnectorName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName} + /// + /// + /// Operation Id + /// AzureDevOpsConnector_Get + /// + /// + /// + /// Name of the AzureDevOps Connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureDevOpsConnectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureDevOpsConnectorName, nameof(azureDevOpsConnectorName)); + + using var scope = _azureDevOpsConnectorClientDiagnostics.CreateScope("AzureDevOpsConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _azureDevOpsConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureDevOpsConnectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureDevOpsConnectorResource(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.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName} + /// + /// + /// Operation Id + /// AzureDevOpsConnector_Get + /// + /// + /// + /// Name of the AzureDevOps Connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureDevOpsConnectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureDevOpsConnectorName, nameof(azureDevOpsConnectorName)); + + using var scope = _azureDevOpsConnectorClientDiagnostics.CreateScope("AzureDevOpsConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _azureDevOpsConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureDevOpsConnectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureDevOpsConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgCollection.cs index 17e17b9aec33..f5fe6df13dab 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string azureDevOpsOrgName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName} + /// + /// + /// Operation Id + /// AzureDevOpsOrg_Get + /// + /// + /// + /// Name of the AzureDevOps Org. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureDevOpsOrgName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureDevOpsOrgName, nameof(azureDevOpsOrgName)); + + using var scope = _azureDevOpsOrgClientDiagnostics.CreateScope("AzureDevOpsOrgCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _azureDevOpsOrgRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, azureDevOpsOrgName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureDevOpsOrgResource(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.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName} + /// + /// + /// Operation Id + /// AzureDevOpsOrg_Get + /// + /// + /// + /// Name of the AzureDevOps Org. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureDevOpsOrgName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureDevOpsOrgName, nameof(azureDevOpsOrgName)); + + using var scope = _azureDevOpsOrgClientDiagnostics.CreateScope("AzureDevOpsOrgCollection.GetIfExists"); + scope.Start(); + try + { + var response = _azureDevOpsOrgRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, azureDevOpsOrgName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureDevOpsOrgResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectCollection.cs index 13d6316b0bff..03dcd2eb3b06 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string azureDevOpsProjectName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName}/projects/{azureDevOpsProjectName} + /// + /// + /// Operation Id + /// AzureDevOpsProject_Get + /// + /// + /// + /// Name of the AzureDevOps Project. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureDevOpsProjectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureDevOpsProjectName, nameof(azureDevOpsProjectName)); + + using var scope = _azureDevOpsProjectClientDiagnostics.CreateScope("AzureDevOpsProjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _azureDevOpsProjectRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, azureDevOpsProjectName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureDevOpsProjectResource(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.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName}/projects/{azureDevOpsProjectName} + /// + /// + /// Operation Id + /// AzureDevOpsProject_Get + /// + /// + /// + /// Name of the AzureDevOps Project. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureDevOpsProjectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureDevOpsProjectName, nameof(azureDevOpsProjectName)); + + using var scope = _azureDevOpsProjectClientDiagnostics.CreateScope("AzureDevOpsProjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = _azureDevOpsProjectRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, azureDevOpsProjectName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureDevOpsProjectResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsRepoCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsRepoCollection.cs index 7fc035cabafa..15ec542148eb 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsRepoCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsRepoCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string azureDevOpsRepoName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName}/projects/{azureDevOpsProjectName}/repos/{azureDevOpsRepoName} + /// + /// + /// Operation Id + /// AzureDevOpsRepo_Get + /// + /// + /// + /// Name of the AzureDevOps Repo. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureDevOpsRepoName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureDevOpsRepoName, nameof(azureDevOpsRepoName)); + + using var scope = _azureDevOpsRepoClientDiagnostics.CreateScope("AzureDevOpsRepoCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _azureDevOpsRepoRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, azureDevOpsRepoName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureDevOpsRepoResource(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.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName}/projects/{azureDevOpsProjectName}/repos/{azureDevOpsRepoName} + /// + /// + /// Operation Id + /// AzureDevOpsRepo_Get + /// + /// + /// + /// Name of the AzureDevOps Repo. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureDevOpsRepoName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureDevOpsRepoName, nameof(azureDevOpsRepoName)); + + using var scope = _azureDevOpsRepoClientDiagnostics.CreateScope("AzureDevOpsRepoCollection.GetIfExists"); + scope.Start(); + try + { + var response = _azureDevOpsRepoRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, azureDevOpsRepoName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureDevOpsRepoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorCollection.cs index 7e84cdd6bccd..99f1636b71c3 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string gitHubConnectorName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/gitHubConnectors/{gitHubConnectorName} + /// + /// + /// Operation Id + /// GitHubConnector_Get + /// + /// + /// + /// Name of the GitHub Connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gitHubConnectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gitHubConnectorName, nameof(gitHubConnectorName)); + + using var scope = _gitHubConnectorClientDiagnostics.CreateScope("GitHubConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _gitHubConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, gitHubConnectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GitHubConnectorResource(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.SecurityDevOps/gitHubConnectors/{gitHubConnectorName} + /// + /// + /// Operation Id + /// GitHubConnector_Get + /// + /// + /// + /// Name of the GitHub Connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gitHubConnectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gitHubConnectorName, nameof(gitHubConnectorName)); + + using var scope = _gitHubConnectorClientDiagnostics.CreateScope("GitHubConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _gitHubConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, gitHubConnectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GitHubConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerCollection.cs index 65fc6a53045c..0cb7ffc2ee0e 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string gitHubOwnerName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/gitHubConnectors/{gitHubConnectorName}/owners/{gitHubOwnerName} + /// + /// + /// Operation Id + /// GitHubOwner_Get + /// + /// + /// + /// Name of the GitHub Owner. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gitHubOwnerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gitHubOwnerName, nameof(gitHubOwnerName)); + + using var scope = _gitHubOwnerClientDiagnostics.CreateScope("GitHubOwnerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _gitHubOwnerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gitHubOwnerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GitHubOwnerResource(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.SecurityDevOps/gitHubConnectors/{gitHubConnectorName}/owners/{gitHubOwnerName} + /// + /// + /// Operation Id + /// GitHubOwner_Get + /// + /// + /// + /// Name of the GitHub Owner. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gitHubOwnerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gitHubOwnerName, nameof(gitHubOwnerName)); + + using var scope = _gitHubOwnerClientDiagnostics.CreateScope("GitHubOwnerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _gitHubOwnerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gitHubOwnerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GitHubOwnerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubRepoCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubRepoCollection.cs index 628121ef480a..124a6a541baf 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubRepoCollection.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubRepoCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string gitHubRepoName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/gitHubConnectors/{gitHubConnectorName}/owners/{gitHubOwnerName}/repos/{gitHubRepoName} + /// + /// + /// Operation Id + /// GitHubRepo_Get + /// + /// + /// + /// Name of the GitHub Repo. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string gitHubRepoName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gitHubRepoName, nameof(gitHubRepoName)); + + using var scope = _gitHubRepoClientDiagnostics.CreateScope("GitHubRepoCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _gitHubRepoRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gitHubRepoName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GitHubRepoResource(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.SecurityDevOps/gitHubConnectors/{gitHubConnectorName}/owners/{gitHubOwnerName}/repos/{gitHubRepoName} + /// + /// + /// Operation Id + /// GitHubRepo_Get + /// + /// + /// + /// Name of the GitHub Repo. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string gitHubRepoName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(gitHubRepoName, nameof(gitHubRepoName)); + + using var scope = _gitHubRepoClientDiagnostics.CreateScope("GitHubRepoCollection.GetIfExists"); + scope.Start(); + try + { + var response = _gitHubRepoRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gitHubRepoName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GitHubRepoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleActionCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleActionCollection.cs index bc250abec303..f2b9ffa6c08d 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleActionCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleActionCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string actionId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId} + /// + /// + /// Operation Id + /// Actions_Get + /// + /// + /// + /// Action ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string actionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(actionId, nameof(actionId)); + + using var scope = _securityInsightsAlertRuleActionActionsClientDiagnostics.CreateScope("SecurityInsightsAlertRuleActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsAlertRuleActionActionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, actionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsAlertRuleActionResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId} + /// + /// + /// Operation Id + /// Actions_Get + /// + /// + /// + /// Action ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string actionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(actionId, nameof(actionId)); + + using var scope = _securityInsightsAlertRuleActionActionsClientDiagnostics.CreateScope("SecurityInsightsAlertRuleActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsAlertRuleActionActionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, actionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsAlertRuleActionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleCollection.cs index c6f1c776b749..2ee2bba2e070 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId} + /// + /// + /// Operation Id + /// AlertRules_Get + /// + /// + /// + /// Alert rule ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _securityInsightsAlertRuleAlertRulesClientDiagnostics.CreateScope("SecurityInsightsAlertRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsAlertRuleAlertRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsAlertRuleResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId} + /// + /// + /// Operation Id + /// AlertRules_Get + /// + /// + /// + /// Alert rule ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _securityInsightsAlertRuleAlertRulesClientDiagnostics.CreateScope("SecurityInsightsAlertRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsAlertRuleAlertRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsAlertRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleTemplateCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleTemplateCollection.cs index 7f3566e44646..902266c8239b 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleTemplateCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleTemplateCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string alertRuleTemplateId, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId} + /// + /// + /// Operation Id + /// AlertRuleTemplates_Get + /// + /// + /// + /// Alert rule template ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string alertRuleTemplateId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleTemplateId, nameof(alertRuleTemplateId)); + + using var scope = _securityInsightsAlertRuleTemplateAlertRuleTemplatesClientDiagnostics.CreateScope("SecurityInsightsAlertRuleTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsAlertRuleTemplateAlertRuleTemplatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleTemplateId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsAlertRuleTemplateResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId} + /// + /// + /// Operation Id + /// AlertRuleTemplates_Get + /// + /// + /// + /// Alert rule template ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string alertRuleTemplateId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleTemplateId, nameof(alertRuleTemplateId)); + + using var scope = _securityInsightsAlertRuleTemplateAlertRuleTemplatesClientDiagnostics.CreateScope("SecurityInsightsAlertRuleTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsAlertRuleTemplateAlertRuleTemplatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleTemplateId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsAlertRuleTemplateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAutomationRuleCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAutomationRuleCollection.cs index e26164bbebcb..803efd8e97d8 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAutomationRuleCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAutomationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string automationRuleId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId} + /// + /// + /// Operation Id + /// AutomationRules_Get + /// + /// + /// + /// Automation rule ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string automationRuleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(automationRuleId, nameof(automationRuleId)); + + using var scope = _securityInsightsAutomationRuleAutomationRulesClientDiagnostics.CreateScope("SecurityInsightsAutomationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsAutomationRuleAutomationRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, automationRuleId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsAutomationRuleResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId} + /// + /// + /// Operation Id + /// AutomationRules_Get + /// + /// + /// + /// Automation rule ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string automationRuleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(automationRuleId, nameof(automationRuleId)); + + using var scope = _securityInsightsAutomationRuleAutomationRulesClientDiagnostics.CreateScope("SecurityInsightsAutomationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsAutomationRuleAutomationRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, automationRuleId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsAutomationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsBookmarkCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsBookmarkCollection.cs index 0f3a301c8cb5..b45441744acc 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsBookmarkCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsBookmarkCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string bookmarkId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId} + /// + /// + /// Operation Id + /// Bookmarks_Get + /// + /// + /// + /// Bookmark ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string bookmarkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bookmarkId, nameof(bookmarkId)); + + using var scope = _securityInsightsBookmarkBookmarksClientDiagnostics.CreateScope("SecurityInsightsBookmarkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsBookmarkBookmarksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, bookmarkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsBookmarkResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId} + /// + /// + /// Operation Id + /// Bookmarks_Get + /// + /// + /// + /// Bookmark ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string bookmarkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bookmarkId, nameof(bookmarkId)); + + using var scope = _securityInsightsBookmarkBookmarksClientDiagnostics.CreateScope("SecurityInsightsBookmarkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsBookmarkBookmarksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, bookmarkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsBookmarkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsDataConnectorCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsDataConnectorCollection.cs index 0c2396d12f9c..a51b0d50055c 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsDataConnectorCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsDataConnectorCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string dataConnectorId, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId} + /// + /// + /// Operation Id + /// DataConnectors_Get + /// + /// + /// + /// Connector ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataConnectorId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectorId, nameof(dataConnectorId)); + + using var scope = _securityInsightsDataConnectorDataConnectorsClientDiagnostics.CreateScope("SecurityInsightsDataConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsDataConnectorDataConnectorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataConnectorId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsDataConnectorResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId} + /// + /// + /// Operation Id + /// DataConnectors_Get + /// + /// + /// + /// Connector ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataConnectorId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectorId, nameof(dataConnectorId)); + + using var scope = _securityInsightsDataConnectorDataConnectorsClientDiagnostics.CreateScope("SecurityInsightsDataConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsDataConnectorDataConnectorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataConnectorId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsDataConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCollection.cs index 45b42630d2fb..b2433883f07e 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string incidentId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId} + /// + /// + /// Operation Id + /// Incidents_Get + /// + /// + /// + /// Incident ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string incidentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(incidentId, nameof(incidentId)); + + using var scope = _securityInsightsIncidentIncidentsClientDiagnostics.CreateScope("SecurityInsightsIncidentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsIncidentIncidentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, incidentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsIncidentResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId} + /// + /// + /// Operation Id + /// Incidents_Get + /// + /// + /// + /// Incident ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string incidentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(incidentId, nameof(incidentId)); + + using var scope = _securityInsightsIncidentIncidentsClientDiagnostics.CreateScope("SecurityInsightsIncidentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsIncidentIncidentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, incidentId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsIncidentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCommentCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCommentCollection.cs index 44dada2d525b..a969f41b309e 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCommentCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCommentCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string incidentCommentId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId} + /// + /// + /// Operation Id + /// IncidentComments_Get + /// + /// + /// + /// Incident comment ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string incidentCommentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(incidentCommentId, nameof(incidentCommentId)); + + using var scope = _securityInsightsIncidentCommentIncidentCommentsClientDiagnostics.CreateScope("SecurityInsightsIncidentCommentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsIncidentCommentIncidentCommentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, incidentCommentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsIncidentCommentResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId} + /// + /// + /// Operation Id + /// IncidentComments_Get + /// + /// + /// + /// Incident comment ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string incidentCommentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(incidentCommentId, nameof(incidentCommentId)); + + using var scope = _securityInsightsIncidentCommentIncidentCommentsClientDiagnostics.CreateScope("SecurityInsightsIncidentCommentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsIncidentCommentIncidentCommentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, incidentCommentId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsIncidentCommentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentRelationCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentRelationCollection.cs index b8b7d4ba2a68..fc7dff6e8147 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentRelationCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentRelationCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string relationName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName} + /// + /// + /// Operation Id + /// IncidentRelations_Get + /// + /// + /// + /// Relation Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string relationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(relationName, nameof(relationName)); + + using var scope = _securityInsightsIncidentRelationIncidentRelationsClientDiagnostics.CreateScope("SecurityInsightsIncidentRelationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsIncidentRelationIncidentRelationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, relationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsIncidentRelationResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName} + /// + /// + /// Operation Id + /// IncidentRelations_Get + /// + /// + /// + /// Relation Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string relationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(relationName, nameof(relationName)); + + using var scope = _securityInsightsIncidentRelationIncidentRelationsClientDiagnostics.CreateScope("SecurityInsightsIncidentRelationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsIncidentRelationIncidentRelationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, relationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsIncidentRelationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsSentinelOnboardingStateCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsSentinelOnboardingStateCollection.cs index 6c46edf08906..46bffd76cb45 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsSentinelOnboardingStateCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsSentinelOnboardingStateCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string sentinelOnboardingStateName, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName} + /// + /// + /// Operation Id + /// SentinelOnboardingStates_Get + /// + /// + /// + /// The Sentinel onboarding state name. Supports - default. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sentinelOnboardingStateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sentinelOnboardingStateName, nameof(sentinelOnboardingStateName)); + + using var scope = _securityInsightsSentinelOnboardingStateSentinelOnboardingStatesClientDiagnostics.CreateScope("SecurityInsightsSentinelOnboardingStateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsSentinelOnboardingStateSentinelOnboardingStatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sentinelOnboardingStateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsSentinelOnboardingStateResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName} + /// + /// + /// Operation Id + /// SentinelOnboardingStates_Get + /// + /// + /// + /// The Sentinel onboarding state name. Supports - default. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sentinelOnboardingStateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sentinelOnboardingStateName, nameof(sentinelOnboardingStateName)); + + using var scope = _securityInsightsSentinelOnboardingStateSentinelOnboardingStatesClientDiagnostics.CreateScope("SecurityInsightsSentinelOnboardingStateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsSentinelOnboardingStateSentinelOnboardingStatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sentinelOnboardingStateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsSentinelOnboardingStateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsThreatIntelligenceIndicatorCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsThreatIntelligenceIndicatorCollection.cs index 482249a13dee..33b24a924c58 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsThreatIntelligenceIndicatorCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsThreatIntelligenceIndicatorCollection.cs @@ -250,6 +250,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name} + /// + /// + /// Operation Id + /// ThreatIntelligenceIndicators_Get + /// + /// + /// + /// Threat intelligence indicator name field. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _securityInsightsThreatIntelligenceIndicatorThreatIntelligenceIndicatorsClientDiagnostics.CreateScope("SecurityInsightsThreatIntelligenceIndicatorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsThreatIntelligenceIndicatorThreatIntelligenceIndicatorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsThreatIntelligenceIndicatorResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name} + /// + /// + /// Operation Id + /// ThreatIntelligenceIndicators_Get + /// + /// + /// + /// Threat intelligence indicator name field. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _securityInsightsThreatIntelligenceIndicatorThreatIntelligenceIndicatorsClientDiagnostics.CreateScope("SecurityInsightsThreatIntelligenceIndicatorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsThreatIntelligenceIndicatorThreatIntelligenceIndicatorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsThreatIntelligenceIndicatorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistCollection.cs index 8744cfd7e3b8..3a0b250b5ac9 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string watchlistAlias, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias} + /// + /// + /// Operation Id + /// Watchlists_Get + /// + /// + /// + /// The watchlist alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string watchlistAlias, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watchlistAlias, nameof(watchlistAlias)); + + using var scope = _securityInsightsWatchlistWatchlistsClientDiagnostics.CreateScope("SecurityInsightsWatchlistCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsWatchlistWatchlistsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, watchlistAlias, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsWatchlistResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias} + /// + /// + /// Operation Id + /// Watchlists_Get + /// + /// + /// + /// The watchlist alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string watchlistAlias, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watchlistAlias, nameof(watchlistAlias)); + + using var scope = _securityInsightsWatchlistWatchlistsClientDiagnostics.CreateScope("SecurityInsightsWatchlistCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsWatchlistWatchlistsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, watchlistAlias, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsWatchlistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistItemCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistItemCollection.cs index 6d93cf5f0a76..63811659296e 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistItemCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistItemCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string watchlistItemId, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId} + /// + /// + /// Operation Id + /// WatchlistItems_Get + /// + /// + /// + /// The watchlist item id (GUID). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string watchlistItemId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watchlistItemId, nameof(watchlistItemId)); + + using var scope = _securityInsightsWatchlistItemWatchlistItemsClientDiagnostics.CreateScope("SecurityInsightsWatchlistItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityInsightsWatchlistItemWatchlistItemsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, watchlistItemId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsWatchlistItemResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId} + /// + /// + /// Operation Id + /// WatchlistItems_Get + /// + /// + /// + /// The watchlist item id (GUID). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string watchlistItemId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watchlistItemId, nameof(watchlistItemId)); + + using var scope = _securityInsightsWatchlistItemWatchlistItemsClientDiagnostics.CreateScope("SecurityInsightsWatchlistItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityInsightsWatchlistItemWatchlistItemsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, watchlistItemId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityInsightsWatchlistItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityMLAnalyticsSettingCollection.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityMLAnalyticsSettingCollection.cs index 7f9267e8fe99..2a3a5ac57182 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityMLAnalyticsSettingCollection.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityMLAnalyticsSettingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string settingsResourceName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName} + /// + /// + /// Operation Id + /// SecurityMLAnalyticsSettings_Get + /// + /// + /// + /// Security ML Analytics Settings resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string settingsResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(settingsResourceName, nameof(settingsResourceName)); + + using var scope = _securityMLAnalyticsSettingClientDiagnostics.CreateScope("SecurityMLAnalyticsSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _securityMLAnalyticsSettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, settingsResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityMLAnalyticsSettingResource(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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName} + /// + /// + /// Operation Id + /// SecurityMLAnalyticsSettings_Get + /// + /// + /// + /// Security ML Analytics Settings resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string settingsResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(settingsResourceName, nameof(settingsResourceName)); + + using var scope = _securityMLAnalyticsSettingClientDiagnostics.CreateScope("SecurityMLAnalyticsSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _securityMLAnalyticsSettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, settingsResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecurityMLAnalyticsSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticCollection.cs index a9a120a6ad0d..233706a7ffab 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticCollection.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticCollection.cs @@ -110,5 +110,45 @@ public async Task Exists_GetsADiagnosticForAKeyVaultResource() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a Diagnostic for a KeyVault resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADiagnosticForAKeyVaultResource() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/GetDiagnosticForKeyVaultResource.json + // this example is just showing the usage of "Diagnostics_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SelfHelpDiagnosticResource + string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + SelfHelpDiagnosticCollection collection = client.GetSelfHelpDiagnostics(scopeId); + + // invoke the operation + string diagnosticsResourceName = "VMNotWorkingInsight"; + NullableResponse response = await collection.GetIfExistsAsync(diagnosticsResourceName); + SelfHelpDiagnosticResource 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 + SelfHelpDiagnosticData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticCollection.cs index 0e28278fc4a9..9015a6273799 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticCollection.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticCollection.cs @@ -265,5 +265,79 @@ public virtual Response Exists(string diagnosticsResourceName, Cancellatio throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName} + /// + /// + /// Operation Id + /// Diagnostics_Get + /// + /// + /// + /// Unique resource name for insight resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diagnosticsResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticsResourceName, nameof(diagnosticsResourceName)); + + using var scope = _selfHelpDiagnosticDiagnosticsClientDiagnostics.CreateScope("SelfHelpDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _selfHelpDiagnosticDiagnosticsRestClient.GetAsync(Id, diagnosticsResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SelfHelpDiagnosticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName} + /// + /// + /// Operation Id + /// Diagnostics_Get + /// + /// + /// + /// Unique resource name for insight resources. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diagnosticsResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diagnosticsResourceName, nameof(diagnosticsResourceName)); + + using var scope = _selfHelpDiagnosticDiagnosticsClientDiagnostics.CreateScope("SelfHelpDiagnosticCollection.GetIfExists"); + scope.Start(); + try + { + var response = _selfHelpDiagnosticDiagnosticsRestClient.Get(Id, diagnosticsResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SelfHelpDiagnosticResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_MigrationConfigurationCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_MigrationConfigurationCollection.cs index 531cee6445ac..951c232539cc 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_MigrationConfigurationCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_MigrationConfigurationCollection.cs @@ -161,5 +161,48 @@ public async Task Exists_MigrationConfigurationsGet() Console.WriteLine($"Succeeded: {result}"); } + + // MigrationConfigurationsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MigrationConfigurationsGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/Migrationconfigurations/SBMigrationconfigurationGet.json + // this example is just showing the usage of "MigrationConfigs_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 ServiceBusNamespaceResource created on azure + // for more information of creating ServiceBusNamespaceResource, please refer to the document of ServiceBusNamespaceResource + string subscriptionId = "SubscriptionId"; + string resourceGroupName = "ResourceGroup"; + string namespaceName = "sdk-Namespace-41"; + ResourceIdentifier serviceBusNamespaceResourceId = ServiceBusNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + ServiceBusNamespaceResource serviceBusNamespace = client.GetServiceBusNamespaceResource(serviceBusNamespaceResourceId); + + // get the collection of this MigrationConfigurationResource + MigrationConfigurationCollection collection = serviceBusNamespace.GetMigrationConfigurations(); + + // invoke the operation + MigrationConfigurationName configName = MigrationConfigurationName.Default; + NullableResponse response = await collection.GetIfExistsAsync(configName); + MigrationConfigurationResource 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 + MigrationConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusDisasterRecoveryAuthorizationRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusDisasterRecoveryAuthorizationRuleCollection.cs index bcf0dfe0ef16..6aba729cb5e1 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusDisasterRecoveryAuthorizationRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusDisasterRecoveryAuthorizationRuleCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_DisasterRecoveryConfigsAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // DisasterRecoveryConfigsAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DisasterRecoveryConfigsAuthorizationRuleGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/SBAliasAuthorizationRuleGet.json + // this example is just showing the usage of "DisasterRecoveryAuthorizationRules_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 ServiceBusDisasterRecoveryResource created on azure + // for more information of creating ServiceBusDisasterRecoveryResource, please refer to the document of ServiceBusDisasterRecoveryResource + string subscriptionId = "exampleSubscriptionId"; + string resourceGroupName = "exampleResourceGroup"; + string namespaceName = "sdk-Namespace-9080"; + string @alias = "sdk-DisasterRecovery-4879"; + ResourceIdentifier serviceBusDisasterRecoveryResourceId = ServiceBusDisasterRecoveryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, @alias); + ServiceBusDisasterRecoveryResource serviceBusDisasterRecovery = client.GetServiceBusDisasterRecoveryResource(serviceBusDisasterRecoveryResourceId); + + // get the collection of this ServiceBusDisasterRecoveryAuthorizationRuleResource + ServiceBusDisasterRecoveryAuthorizationRuleCollection collection = serviceBusDisasterRecovery.GetServiceBusDisasterRecoveryAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "sdk-Authrules-4879"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + ServiceBusDisasterRecoveryAuthorizationRuleResource 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 + ServiceBusAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusDisasterRecoveryCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusDisasterRecoveryCollection.cs index a23644212b43..9a04914aea2d 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusDisasterRecoveryCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusDisasterRecoveryCollection.cs @@ -160,5 +160,48 @@ public async Task Exists_SBAliasGet() Console.WriteLine($"Succeeded: {result}"); } + + // SBAliasGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SBAliasGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/SBAliasGet.json + // this example is just showing the usage of "DisasterRecoveryConfigs_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 ServiceBusNamespaceResource created on azure + // for more information of creating ServiceBusNamespaceResource, please refer to the document of ServiceBusNamespaceResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ardsouzatestRG"; + string namespaceName = "sdk-Namespace-8860"; + ResourceIdentifier serviceBusNamespaceResourceId = ServiceBusNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + ServiceBusNamespaceResource serviceBusNamespace = client.GetServiceBusNamespaceResource(serviceBusNamespaceResourceId); + + // get the collection of this ServiceBusDisasterRecoveryResource + ServiceBusDisasterRecoveryCollection collection = serviceBusNamespace.GetServiceBusDisasterRecoveries(); + + // invoke the operation + string @alias = "sdk-DisasterRecovery-3814"; + NullableResponse response = await collection.GetIfExistsAsync(@alias); + ServiceBusDisasterRecoveryResource 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 + ServiceBusDisasterRecoveryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusNamespaceAuthorizationRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusNamespaceAuthorizationRuleCollection.cs index 020f216891d1..f011d5901a8c 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusNamespaceAuthorizationRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusNamespaceAuthorizationRuleCollection.cs @@ -163,5 +163,48 @@ public async Task Exists_NameSpaceAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // NameSpaceAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpaceAuthorizationRuleGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/NameSpaces/SBNameSpaceAuthorizationRuleGet.json + // this example is just showing the usage of "NamespaceAuthorizationRules_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 ServiceBusNamespaceResource created on azure + // for more information of creating ServiceBusNamespaceResource, please refer to the document of ServiceBusNamespaceResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-6914"; + ResourceIdentifier serviceBusNamespaceResourceId = ServiceBusNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + ServiceBusNamespaceResource serviceBusNamespace = client.GetServiceBusNamespaceResource(serviceBusNamespaceResourceId); + + // get the collection of this ServiceBusNamespaceAuthorizationRuleResource + ServiceBusNamespaceAuthorizationRuleCollection collection = serviceBusNamespace.GetServiceBusNamespaceAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "sdk-AuthRules-1788"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + ServiceBusNamespaceAuthorizationRuleResource 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 + ServiceBusAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusNamespaceCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusNamespaceCollection.cs index 9ce9c64a4424..a1994fbeab0e 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusNamespaceCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusNamespaceCollection.cs @@ -167,5 +167,47 @@ public async Task Exists_NameSpaceGet() Console.WriteLine($"Succeeded: {result}"); } + + // NameSpaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpaceGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/NameSpaces/SBNameSpaceGet.json + // this example is just showing the usage of "Namespaces_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 = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ServiceBusNamespaceResource + ServiceBusNamespaceCollection collection = resourceGroupResource.GetServiceBusNamespaces(); + + // invoke the operation + string namespaceName = "sdk-Namespace-2924"; + NullableResponse response = await collection.GetIfExistsAsync(namespaceName); + ServiceBusNamespaceResource 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 + ServiceBusNamespaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusPrivateEndpointConnectionCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusPrivateEndpointConnectionCollection.cs index 456c44bf4e32..1349bc9a050c 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusPrivateEndpointConnectionCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusPrivateEndpointConnectionCollection.cs @@ -166,5 +166,48 @@ public async Task Exists_NameSpacePrivateEndPointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + + // NameSpacePrivateEndPointConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_NameSpacePrivateEndPointConnectionGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/NameSpaces/PrivateEndPointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 ServiceBusNamespaceResource created on azure + // for more information of creating ServiceBusNamespaceResource, please refer to the document of ServiceBusNamespaceResource + string subscriptionId = "subID"; + string resourceGroupName = "SDK-ServiceBus-4794"; + string namespaceName = "sdk-Namespace-5828"; + ResourceIdentifier serviceBusNamespaceResourceId = ServiceBusNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + ServiceBusNamespaceResource serviceBusNamespace = client.GetServiceBusNamespaceResource(serviceBusNamespaceResourceId); + + // get the collection of this ServiceBusPrivateEndpointConnectionResource + ServiceBusPrivateEndpointConnectionCollection collection = serviceBusNamespace.GetServiceBusPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + ServiceBusPrivateEndpointConnectionResource 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 + ServiceBusPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusQueueAuthorizationRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusQueueAuthorizationRuleCollection.cs index f15ed2196adb..37d8a2613839 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusQueueAuthorizationRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusQueueAuthorizationRuleCollection.cs @@ -167,5 +167,49 @@ public async Task Exists_QueueAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // QueueAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QueueAuthorizationRuleGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/Queues/SBQueueAuthorizationRuleGet.json + // this example is just showing the usage of "QueueAuthorizationRules_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 ServiceBusQueueResource created on azure + // for more information of creating ServiceBusQueueResource, please refer to the document of ServiceBusQueueResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-7982"; + string queueName = "sdk-Queues-2317"; + ResourceIdentifier serviceBusQueueResourceId = ServiceBusQueueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, queueName); + ServiceBusQueueResource serviceBusQueue = client.GetServiceBusQueueResource(serviceBusQueueResourceId); + + // get the collection of this ServiceBusQueueAuthorizationRuleResource + ServiceBusQueueAuthorizationRuleCollection collection = serviceBusQueue.GetServiceBusQueueAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "sdk-AuthRules-5800"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + ServiceBusQueueAuthorizationRuleResource 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 + ServiceBusAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusQueueCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusQueueCollection.cs index ef4e5019db22..5324d3964786 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusQueueCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusQueueCollection.cs @@ -159,5 +159,48 @@ public async Task Exists_QueueGet() Console.WriteLine($"Succeeded: {result}"); } + + // QueueGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_QueueGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/Queues/SBQueueGet.json + // this example is just showing the usage of "Queues_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 ServiceBusNamespaceResource created on azure + // for more information of creating ServiceBusNamespaceResource, please refer to the document of ServiceBusNamespaceResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-3174"; + ResourceIdentifier serviceBusNamespaceResourceId = ServiceBusNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + ServiceBusNamespaceResource serviceBusNamespace = client.GetServiceBusNamespaceResource(serviceBusNamespaceResourceId); + + // get the collection of this ServiceBusQueueResource + ServiceBusQueueCollection collection = serviceBusNamespace.GetServiceBusQueues(); + + // invoke the operation + string queueName = "sdk-Queues-5647"; + NullableResponse response = await collection.GetIfExistsAsync(queueName); + ServiceBusQueueResource 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 + ServiceBusQueueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusRuleCollection.cs index 22d4d3ab4666..ebeca69d2556 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusRuleCollection.cs @@ -260,5 +260,50 @@ public async Task Exists_RulesGet() Console.WriteLine($"Succeeded: {result}"); } + + // RulesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RulesGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/Rules/RuleGet.json + // this example is just showing the usage of "Rules_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 ServiceBusSubscriptionResource created on azure + // for more information of creating ServiceBusSubscriptionResource, please refer to the document of ServiceBusSubscriptionResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-1319"; + string topicName = "sdk-Topics-2081"; + string subscriptionName = "sdk-Subscriptions-8691"; + ResourceIdentifier serviceBusSubscriptionResourceId = ServiceBusSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, topicName, subscriptionName); + ServiceBusSubscriptionResource serviceBusSubscription = client.GetServiceBusSubscriptionResource(serviceBusSubscriptionResourceId); + + // get the collection of this ServiceBusRuleResource + ServiceBusRuleCollection collection = serviceBusSubscription.GetServiceBusRules(); + + // invoke the operation + string ruleName = "sdk-Rules-6571"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + ServiceBusRuleResource 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 + ServiceBusRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusSubscriptionCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusSubscriptionCollection.cs index b4211657c2bd..0c255c0a7635 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusSubscriptionCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusSubscriptionCollection.cs @@ -163,5 +163,49 @@ public async Task Exists_SubscriptionGet() Console.WriteLine($"Succeeded: {result}"); } + + // SubscriptionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SubscriptionGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/Subscriptions/SBSubscriptionGet.json + // this example is just showing the usage of "Subscriptions_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 ServiceBusTopicResource created on azure + // for more information of creating ServiceBusTopicResource, please refer to the document of ServiceBusTopicResource + string subscriptionId = "Subscriptionid"; + string resourceGroupName = "ResourceGroup"; + string namespaceName = "sdk-Namespace-1349"; + string topicName = "sdk-Topics-8740"; + ResourceIdentifier serviceBusTopicResourceId = ServiceBusTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, topicName); + ServiceBusTopicResource serviceBusTopic = client.GetServiceBusTopicResource(serviceBusTopicResourceId); + + // get the collection of this ServiceBusSubscriptionResource + ServiceBusSubscriptionCollection collection = serviceBusTopic.GetServiceBusSubscriptions(); + + // invoke the operation + string subscriptionName = "sdk-Subscriptions-2178"; + NullableResponse response = await collection.GetIfExistsAsync(subscriptionName); + ServiceBusSubscriptionResource 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 + ServiceBusSubscriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusTopicAuthorizationRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusTopicAuthorizationRuleCollection.cs index eef86c71452d..aed0f41c25f2 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusTopicAuthorizationRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusTopicAuthorizationRuleCollection.cs @@ -167,5 +167,49 @@ public async Task Exists_TopicAuthorizationRuleGet() Console.WriteLine($"Succeeded: {result}"); } + + // TopicAuthorizationRuleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TopicAuthorizationRuleGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/Topics/SBTopicAuthorizationRuleGet.json + // this example is just showing the usage of "TopicAuthorizationRules_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 ServiceBusTopicResource created on azure + // for more information of creating ServiceBusTopicResource, please refer to the document of ServiceBusTopicResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-6261"; + string topicName = "sdk-Topics-1984"; + ResourceIdentifier serviceBusTopicResourceId = ServiceBusTopicResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, topicName); + ServiceBusTopicResource serviceBusTopic = client.GetServiceBusTopicResource(serviceBusTopicResourceId); + + // get the collection of this ServiceBusTopicAuthorizationRuleResource + ServiceBusTopicAuthorizationRuleCollection collection = serviceBusTopic.GetServiceBusTopicAuthorizationRules(); + + // invoke the operation + string authorizationRuleName = "sdk-AuthRules-4310"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationRuleName); + ServiceBusTopicAuthorizationRuleResource 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 + ServiceBusAuthorizationRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusTopicCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusTopicCollection.cs index b438314b4c03..1234add2b458 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusTopicCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/samples/Generated/Samples/Sample_ServiceBusTopicCollection.cs @@ -159,5 +159,48 @@ public async Task Exists_TopicGet() Console.WriteLine($"Succeeded: {result}"); } + + // TopicGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TopicGet() + { + // Generated from example definition: specification/servicebus/resource-manager/Microsoft.ServiceBus/preview/2022-10-01-preview/examples/Topics/SBTopicGet.json + // this example is just showing the usage of "Topics_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 ServiceBusNamespaceResource created on azure + // for more information of creating ServiceBusNamespaceResource, please refer to the document of ServiceBusNamespaceResource + string subscriptionId = "5f750a97-50d9-4e36-8081-c9ee4c0210d4"; + string resourceGroupName = "ArunMonocle"; + string namespaceName = "sdk-Namespace-1617"; + ResourceIdentifier serviceBusNamespaceResourceId = ServiceBusNamespaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName); + ServiceBusNamespaceResource serviceBusNamespace = client.GetServiceBusNamespaceResource(serviceBusNamespaceResourceId); + + // get the collection of this ServiceBusTopicResource + ServiceBusTopicCollection collection = serviceBusNamespace.GetServiceBusTopics(); + + // invoke the operation + string topicName = "sdk-Topics-5488"; + NullableResponse response = await collection.GetIfExistsAsync(topicName); + ServiceBusTopicResource 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 + ServiceBusTopicData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/MigrationConfigurationCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/MigrationConfigurationCollection.cs index cbfd1b78538d..2ab353ba13b7 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/MigrationConfigurationCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/MigrationConfigurationCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(MigrationConfigurationName configName, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName} + /// + /// + /// Operation Id + /// MigrationConfigs_Get + /// + /// + /// + /// The configuration name. Should always be "$default". + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(MigrationConfigurationName configName, CancellationToken cancellationToken = default) + { + using var scope = _migrationConfigurationMigrationConfigsClientDiagnostics.CreateScope("MigrationConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _migrationConfigurationMigrationConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MigrationConfigurationResource(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.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName} + /// + /// + /// Operation Id + /// MigrationConfigs_Get + /// + /// + /// + /// The configuration name. Should always be "$default". + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(MigrationConfigurationName configName, CancellationToken cancellationToken = default) + { + using var scope = _migrationConfigurationMigrationConfigsClientDiagnostics.CreateScope("MigrationConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _migrationConfigurationMigrationConfigsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MigrationConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryAuthorizationRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryAuthorizationRuleCollection.cs index 94af724b375e..c422fa859632 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryAuthorizationRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryAuthorizationRuleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// DisasterRecoveryAuthorizationRules_Get + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _serviceBusDisasterRecoveryAuthorizationRuleDisasterRecoveryAuthorizationRulesClientDiagnostics.CreateScope("ServiceBusDisasterRecoveryAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusDisasterRecoveryAuthorizationRuleDisasterRecoveryAuthorizationRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusDisasterRecoveryAuthorizationRuleResource(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.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// DisasterRecoveryAuthorizationRules_Get + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _serviceBusDisasterRecoveryAuthorizationRuleDisasterRecoveryAuthorizationRulesClientDiagnostics.CreateScope("ServiceBusDisasterRecoveryAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusDisasterRecoveryAuthorizationRuleDisasterRecoveryAuthorizationRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusDisasterRecoveryAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryCollection.cs index c9ebe600ba84..55089be69ca8 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string @alias, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias} + /// + /// + /// Operation Id + /// DisasterRecoveryConfigs_Get + /// + /// + /// + /// The Disaster Recovery configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string @alias, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(@alias, nameof(@alias)); + + using var scope = _serviceBusDisasterRecoveryDisasterRecoveryConfigsClientDiagnostics.CreateScope("ServiceBusDisasterRecoveryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusDisasterRecoveryDisasterRecoveryConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alias, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusDisasterRecoveryResource(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.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias} + /// + /// + /// Operation Id + /// DisasterRecoveryConfigs_Get + /// + /// + /// + /// The Disaster Recovery configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string @alias, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(@alias, nameof(@alias)); + + using var scope = _serviceBusDisasterRecoveryDisasterRecoveryConfigsClientDiagnostics.CreateScope("ServiceBusDisasterRecoveryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusDisasterRecoveryDisasterRecoveryConfigsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alias, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusDisasterRecoveryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceAuthorizationRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceAuthorizationRuleCollection.cs index 9817723fabbe..4363d752a629 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceAuthorizationRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceAuthorizationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NamespaceAuthorizationRules_Get + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _serviceBusNamespaceAuthorizationRuleNamespaceAuthorizationRulesClientDiagnostics.CreateScope("ServiceBusNamespaceAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusNamespaceAuthorizationRuleNamespaceAuthorizationRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusNamespaceAuthorizationRuleResource(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.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// NamespaceAuthorizationRules_Get + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _serviceBusNamespaceAuthorizationRuleNamespaceAuthorizationRulesClientDiagnostics.CreateScope("ServiceBusNamespaceAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusNamespaceAuthorizationRuleNamespaceAuthorizationRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusNamespaceAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceCollection.cs index 74efe49fa866..939e4b603004 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string namespaceName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _serviceBusNamespaceNamespacesClientDiagnostics.CreateScope("ServiceBusNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusNamespaceNamespacesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusNamespaceResource(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.ServiceBus/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string namespaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namespaceName, nameof(namespaceName)); + + using var scope = _serviceBusNamespaceNamespacesClientDiagnostics.CreateScope("ServiceBusNamespaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusNamespaceNamespacesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, namespaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusNamespaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusPrivateEndpointConnectionCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusPrivateEndpointConnectionCollection.cs index 9736a50e870b..0d93a029c795 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusPrivateEndpointConnectionCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The PrivateEndpointConnection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _serviceBusPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ServiceBusPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusPrivateEndpointConnectionResource(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.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The PrivateEndpointConnection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _serviceBusPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ServiceBusPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueAuthorizationRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueAuthorizationRuleCollection.cs index 0d6f3255a737..56fcd4c8a98b 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueAuthorizationRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueAuthorizationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// QueueAuthorizationRules_Get + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _serviceBusQueueAuthorizationRuleQueueAuthorizationRulesClientDiagnostics.CreateScope("ServiceBusQueueAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusQueueAuthorizationRuleQueueAuthorizationRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusQueueAuthorizationRuleResource(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.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// QueueAuthorizationRules_Get + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _serviceBusQueueAuthorizationRuleQueueAuthorizationRulesClientDiagnostics.CreateScope("ServiceBusQueueAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusQueueAuthorizationRuleQueueAuthorizationRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusQueueAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueCollection.cs index 1ff2b3def351..e0ddcdb1784c 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string queueName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName} + /// + /// + /// Operation Id + /// Queues_Get + /// + /// + /// + /// The queue name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string queueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queueName, nameof(queueName)); + + using var scope = _serviceBusQueueQueuesClientDiagnostics.CreateScope("ServiceBusQueueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusQueueQueuesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, queueName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusQueueResource(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.ServiceBus/namespaces/{namespaceName}/queues/{queueName} + /// + /// + /// Operation Id + /// Queues_Get + /// + /// + /// + /// The queue name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string queueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(queueName, nameof(queueName)); + + using var scope = _serviceBusQueueQueuesClientDiagnostics.CreateScope("ServiceBusQueueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusQueueQueuesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, queueName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusQueueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusRuleCollection.cs index 34fba482d535..9d317868666a 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusRuleCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName} + /// + /// + /// Operation Id + /// Rules_Get + /// + /// + /// + /// The rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _serviceBusRuleRulesClientDiagnostics.CreateScope("ServiceBusRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusRuleRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusRuleResource(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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName} + /// + /// + /// Operation Id + /// Rules_Get + /// + /// + /// + /// The rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _serviceBusRuleRulesClientDiagnostics.CreateScope("ServiceBusRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusRuleRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionCollection.cs index 78e216f4ff68..ba0d00e6a9f3 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string subscriptionName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName} + /// + /// + /// Operation Id + /// Subscriptions_Get + /// + /// + /// + /// The subscription name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string subscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionName, nameof(subscriptionName)); + + using var scope = _serviceBusSubscriptionSubscriptionsClientDiagnostics.CreateScope("ServiceBusSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusSubscriptionSubscriptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, subscriptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusSubscriptionResource(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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName} + /// + /// + /// Operation Id + /// Subscriptions_Get + /// + /// + /// + /// The subscription name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string subscriptionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionName, nameof(subscriptionName)); + + using var scope = _serviceBusSubscriptionSubscriptionsClientDiagnostics.CreateScope("ServiceBusSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusSubscriptionSubscriptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, subscriptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicAuthorizationRuleCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicAuthorizationRuleCollection.cs index 009ee7401210..c9cb126546e8 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicAuthorizationRuleCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicAuthorizationRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationRuleName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// TopicAuthorizationRules_Get + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _serviceBusTopicAuthorizationRuleTopicAuthorizationRulesClientDiagnostics.CreateScope("ServiceBusTopicAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusTopicAuthorizationRuleTopicAuthorizationRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusTopicAuthorizationRuleResource(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.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName} + /// + /// + /// Operation Id + /// TopicAuthorizationRules_Get + /// + /// + /// + /// The authorization rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationRuleName, nameof(authorizationRuleName)); + + using var scope = _serviceBusTopicAuthorizationRuleTopicAuthorizationRulesClientDiagnostics.CreateScope("ServiceBusTopicAuthorizationRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusTopicAuthorizationRuleTopicAuthorizationRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusTopicAuthorizationRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicCollection.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicCollection.cs index db02b1d0bcfe..e83f945f47b3 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicCollection.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string topicName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// Topics_Get + /// + /// + /// + /// The topic name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _serviceBusTopicTopicsClientDiagnostics.CreateScope("ServiceBusTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceBusTopicTopicsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusTopicResource(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.ServiceBus/namespaces/{namespaceName}/topics/{topicName} + /// + /// + /// Operation Id + /// Topics_Get + /// + /// + /// + /// The topic name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string topicName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicName, nameof(topicName)); + + using var scope = _serviceBusTopicTopicsClientDiagnostics.CreateScope("ServiceBusTopicCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceBusTopicTopicsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, topicName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceBusTopicResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationCollection.cs index 7d4df2ebcefc..725eee63270a 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAnApplication() Console.WriteLine($"Succeeded: {result}"); } + // Get an application + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnApplication() + { + // Generated from example definition: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationGetOperation_example.json + // this example is just showing the usage of "Applications_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 ServiceFabricClusterResource created on azure + // for more information of creating ServiceFabricClusterResource, please refer to the document of ServiceFabricClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + ResourceIdentifier serviceFabricClusterResourceId = ServiceFabricClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + ServiceFabricClusterResource serviceFabricCluster = client.GetServiceFabricClusterResource(serviceFabricClusterResourceId); + + // get the collection of this ServiceFabricApplicationResource + ServiceFabricApplicationCollection collection = serviceFabricCluster.GetServiceFabricApplications(); + + // invoke the operation + string applicationName = "myApp"; + NullableResponse response = await collection.GetIfExistsAsync(applicationName); + ServiceFabricApplicationResource 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 + ServiceFabricApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put an application with maximum parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationTypeCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationTypeCollection.cs index 8838ce46eeaf..ae47bc6fa5cc 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationTypeCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationTypeCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetAnApplicationType() Console.WriteLine($"Succeeded: {result}"); } + // Get an application type + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnApplicationType() + { + // Generated from example definition: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeNameGetOperation_example.json + // this example is just showing the usage of "ApplicationTypes_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 ServiceFabricClusterResource created on azure + // for more information of creating ServiceFabricClusterResource, please refer to the document of ServiceFabricClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + ResourceIdentifier serviceFabricClusterResourceId = ServiceFabricClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + ServiceFabricClusterResource serviceFabricCluster = client.GetServiceFabricClusterResource(serviceFabricClusterResourceId); + + // get the collection of this ServiceFabricApplicationTypeResource + ServiceFabricApplicationTypeCollection collection = serviceFabricCluster.GetServiceFabricApplicationTypes(); + + // invoke the operation + string applicationTypeName = "myAppType"; + NullableResponse response = await collection.GetIfExistsAsync(applicationTypeName); + ServiceFabricApplicationTypeResource 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 + ServiceFabricApplicationTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put an application type [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationTypeVersionCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationTypeVersionCollection.cs index 96877690b66e..418d32016e5b 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationTypeVersionCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricApplicationTypeVersionCollection.cs @@ -85,6 +85,50 @@ public async Task Exists_GetAnApplicationTypeVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get an application type version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnApplicationTypeVersion() + { + // Generated from example definition: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeVersionGetOperation_example.json + // this example is just showing the usage of "ApplicationTypeVersions_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 ServiceFabricApplicationTypeResource created on azure + // for more information of creating ServiceFabricApplicationTypeResource, please refer to the document of ServiceFabricApplicationTypeResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + string applicationTypeName = "myAppType"; + ResourceIdentifier serviceFabricApplicationTypeResourceId = ServiceFabricApplicationTypeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, applicationTypeName); + ServiceFabricApplicationTypeResource serviceFabricApplicationType = client.GetServiceFabricApplicationTypeResource(serviceFabricApplicationTypeResourceId); + + // get the collection of this ServiceFabricApplicationTypeVersionResource + ServiceFabricApplicationTypeVersionCollection collection = serviceFabricApplicationType.GetServiceFabricApplicationTypeVersions(); + + // invoke the operation + string version = "1.0"; + NullableResponse response = await collection.GetIfExistsAsync(version); + ServiceFabricApplicationTypeVersionResource 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 + ServiceFabricApplicationTypeVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put an application type version [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricClusterCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricClusterCollection.cs index 87e6c04cb976..8c334bb9dbb7 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricClusterCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricClusterCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetACluster() Console.WriteLine($"Succeeded: {result}"); } + // Get a cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACluster() + { + // Generated from example definition: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ClusterGetOperation_example.json + // this example is just showing the usage of "Clusters_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 = "resRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ServiceFabricClusterResource + ServiceFabricClusterCollection collection = resourceGroupResource.GetServiceFabricClusters(); + + // invoke the operation + string clusterName = "myCluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + ServiceFabricClusterResource 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 + ServiceFabricClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put a cluster with maximum parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricServiceCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricServiceCollection.cs index 8df2ed0db4d7..bdd73478c688 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricServiceCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/samples/Generated/Samples/Sample_ServiceFabricServiceCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetAService() Console.WriteLine($"Succeeded: {result}"); } + // Get a service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAService() + { + // Generated from example definition: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ServiceGetOperation_example.json + // this example is just showing the usage of "Services_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 ServiceFabricApplicationResource created on azure + // for more information of creating ServiceFabricApplicationResource, please refer to the document of ServiceFabricApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + string applicationName = "myApp"; + ResourceIdentifier serviceFabricApplicationResourceId = ServiceFabricApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, applicationName); + ServiceFabricApplicationResource serviceFabricApplication = client.GetServiceFabricApplicationResource(serviceFabricApplicationResourceId); + + // get the collection of this ServiceFabricServiceResource + ServiceFabricServiceCollection collection = serviceFabricApplication.GetServiceFabricServices(); + + // invoke the operation + string serviceName = "myService"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + ServiceFabricServiceResource 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 + ServiceFabricServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put a service with maximum parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationCollection.cs index d09f8203b27f..439d39d51d12 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string applicationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the application 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 applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _serviceFabricApplicationApplicationsClientDiagnostics.CreateScope("ServiceFabricApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricApplicationResource(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.ServiceFabric/clusters/{clusterName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the application resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _serviceFabricApplicationApplicationsClientDiagnostics.CreateScope("ServiceFabricApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeCollection.cs index 03e65890e637..6543422ed45a 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string applicationTypeName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName} + /// + /// + /// Operation Id + /// ApplicationTypes_Get + /// + /// + /// + /// The name of the application type name 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 applicationTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationTypeName, nameof(applicationTypeName)); + + using var scope = _serviceFabricApplicationTypeApplicationTypesClientDiagnostics.CreateScope("ServiceFabricApplicationTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricApplicationTypeApplicationTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricApplicationTypeResource(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.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName} + /// + /// + /// Operation Id + /// ApplicationTypes_Get + /// + /// + /// + /// The name of the application type name resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationTypeName, nameof(applicationTypeName)); + + using var scope = _serviceFabricApplicationTypeApplicationTypesClientDiagnostics.CreateScope("ServiceFabricApplicationTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricApplicationTypeApplicationTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricApplicationTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeVersionCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeVersionCollection.cs index 2cb2bc8bd92b..ad20d7061c4d 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeVersionCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeVersionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string version, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version} + /// + /// + /// Operation Id + /// ApplicationTypeVersions_Get + /// + /// + /// + /// The application type version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _serviceFabricApplicationTypeVersionApplicationTypeVersionsClientDiagnostics.CreateScope("ServiceFabricApplicationTypeVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricApplicationTypeVersionApplicationTypeVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricApplicationTypeVersionResource(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.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version} + /// + /// + /// Operation Id + /// ApplicationTypeVersions_Get + /// + /// + /// + /// The application type version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _serviceFabricApplicationTypeVersionApplicationTypeVersionsClientDiagnostics.CreateScope("ServiceFabricApplicationTypeVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricApplicationTypeVersionApplicationTypeVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricApplicationTypeVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterCollection.cs index 1d69f9c19afc..eae7e9f35038 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster 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 clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _serviceFabricClusterClustersClientDiagnostics.CreateScope("ServiceFabricClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricClusterResource(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.ServiceFabric/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _serviceFabricClusterClustersClientDiagnostics.CreateScope("ServiceFabricClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricServiceCollection.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricServiceCollection.cs index de74e3331d6e..ce5d5c4f41ae 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricServiceCollection.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricServiceCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service resource in the format of {applicationName}~{serviceName}. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _serviceFabricServiceServicesClientDiagnostics.CreateScope("ServiceFabricServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricServiceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricServiceResource(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.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service resource in the format of {applicationName}~{serviceName}. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _serviceFabricServiceServicesClientDiagnostics.CreateScope("ServiceFabricServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricServiceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationCollection.cs index 89802946eec6..b604e24828f6 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAnApplication() Console.WriteLine($"Succeeded: {result}"); } + // Get an application + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnApplication() + { + // Generated from example definition: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-03-01-preview/examples/ApplicationGetOperation_example.json + // this example is just showing the usage of "Applications_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 ServiceFabricManagedClusterResource created on azure + // for more information of creating ServiceFabricManagedClusterResource, please refer to the document of ServiceFabricManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + ResourceIdentifier serviceFabricManagedClusterResourceId = ServiceFabricManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + ServiceFabricManagedClusterResource serviceFabricManagedCluster = client.GetServiceFabricManagedClusterResource(serviceFabricManagedClusterResourceId); + + // get the collection of this ServiceFabricManagedApplicationResource + ServiceFabricManagedApplicationCollection collection = serviceFabricManagedCluster.GetServiceFabricManagedApplications(); + + // invoke the operation + string applicationName = "myApp"; + NullableResponse response = await collection.GetIfExistsAsync(applicationName); + ServiceFabricManagedApplicationResource 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 + ServiceFabricManagedApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put an application with maximum parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationTypeCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationTypeCollection.cs index 40d51bd8e83f..2d84101d45cd 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationTypeCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationTypeCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetAnApplicationType() Console.WriteLine($"Succeeded: {result}"); } + // Get an application type + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnApplicationType() + { + // Generated from example definition: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-03-01-preview/examples/ApplicationTypeNameGetOperation_example.json + // this example is just showing the usage of "ApplicationTypes_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 ServiceFabricManagedClusterResource created on azure + // for more information of creating ServiceFabricManagedClusterResource, please refer to the document of ServiceFabricManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + ResourceIdentifier serviceFabricManagedClusterResourceId = ServiceFabricManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + ServiceFabricManagedClusterResource serviceFabricManagedCluster = client.GetServiceFabricManagedClusterResource(serviceFabricManagedClusterResourceId); + + // get the collection of this ServiceFabricManagedApplicationTypeResource + ServiceFabricManagedApplicationTypeCollection collection = serviceFabricManagedCluster.GetServiceFabricManagedApplicationTypes(); + + // invoke the operation + string applicationTypeName = "myAppType"; + NullableResponse response = await collection.GetIfExistsAsync(applicationTypeName); + ServiceFabricManagedApplicationTypeResource 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 + ServiceFabricManagedApplicationTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put an application type [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationTypeVersionCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationTypeVersionCollection.cs index f0a5bd61db93..a90224383597 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationTypeVersionCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedApplicationTypeVersionCollection.cs @@ -85,6 +85,50 @@ public async Task Exists_GetAnApplicationTypeVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get an application type version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnApplicationTypeVersion() + { + // Generated from example definition: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-03-01-preview/examples/ApplicationTypeVersionGetOperation_example.json + // this example is just showing the usage of "ApplicationTypeVersions_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 ServiceFabricManagedApplicationTypeResource created on azure + // for more information of creating ServiceFabricManagedApplicationTypeResource, please refer to the document of ServiceFabricManagedApplicationTypeResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + string applicationTypeName = "myAppType"; + ResourceIdentifier serviceFabricManagedApplicationTypeResourceId = ServiceFabricManagedApplicationTypeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, applicationTypeName); + ServiceFabricManagedApplicationTypeResource serviceFabricManagedApplicationType = client.GetServiceFabricManagedApplicationTypeResource(serviceFabricManagedApplicationTypeResourceId); + + // get the collection of this ServiceFabricManagedApplicationTypeVersionResource + ServiceFabricManagedApplicationTypeVersionCollection collection = serviceFabricManagedApplicationType.GetServiceFabricManagedApplicationTypeVersions(); + + // invoke the operation + string version = "1.0"; + NullableResponse response = await collection.GetIfExistsAsync(version); + ServiceFabricManagedApplicationTypeVersionResource 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 + ServiceFabricManagedApplicationTypeVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put an application type version [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedClusterCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedClusterCollection.cs index 9e1c3f433f2c..380d121e61dc 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedClusterCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedClusterCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetACluster() Console.WriteLine($"Succeeded: {result}"); } + // Get a cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACluster() + { + // Generated from example definition: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-03-01-preview/examples/ManagedClusterGetOperation_example.json + // this example is just showing the usage of "ManagedClusters_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 = "resRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ServiceFabricManagedClusterResource + ServiceFabricManagedClusterCollection collection = resourceGroupResource.GetServiceFabricManagedClusters(); + + // invoke the operation + string clusterName = "myCluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + ServiceFabricManagedClusterResource 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 + ServiceFabricManagedClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put a cluster with maximum parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedNodeTypeCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedNodeTypeCollection.cs index 56a7ecc58774..fef268191bc7 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedNodeTypeCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedNodeTypeCollection.cs @@ -123,6 +123,49 @@ public async Task Exists_GetANodeType() Console.WriteLine($"Succeeded: {result}"); } + // Get a node type + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANodeType() + { + // Generated from example definition: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-03-01-preview/examples/NodeTypeGetOperation_example.json + // this example is just showing the usage of "NodeTypes_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 ServiceFabricManagedClusterResource created on azure + // for more information of creating ServiceFabricManagedClusterResource, please refer to the document of ServiceFabricManagedClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + ResourceIdentifier serviceFabricManagedClusterResourceId = ServiceFabricManagedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + ServiceFabricManagedClusterResource serviceFabricManagedCluster = client.GetServiceFabricManagedClusterResource(serviceFabricManagedClusterResourceId); + + // get the collection of this ServiceFabricManagedNodeTypeResource + ServiceFabricManagedNodeTypeCollection collection = serviceFabricManagedCluster.GetServiceFabricManagedNodeTypes(); + + // invoke the operation + string nodeTypeName = "FE"; + NullableResponse response = await collection.GetIfExistsAsync(nodeTypeName); + ServiceFabricManagedNodeTypeResource 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 + ServiceFabricManagedNodeTypeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put a node type with auto-scale parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedServiceCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedServiceCollection.cs index 9869ff492a16..52dd7bbd8c8d 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedServiceCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/samples/Generated/Samples/Sample_ServiceFabricManagedServiceCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetAService() Console.WriteLine($"Succeeded: {result}"); } + // Get a service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAService() + { + // Generated from example definition: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-03-01-preview/examples/ServiceGetOperation_example.json + // this example is just showing the usage of "Services_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 ServiceFabricManagedApplicationResource created on azure + // for more information of creating ServiceFabricManagedApplicationResource, please refer to the document of ServiceFabricManagedApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resRg"; + string clusterName = "myCluster"; + string applicationName = "myApp"; + ResourceIdentifier serviceFabricManagedApplicationResourceId = ServiceFabricManagedApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, applicationName); + ServiceFabricManagedApplicationResource serviceFabricManagedApplication = client.GetServiceFabricManagedApplicationResource(serviceFabricManagedApplicationResourceId); + + // get the collection of this ServiceFabricManagedServiceResource + ServiceFabricManagedServiceCollection collection = serviceFabricManagedApplication.GetServiceFabricManagedServices(); + + // invoke the operation + string serviceName = "myService"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + ServiceFabricManagedServiceResource 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 + ServiceFabricManagedServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put a service with maximum parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationCollection.cs index 263fe45594e0..703bab8f4e87 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string applicationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the application 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 applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _serviceFabricManagedApplicationApplicationsClientDiagnostics.CreateScope("ServiceFabricManagedApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricManagedApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedApplicationResource(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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the application resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _serviceFabricManagedApplicationApplicationsClientDiagnostics.CreateScope("ServiceFabricManagedApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricManagedApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeCollection.cs index bcab8c75788d..303f84f47ff9 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string applicationTypeName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName} + /// + /// + /// Operation Id + /// ApplicationTypes_Get + /// + /// + /// + /// The name of the application type name 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 applicationTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationTypeName, nameof(applicationTypeName)); + + using var scope = _serviceFabricManagedApplicationTypeApplicationTypesClientDiagnostics.CreateScope("ServiceFabricManagedApplicationTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricManagedApplicationTypeApplicationTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedApplicationTypeResource(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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName} + /// + /// + /// Operation Id + /// ApplicationTypes_Get + /// + /// + /// + /// The name of the application type name resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationTypeName, nameof(applicationTypeName)); + + using var scope = _serviceFabricManagedApplicationTypeApplicationTypesClientDiagnostics.CreateScope("ServiceFabricManagedApplicationTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricManagedApplicationTypeApplicationTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedApplicationTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeVersionCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeVersionCollection.cs index 559667eafc1e..fe4dfa055cef 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeVersionCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeVersionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string version, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version} + /// + /// + /// Operation Id + /// ApplicationTypeVersions_Get + /// + /// + /// + /// The application type version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _serviceFabricManagedApplicationTypeVersionApplicationTypeVersionsClientDiagnostics.CreateScope("ServiceFabricManagedApplicationTypeVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricManagedApplicationTypeVersionApplicationTypeVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedApplicationTypeVersionResource(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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version} + /// + /// + /// Operation Id + /// ApplicationTypeVersions_Get + /// + /// + /// + /// The application type version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _serviceFabricManagedApplicationTypeVersionApplicationTypeVersionsClientDiagnostics.CreateScope("ServiceFabricManagedApplicationTypeVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricManagedApplicationTypeVersionApplicationTypeVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedApplicationTypeVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterCollection.cs index 161896e7bddb..8d2634fe1092 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName} + /// + /// + /// Operation Id + /// ManagedClusters_Get + /// + /// + /// + /// The name of the cluster 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 clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _serviceFabricManagedClusterManagedClustersClientDiagnostics.CreateScope("ServiceFabricManagedClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricManagedClusterManagedClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedClusterResource(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.ServiceFabric/managedClusters/{clusterName} + /// + /// + /// Operation Id + /// ManagedClusters_Get + /// + /// + /// + /// The name of the cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _serviceFabricManagedClusterManagedClustersClientDiagnostics.CreateScope("ServiceFabricManagedClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricManagedClusterManagedClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedNodeTypeCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedNodeTypeCollection.cs index b5642e6f39b2..bc55001ff9a1 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedNodeTypeCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedNodeTypeCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string nodeTypeName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName} + /// + /// + /// Operation Id + /// NodeTypes_Get + /// + /// + /// + /// The name of the node type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string nodeTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nodeTypeName, nameof(nodeTypeName)); + + using var scope = _serviceFabricManagedNodeTypeNodeTypesClientDiagnostics.CreateScope("ServiceFabricManagedNodeTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricManagedNodeTypeNodeTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nodeTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedNodeTypeResource(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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName} + /// + /// + /// Operation Id + /// NodeTypes_Get + /// + /// + /// + /// The name of the node type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string nodeTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nodeTypeName, nameof(nodeTypeName)); + + using var scope = _serviceFabricManagedNodeTypeNodeTypesClientDiagnostics.CreateScope("ServiceFabricManagedNodeTypeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricManagedNodeTypeNodeTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nodeTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedNodeTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedServiceCollection.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedServiceCollection.cs index 5ec937a18441..b6fd3446420b 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedServiceCollection.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedServiceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service resource in the format of {applicationName}~{serviceName}. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _serviceFabricManagedServiceServicesClientDiagnostics.CreateScope("ServiceFabricManagedServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceFabricManagedServiceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedServiceResource(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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service resource in the format of {applicationName}~{serviceName}. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _serviceFabricManagedServiceServicesClientDiagnostics.CreateScope("ServiceFabricManagedServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceFabricManagedServiceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceFabricManagedServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResourceCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResourceCollection.cs index 55a6262db451..18f88b4a938b 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResourceCollection.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResourceCollection.cs @@ -112,6 +112,46 @@ public async Task Exists_Link() Console.WriteLine($"Succeeded: {result}"); } + // Link + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_Link() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/Link.json + // this example is just showing the usage of "Linker_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this LinkerResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + LinkerResourceCollection collection = client.GetLinkerResources(scopeId); + + // invoke the operation + string linkerName = "linkName"; + NullableResponse response = await collection.GetIfExistsAsync(linkerName); + LinkerResource 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 + LinkerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutLink [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs index edb75f7837b0..65a6ef7cf3da 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string linkerName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} + /// + /// + /// Operation Id + /// Linker_Get + /// + /// + /// + /// The name Linker 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 linkerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); + + using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _linkerResourceLinkerRestClient.GetAsync(Id, linkerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} + /// + /// + /// Operation Id + /// Linker_Get + /// + /// + /// + /// The name Linker resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); + + using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _linkerResourceLinkerRestClient.Get(Id, linkerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationCollection.cs index cdb33f0adeab..85868b9972f8 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAssociation() Console.WriteLine($"Succeeded: {result}"); } + // Get Association + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAssociation() + { + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationGet.json + // this example is just showing the usage of "AssociationsInterface_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 TrafficControllerResource created on azure + // for more information of creating TrafficControllerResource, please refer to the document of TrafficControllerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string trafficControllerName = "tc1"; + ResourceIdentifier trafficControllerResourceId = TrafficControllerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, trafficControllerName); + TrafficControllerResource trafficController = client.GetTrafficControllerResource(trafficControllerResourceId); + + // get the collection of this AssociationResource + AssociationCollection collection = trafficController.GetAssociations(); + + // invoke the operation + string associationName = "as1"; + NullableResponse response = await collection.GetIfExistsAsync(associationName); + AssociationResource 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 + AssociationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put Association [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendCollection.cs index e01c745f222c..3fc1969baf86 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetFrontend() Console.WriteLine($"Succeeded: {result}"); } + // Get Frontend + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFrontend() + { + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendGet.json + // this example is just showing the usage of "FrontendsInterface_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 TrafficControllerResource created on azure + // for more information of creating TrafficControllerResource, please refer to the document of TrafficControllerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string trafficControllerName = "tc1"; + ResourceIdentifier trafficControllerResourceId = TrafficControllerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, trafficControllerName); + TrafficControllerResource trafficController = client.GetTrafficControllerResource(trafficControllerResourceId); + + // get the collection of this FrontendResource + FrontendCollection collection = trafficController.GetFrontends(); + + // invoke the operation + string frontendName = "fe1"; + NullableResponse response = await collection.GetIfExistsAsync(frontendName); + FrontendResource 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 + FrontendData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put Frontend [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs index 9a9b38609a34..d0878d03f999 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetTrafficController() Console.WriteLine($"Succeeded: {result}"); } + // Get Traffic Controller + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTrafficController() + { + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerGet.json + // this example is just showing the usage of "TrafficControllerInterface_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 = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this TrafficControllerResource + TrafficControllerCollection collection = resourceGroupResource.GetTrafficControllers(); + + // invoke the operation + string trafficControllerName = "tc1"; + NullableResponse response = await collection.GetIfExistsAsync(trafficControllerName); + TrafficControllerResource 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 + TrafficControllerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Put Traffic Controller [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/AssociationCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/AssociationCollection.cs index 71c4f60c9a1b..94f22682d981 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/AssociationCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/AssociationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string associationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName} + /// + /// + /// Operation Id + /// AssociationsInterface_Get + /// + /// + /// + /// Name of Association. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string associationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(associationName, nameof(associationName)); + + using var scope = _associationAssociationsInterfaceClientDiagnostics.CreateScope("AssociationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _associationAssociationsInterfaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, associationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AssociationResource(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.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName} + /// + /// + /// Operation Id + /// AssociationsInterface_Get + /// + /// + /// + /// Name of Association. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string associationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(associationName, nameof(associationName)); + + using var scope = _associationAssociationsInterfaceClientDiagnostics.CreateScope("AssociationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _associationAssociationsInterfaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, associationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AssociationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/FrontendCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/FrontendCollection.cs index f8852ff79af8..c42d256147f9 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/FrontendCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/FrontendCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string frontendName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName} + /// + /// + /// Operation Id + /// FrontendsInterface_Get + /// + /// + /// + /// Frontends. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string frontendName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(frontendName, nameof(frontendName)); + + using var scope = _frontendFrontendsInterfaceClientDiagnostics.CreateScope("FrontendCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _frontendFrontendsInterfaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, frontendName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontendResource(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.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName} + /// + /// + /// Operation Id + /// FrontendsInterface_Get + /// + /// + /// + /// Frontends. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string frontendName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(frontendName, nameof(frontendName)); + + using var scope = _frontendFrontendsInterfaceClientDiagnostics.CreateScope("FrontendCollection.GetIfExists"); + scope.Start(); + try + { + var response = _frontendFrontendsInterfaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, frontendName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FrontendResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerCollection.cs index fd87357e7355..3524f7fe5453 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string trafficControllerName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName} + /// + /// + /// Operation Id + /// TrafficControllerInterface_Get + /// + /// + /// + /// traffic controller name for path. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string trafficControllerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trafficControllerName, nameof(trafficControllerName)); + + using var scope = _trafficControllerTrafficControllerInterfaceClientDiagnostics.CreateScope("TrafficControllerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _trafficControllerTrafficControllerInterfaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, trafficControllerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TrafficControllerResource(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.ServiceNetworking/trafficControllers/{trafficControllerName} + /// + /// + /// Operation Id + /// TrafficControllerInterface_Get + /// + /// + /// + /// traffic controller name for path. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string trafficControllerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trafficControllerName, nameof(trafficControllerName)); + + using var scope = _trafficControllerTrafficControllerInterfaceClientDiagnostics.CreateScope("TrafficControllerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _trafficControllerTrafficControllerInterfaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, trafficControllerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TrafficControllerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCollection.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCollection.cs index de4aa4011ad1..e85538acf979 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCollection.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName} + /// + /// + /// Operation Id + /// SignalR_Get + /// + /// + /// + /// The name of the 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _signalRClientDiagnostics.CreateScope("SignalRCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _signalRRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRResource(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.SignalRService/signalR/{resourceName} + /// + /// + /// Operation Id + /// SignalR_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _signalRClientDiagnostics.CreateScope("SignalRCollection.GetIfExists"); + scope.Start(); + try + { + var response = _signalRRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomCertificateCollection.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomCertificateCollection.cs index ed431f3f2bbd..a162c0f6f7f8 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomCertificateCollection.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customCertificates/{certificateName} + /// + /// + /// Operation Id + /// SignalRCustomCertificates_Get + /// + /// + /// + /// Custom certificate name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _signalRCustomCertificateClientDiagnostics.CreateScope("SignalRCustomCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _signalRCustomCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRCustomCertificateResource(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.SignalRService/signalR/{resourceName}/customCertificates/{certificateName} + /// + /// + /// Operation Id + /// SignalRCustomCertificates_Get + /// + /// + /// + /// Custom certificate name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _signalRCustomCertificateClientDiagnostics.CreateScope("SignalRCustomCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _signalRCustomCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRCustomCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomDomainCollection.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomDomainCollection.cs index 442c3249bc3e..03ffdce4031b 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomDomainCollection.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomDomainCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customDomains/{name} + /// + /// + /// Operation Id + /// SignalRCustomDomains_Get + /// + /// + /// + /// Custom domain name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _signalRCustomDomainClientDiagnostics.CreateScope("SignalRCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _signalRCustomDomainRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRCustomDomainResource(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.SignalRService/signalR/{resourceName}/customDomains/{name} + /// + /// + /// Operation Id + /// SignalRCustomDomains_Get + /// + /// + /// + /// Custom domain name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _signalRCustomDomainClientDiagnostics.CreateScope("SignalRCustomDomainCollection.GetIfExists"); + scope.Start(); + try + { + var response = _signalRCustomDomainRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRCustomDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRPrivateEndpointConnectionCollection.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRPrivateEndpointConnectionCollection.cs index 0745da9f6067..69d06b60681b 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRPrivateEndpointConnectionCollection.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// SignalRPrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _signalRPrivateEndpointConnectionClientDiagnostics.CreateScope("SignalRPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _signalRPrivateEndpointConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRPrivateEndpointConnectionResource(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.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// SignalRPrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _signalRPrivateEndpointConnectionClientDiagnostics.CreateScope("SignalRPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _signalRPrivateEndpointConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRSharedPrivateLinkResourceCollection.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRSharedPrivateLinkResourceCollection.cs index 3dddd3cba1ac..ffcd31feaacc 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRSharedPrivateLinkResourceCollection.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRSharedPrivateLinkResourceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string sharedPrivateLinkResourceName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SignalRSharedPrivateLinkResources_Get + /// + /// + /// + /// The name of the shared private link 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 sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _signalRSharedPrivateLinkResourceClientDiagnostics.CreateScope("SignalRSharedPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _signalRSharedPrivateLinkResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRSharedPrivateLinkResource(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.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SignalRSharedPrivateLinkResources_Get + /// + /// + /// + /// The name of the shared private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _signalRSharedPrivateLinkResourceClientDiagnostics.CreateScope("SignalRSharedPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _signalRSharedPrivateLinkResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SignalRSharedPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereCatalogCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereCatalogCollection.cs index f7aa433f8945..e38121efcc49 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereCatalogCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereCatalogCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_CatalogsGet() Console.WriteLine($"Succeeded: {result}"); } + // Catalogs_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CatalogsGet() + { + // Generated from example definition: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalog.json + // this example is just showing the usage of "Catalogs_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 = "MyResourceGroup1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SphereCatalogResource + SphereCatalogCollection collection = resourceGroupResource.GetSphereCatalogs(); + + // invoke the operation + string catalogName = "MyCatalog1"; + NullableResponse response = await collection.GetIfExistsAsync(catalogName); + SphereCatalogResource 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 + SphereCatalogData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Catalogs_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereCertificateCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereCertificateCollection.cs index 158349722b02..751e2ff31e8b 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereCertificateCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereCertificateCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_CertificatesGet() Console.WriteLine($"Succeeded: {result}"); } + + // Certificates_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CertificatesGet() + { + // Generated from example definition: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificate.json + // this example is just showing the usage of "Certificates_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 SphereCatalogResource created on azure + // for more information of creating SphereCatalogResource, please refer to the document of SphereCatalogResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "MyResourceGroup1"; + string catalogName = "MyCatalog1"; + ResourceIdentifier sphereCatalogResourceId = SphereCatalogResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, catalogName); + SphereCatalogResource sphereCatalog = client.GetSphereCatalogResource(sphereCatalogResourceId); + + // get the collection of this SphereCertificateResource + SphereCertificateCollection collection = sphereCatalog.GetSphereCertificates(); + + // invoke the operation + string serialNumber = "default"; + NullableResponse response = await collection.GetIfExistsAsync(serialNumber); + SphereCertificateResource 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 + SphereCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeploymentCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeploymentCollection.cs index 3102d1496eb7..2d37da2a61d2 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeploymentCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeploymentCollection.cs @@ -126,6 +126,51 @@ public async Task Exists_DeploymentsGet() Console.WriteLine($"Succeeded: {result}"); } + // Deployments_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DeploymentsGet() + { + // Generated from example definition: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployment.json + // this example is just showing the usage of "Deployments_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 SphereDeviceGroupResource created on azure + // for more information of creating SphereDeviceGroupResource, please refer to the document of SphereDeviceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "MyResourceGroup1"; + string catalogName = "MyCatalog1"; + string productName = "MyProduct1"; + string deviceGroupName = "myDeviceGroup1"; + ResourceIdentifier sphereDeviceGroupResourceId = SphereDeviceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, catalogName, productName, deviceGroupName); + SphereDeviceGroupResource sphereDeviceGroup = client.GetSphereDeviceGroupResource(sphereDeviceGroupResourceId); + + // get the collection of this SphereDeploymentResource + SphereDeploymentCollection collection = sphereDeviceGroup.GetSphereDeployments(); + + // invoke the operation + string deploymentName = "MyDeployment1"; + NullableResponse response = await collection.GetIfExistsAsync(deploymentName); + SphereDeploymentResource 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 + SphereDeploymentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Deployments_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeviceCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeviceCollection.cs index b83331d37197..c3cff6395481 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeviceCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeviceCollection.cs @@ -126,6 +126,51 @@ public async Task Exists_DevicesGet() Console.WriteLine($"Succeeded: {result}"); } + // Devices_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DevicesGet() + { + // Generated from example definition: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevice.json + // this example is just showing the usage of "Devices_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 SphereDeviceGroupResource created on azure + // for more information of creating SphereDeviceGroupResource, please refer to the document of SphereDeviceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "MyResourceGroup1"; + string catalogName = "MyCatalog1"; + string productName = "MyProduct1"; + string deviceGroupName = "myDeviceGroup1"; + ResourceIdentifier sphereDeviceGroupResourceId = SphereDeviceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, catalogName, productName, deviceGroupName); + SphereDeviceGroupResource sphereDeviceGroup = client.GetSphereDeviceGroupResource(sphereDeviceGroupResourceId); + + // get the collection of this SphereDeviceResource + SphereDeviceCollection collection = sphereDeviceGroup.GetSphereDevices(); + + // invoke the operation + string deviceName = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + NullableResponse response = await collection.GetIfExistsAsync(deviceName); + SphereDeviceResource 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 + SphereDeviceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Devices_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeviceGroupCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeviceGroupCollection.cs index 54bf0c6f835a..8a1be206b61b 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeviceGroupCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereDeviceGroupCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_DeviceGroupsGet() Console.WriteLine($"Succeeded: {result}"); } + // DeviceGroups_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DeviceGroupsGet() + { + // Generated from example definition: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroup.json + // this example is just showing the usage of "DeviceGroups_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 SphereProductResource created on azure + // for more information of creating SphereProductResource, please refer to the document of SphereProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "MyResourceGroup1"; + string catalogName = "MyCatalog1"; + string productName = "MyProduct1"; + ResourceIdentifier sphereProductResourceId = SphereProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, catalogName, productName); + SphereProductResource sphereProduct = client.GetSphereProductResource(sphereProductResourceId); + + // get the collection of this SphereDeviceGroupResource + SphereDeviceGroupCollection collection = sphereProduct.GetSphereDeviceGroups(); + + // invoke the operation + string deviceGroupName = "MyDeviceGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(deviceGroupName); + SphereDeviceGroupResource 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 + SphereDeviceGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DeviceGroups_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereImageCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereImageCollection.cs index a26e3df30916..d09cbe4b7feb 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereImageCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereImageCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ImagesGet() Console.WriteLine($"Succeeded: {result}"); } + // Images_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ImagesGet() + { + // Generated from example definition: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImage.json + // this example is just showing the usage of "Images_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 SphereCatalogResource created on azure + // for more information of creating SphereCatalogResource, please refer to the document of SphereCatalogResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "MyResourceGroup1"; + string catalogName = "MyCatalog1"; + ResourceIdentifier sphereCatalogResourceId = SphereCatalogResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, catalogName); + SphereCatalogResource sphereCatalog = client.GetSphereCatalogResource(sphereCatalogResourceId); + + // get the collection of this SphereImageResource + SphereImageCollection collection = sphereCatalog.GetSphereImages(); + + // invoke the operation + string imageName = "myImageId"; + NullableResponse response = await collection.GetIfExistsAsync(imageName); + SphereImageResource 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 + SphereImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Image_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereProductCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereProductCollection.cs index afcf4772f9f5..ef7557b4f7ee 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereProductCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/samples/Generated/Samples/Sample_SphereProductCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ProductsGet() Console.WriteLine($"Succeeded: {result}"); } + // Products_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProductsGet() + { + // Generated from example definition: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProduct.json + // this example is just showing the usage of "Products_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 SphereCatalogResource created on azure + // for more information of creating SphereCatalogResource, please refer to the document of SphereCatalogResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "MyResourceGroup1"; + string catalogName = "MyCatalog1"; + ResourceIdentifier sphereCatalogResourceId = SphereCatalogResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, catalogName); + SphereCatalogResource sphereCatalog = client.GetSphereCatalogResource(sphereCatalogResourceId); + + // get the collection of this SphereProductResource + SphereProductCollection collection = sphereCatalog.GetSphereProducts(); + + // invoke the operation + string productName = "MyProduct1"; + NullableResponse response = await collection.GetIfExistsAsync(productName); + SphereProductResource 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 + SphereProductData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Products_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogCollection.cs index 19dcf0f8ffb2..445ca175574c 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string catalogName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName} + /// + /// + /// Operation Id + /// Catalogs_Get + /// + /// + /// + /// Name of catalog. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string catalogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + + using var scope = _sphereCatalogCatalogsClientDiagnostics.CreateScope("SphereCatalogCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sphereCatalogCatalogsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, catalogName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereCatalogResource(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.AzureSphere/catalogs/{catalogName} + /// + /// + /// Operation Id + /// Catalogs_Get + /// + /// + /// + /// Name of catalog. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string catalogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + + using var scope = _sphereCatalogCatalogsClientDiagnostics.CreateScope("SphereCatalogCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sphereCatalogCatalogsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, catalogName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereCatalogResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCertificateCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCertificateCollection.cs index 6fb3a064062d..e86fbd333c1b 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCertificateCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCertificateCollection.cs @@ -249,6 +249,80 @@ public virtual Response Exists(string serialNumber, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// Serial number of the certificate. Use '.default' to get current active certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serialNumber, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serialNumber, nameof(serialNumber)); + + using var scope = _sphereCertificateCertificatesClientDiagnostics.CreateScope("SphereCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sphereCertificateCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serialNumber, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereCertificateResource(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.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// Serial number of the certificate. Use '.default' to get current active certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serialNumber, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serialNumber, nameof(serialNumber)); + + using var scope = _sphereCertificateCertificatesClientDiagnostics.CreateScope("SphereCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sphereCertificateCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serialNumber, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeploymentCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeploymentCollection.cs index 212148c84214..ae1f3d788193 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeploymentCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeploymentCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string deploymentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _sphereDeploymentDeploymentsClientDiagnostics.CreateScope("SphereDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sphereDeploymentDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereDeploymentResource(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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _sphereDeploymentDeploymentsClientDiagnostics.CreateScope("SphereDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sphereDeploymentDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, deploymentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceCollection.cs index 65f747c41b8d..67a4bf3a52cb 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string deviceName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName} + /// + /// + /// Operation Id + /// Devices_Get + /// + /// + /// + /// Device name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deviceName, nameof(deviceName)); + + using var scope = _sphereDeviceDevicesClientDiagnostics.CreateScope("SphereDeviceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sphereDeviceDevicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, deviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereDeviceResource(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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName} + /// + /// + /// Operation Id + /// Devices_Get + /// + /// + /// + /// Device name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deviceName, nameof(deviceName)); + + using var scope = _sphereDeviceDevicesClientDiagnostics.CreateScope("SphereDeviceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sphereDeviceDevicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, deviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereDeviceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupCollection.cs index 8e0d0fe6e1a1..80580130ca0b 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string deviceGroupName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName} + /// + /// + /// Operation Id + /// DeviceGroups_Get + /// + /// + /// + /// Name of device group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deviceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deviceGroupName, nameof(deviceGroupName)); + + using var scope = _sphereDeviceGroupDeviceGroupsClientDiagnostics.CreateScope("SphereDeviceGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sphereDeviceGroupDeviceGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deviceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereDeviceGroupResource(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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName} + /// + /// + /// Operation Id + /// DeviceGroups_Get + /// + /// + /// + /// Name of device group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deviceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deviceGroupName, nameof(deviceGroupName)); + + using var scope = _sphereDeviceGroupDeviceGroupsClientDiagnostics.CreateScope("SphereDeviceGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sphereDeviceGroupDeviceGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deviceGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereDeviceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereImageCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereImageCollection.cs index c537bc7a7ca7..9200e868a7af 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereImageCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereImageCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string imageName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// Image name. Use .default for image creation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string imageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + using var scope = _sphereImageImagesClientDiagnostics.CreateScope("SphereImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sphereImageImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereImageResource(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.AzureSphere/catalogs/{catalogName}/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// Image name. Use .default for image creation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string imageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + using var scope = _sphereImageImagesClientDiagnostics.CreateScope("SphereImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sphereImageImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductCollection.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductCollection.cs index f8e6d166bf19..ae5c1830000d 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductCollection.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string productName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName} + /// + /// + /// Operation Id + /// Products_Get + /// + /// + /// + /// Name of product. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string productName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productName, nameof(productName)); + + using var scope = _sphereProductProductsClientDiagnostics.CreateScope("SphereProductCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sphereProductProductsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereProductResource(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.AzureSphere/catalogs/{catalogName}/products/{productName} + /// + /// + /// Operation Id + /// Products_Get + /// + /// + /// + /// Name of product. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string productName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productName, nameof(productName)); + + using var scope = _sphereProductProductsClientDiagnostics.CreateScope("SphereProductCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sphereProductProductsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SphereProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_BackupShortTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_BackupShortTermRetentionPolicyCollection.cs index c9033a2d2852..7eefaefce1be 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_BackupShortTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_BackupShortTermRetentionPolicyCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetTheShortTermRetentionPolicyForTheDatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get the short term retention policy for the database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheShortTermRetentionPolicyForTheDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetShortTermRetentionPolicy.json + // this example is just showing the usage of "BackupShortTermRetentionPolicies_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this BackupShortTermRetentionPolicyResource + BackupShortTermRetentionPolicyCollection collection = sqlDatabase.GetBackupShortTermRetentionPolicies(); + + // invoke the operation + ShortTermRetentionPolicyName policyName = ShortTermRetentionPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + BackupShortTermRetentionPolicyResource 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 + BackupShortTermRetentionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update the short term retention policy for the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DataWarehouseUserActivityCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DataWarehouseUserActivityCollection.cs index 673c4d11ff4f..c73b616b4cf4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DataWarehouseUserActivityCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DataWarehouseUserActivityCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -85,6 +86,50 @@ public async Task Exists_GetTheListOfTheUserActivitiesOfADataWarehouse() Console.WriteLine($"Succeeded: {result}"); } + // Get the list of the user activities of a data warehouse + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheListOfTheUserActivitiesOfADataWarehouse() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetDataWarehouseUserActivities.json + // this example is just showing the usage of "DataWarehouseUserActivities_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this DataWarehouseUserActivityResource + DataWarehouseUserActivityCollection collection = sqlDatabase.GetDataWarehouseUserActivities(); + + // invoke the operation + DataWarehouseUserActivityName dataWarehouseUserActivityName = DataWarehouseUserActivityName.Current; + NullableResponse response = await collection.GetIfExistsAsync(dataWarehouseUserActivityName); + DataWarehouseUserActivityResource 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 + DataWarehouseUserActivityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List of the user activities of a data warehouse [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DatabaseAdvancedThreatProtectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DatabaseAdvancedThreatProtectionCollection.cs index 7fd500ba6590..932ac4ec71cb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DatabaseAdvancedThreatProtectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DatabaseAdvancedThreatProtectionCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetADatabaseSAdvancedThreatProtectionSettings() Console.WriteLine($"Succeeded: {result}"); } + // Get a database's Advanced Threat Protection settings. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSAdvancedThreatProtectionSettings() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsGet.json + // this example is just showing the usage of "DatabaseAdvancedThreatProtectionSettings_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "threatprotection-6852"; + string serverName = "threatprotection-2080"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this DatabaseAdvancedThreatProtectionResource + DatabaseAdvancedThreatProtectionCollection collection = sqlDatabase.GetDatabaseAdvancedThreatProtections(); + + // invoke the operation + AdvancedThreatProtectionName advancedThreatProtectionName = AdvancedThreatProtectionName.Default; + NullableResponse response = await collection.GetIfExistsAsync(advancedThreatProtectionName); + DatabaseAdvancedThreatProtectionResource 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 + DatabaseAdvancedThreatProtectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a database's Advanced Threat Protection settings with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DeletedServerCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DeletedServerCollection.cs index 409e9853dfaf..f73e2d5b5820 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DeletedServerCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DeletedServerCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -81,6 +82,48 @@ public async Task Exists_GetDeletedServer() Console.WriteLine($"Succeeded: {result}"); } + // Get deleted server + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDeletedServer() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerGet.json + // this example is just showing the usage of "DeletedServers_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this DeletedServerResource + AzureLocation locationName = new AzureLocation("japaneast"); + DeletedServerCollection collection = subscriptionResource.GetDeletedServers(locationName); + + // invoke the operation + string deletedServerName = "sqlcrudtest-d-1414"; + NullableResponse response = await collection.GetIfExistsAsync(deletedServerName); + DeletedServerResource 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 + DeletedServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List deleted servers [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupCollection.cs index c948d0b796d8..034ed8e48015 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetsTheDistributedAvailabilityGroupInfo() Console.WriteLine($"Succeeded: {result}"); } + // Gets the distributed availability group info. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheDistributedAvailabilityGroupInfo() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + // this example is just showing the usage of "DistributedAvailabilityGroups_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "f2669dff-5f08-45dd-b857-b2a60b72cdc9"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testcl"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this DistributedAvailabilityGroupResource + DistributedAvailabilityGroupCollection collection = managedInstance.GetDistributedAvailabilityGroups(); + + // invoke the operation + string distributedAvailabilityGroupName = "dag"; + NullableResponse response = await collection.GetIfExistsAsync(distributedAvailabilityGroupName); + DistributedAvailabilityGroupResource 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 + DistributedAvailabilityGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a distributed availability group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ElasticPoolCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ElasticPoolCollection.cs index 6e7898df7ea3..503eae84e545 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ElasticPoolCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ElasticPoolCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAHyperscaleElasticPool() Console.WriteLine($"Succeeded: {result}"); } + // Get a Hyperscale elastic pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAHyperscaleElasticPool() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/HyperscaleElasticPoolGet.json + // this example is just showing the usage of "ElasticPools_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-2369"; + string serverName = "sqlcrudtest-8069"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this ElasticPoolResource + ElasticPoolCollection collection = sqlServer.GetElasticPools(); + + // invoke the operation + string elasticPoolName = "sqlcrudtest-8102"; + NullableResponse response = await collection.GetIfExistsAsync(elasticPoolName); + ElasticPoolResource 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 + ElasticPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an elastic pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_GetAnElasticPool() Console.WriteLine($"Succeeded: {result}"); } + // Get an elastic pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnElasticPool() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ElasticPoolGet.json + // this example is just showing the usage of "ElasticPools_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-2369"; + string serverName = "sqlcrudtest-8069"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this ElasticPoolResource + ElasticPoolCollection collection = sqlServer.GetElasticPools(); + + // invoke the operation + string elasticPoolName = "sqlcrudtest-8102"; + NullableResponse response = await collection.GetIfExistsAsync(elasticPoolName); + ElasticPoolResource 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 + ElasticPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an elastic pool with Availability Zone [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -253,6 +339,49 @@ public async Task Exists_GetAnElasticPoolWithAvailabilityZone() Console.WriteLine($"Succeeded: {result}"); } + // Get an elastic pool with Availability Zone + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnElasticPoolWithAvailabilityZone() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetElasticPoolWithAvailabilityZone.json + // this example is just showing the usage of "ElasticPools_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-2369"; + string serverName = "sqlcrudtest-8069"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this ElasticPoolResource + ElasticPoolCollection collection = sqlServer.GetElasticPools(); + + // invoke the operation + string elasticPoolName = "sqlcrudtest-8102"; + NullableResponse response = await collection.GetIfExistsAsync(elasticPoolName); + ElasticPoolResource 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 + ElasticPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an elastic pool with preferred enclave type parameter [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -319,6 +448,49 @@ public async Task Exists_GetAnElasticPoolWithPreferredEnclaveTypeParameter() Console.WriteLine($"Succeeded: {result}"); } + // Get an elastic pool with preferred enclave type parameter + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnElasticPoolWithPreferredEnclaveTypeParameter() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ElasticPoolGetWithPreferredEnclaveType.json + // this example is just showing the usage of "ElasticPools_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-2369"; + string serverName = "sqlcrudtest-8069"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this ElasticPoolResource + ElasticPoolCollection collection = sqlServer.GetElasticPools(); + + // invoke the operation + string elasticPoolName = "sqlcrudtest-8102"; + NullableResponse response = await collection.GetIfExistsAsync(elasticPoolName); + ElasticPoolResource 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 + ElasticPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update an elastic pool with Availability Zone [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_EncryptionProtectorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_EncryptionProtectorCollection.cs index 3eeabd3b2d28..902c6836d41a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_EncryptionProtectorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_EncryptionProtectorCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetTheEncryptionProtector() Console.WriteLine($"Succeeded: {result}"); } + // Get the encryption protector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheEncryptionProtector() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorGet.json + // this example is just showing the usage of "EncryptionProtectors_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + string serverName = "sqlcrudtest-4645"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this EncryptionProtectorResource + EncryptionProtectorCollection collection = sqlServer.GetEncryptionProtectors(); + + // invoke the operation + EncryptionProtectorName encryptionProtectorName = EncryptionProtectorName.Current; + NullableResponse response = await collection.GetIfExistsAsync(encryptionProtectorName); + EncryptionProtectorResource 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 + EncryptionProtectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update the encryption protector to key vault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_EndpointCertificateCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_EndpointCertificateCollection.cs index b61c2d3d0f96..b092d0ca14cd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_EndpointCertificateCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_EndpointCertificateCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsAnEndpointCertificate() Console.WriteLine($"Succeeded: {result}"); } + + // Gets an endpoint certificate. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAnEndpointCertificate() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesGet.json + // this example is just showing the usage of "EndpointCertificates_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "38e0dc56-907f-45ba-a97c-74233baad471"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testcl"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this EndpointCertificateResource + EndpointCertificateCollection collection = managedInstance.GetEndpointCertificates(); + + // invoke the operation + string endpointType = "DATABASE_MIRRORING"; + NullableResponse response = await collection.GetIfExistsAsync(endpointType); + EndpointCertificateResource 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 + EndpointCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ExtendedDatabaseBlobAuditingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ExtendedDatabaseBlobAuditingPolicyCollection.cs index 798c109ec5dd..b00011b25ad5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ExtendedDatabaseBlobAuditingPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ExtendedDatabaseBlobAuditingPolicyCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetAnExtendedDatabaseSBlobAuditingPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get an extended database's blob auditing policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnExtendedDatabaseSBlobAuditingPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingGet.json + // this example is just showing the usage of "ExtendedDatabaseBlobAuditingPolicies_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "blobauditingtest-6852"; + string serverName = "blobauditingtest-2080"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this ExtendedDatabaseBlobAuditingPolicyResource + ExtendedDatabaseBlobAuditingPolicyCollection collection = sqlDatabase.GetExtendedDatabaseBlobAuditingPolicies(); + + // invoke the operation + BlobAuditingPolicyName blobAuditingPolicyName = BlobAuditingPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(blobAuditingPolicyName); + ExtendedDatabaseBlobAuditingPolicyResource 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 + ExtendedDatabaseBlobAuditingPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update an extended database's azure monitor auditing policy with minimal parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ExtendedServerBlobAuditingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ExtendedServerBlobAuditingPolicyCollection.cs index a8ba8b5ac814..a4ee8cde4bd7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ExtendedServerBlobAuditingPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ExtendedServerBlobAuditingPolicyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAServerSBlobExtendedAuditingPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a server's blob extended auditing policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerSBlobExtendedAuditingPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingGet.json + // this example is just showing the usage of "ExtendedServerBlobAuditingPolicies_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "blobauditingtest-4799"; + string serverName = "blobauditingtest-6440"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this ExtendedServerBlobAuditingPolicyResource + ExtendedServerBlobAuditingPolicyCollection collection = sqlServer.GetExtendedServerBlobAuditingPolicies(); + + // invoke the operation + BlobAuditingPolicyName blobAuditingPolicyName = BlobAuditingPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(blobAuditingPolicyName); + ExtendedServerBlobAuditingPolicyResource 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 + ExtendedServerBlobAuditingPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a server's extended blob auditing policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupCollection.cs index a8ef293c6ffd..4a994791d4c3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_FailoverGroupCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetFailoverGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get failover group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFailoverGroup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/FailoverGroupGet.json + // this example is just showing the usage of "FailoverGroups_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "failover-group-primary-server"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this FailoverGroupResource + FailoverGroupCollection collection = sqlServer.GetFailoverGroups(); + + // invoke the operation + string failoverGroupName = "failover-group-test"; + NullableResponse response = await collection.GetIfExistsAsync(failoverGroupName); + FailoverGroupResource 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 + FailoverGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create failover group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_GeoBackupPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_GeoBackupPolicyCollection.cs index a56caec85ded..b369d03f0262 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_GeoBackupPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_GeoBackupPolicyCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetGeoBackupPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get geo backup policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetGeoBackupPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesGet.json + // this example is just showing the usage of "GeoBackupPolicies_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-4799"; + string serverName = "sqlcrudtest-5961"; + string databaseName = "testdw"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this GeoBackupPolicyResource + GeoBackupPolicyCollection collection = sqlDatabase.GetGeoBackupPolicies(); + + // invoke the operation + GeoBackupPolicyName geoBackupPolicyName = GeoBackupPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(geoBackupPolicyName); + GeoBackupPolicyResource 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 + GeoBackupPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List geo backup policies [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_IPv6FirewallRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_IPv6FirewallRuleCollection.cs index 584aea8889c5..3e4f0789afb8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_IPv6FirewallRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_IPv6FirewallRuleCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetIPv6FirewallRule() Console.WriteLine($"Succeeded: {result}"); } + // Get IPv6 Firewall Rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetIPv6FirewallRule() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/IPv6FirewallRuleGet.json + // this example is just showing the usage of "IPv6FirewallRules_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "firewallrulecrudtest-12"; + string serverName = "firewallrulecrudtest-6285"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this IPv6FirewallRuleResource + IPv6FirewallRuleCollection collection = sqlServer.GetIPv6FirewallRules(); + + // invoke the operation + string firewallRuleName = "firewallrulecrudtest-2304"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + IPv6FirewallRuleResource 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 + IPv6FirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create an IPv6 firewall rule max/min [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstanceFailoverGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstanceFailoverGroupCollection.cs index 973956a9fe5f..ace78a1d0b39 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstanceFailoverGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstanceFailoverGroupCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GetFailoverGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get failover group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFailoverGroup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/InstanceFailoverGroupGet.json + // this example is just showing the usage of "InstanceFailoverGroups_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-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceFailoverGroupResource + AzureLocation locationName = new AzureLocation("Japan East"); + InstanceFailoverGroupCollection collection = resourceGroupResource.GetInstanceFailoverGroups(locationName); + + // invoke the operation + string failoverGroupName = "failover-group-test"; + NullableResponse response = await collection.GetIfExistsAsync(failoverGroupName); + InstanceFailoverGroupResource 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 + InstanceFailoverGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create failover group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs index 27fdaaea78b3..26fcc9d57f26 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetAnInstancePool() Console.WriteLine($"Succeeded: {result}"); } + // Get an instance pool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnInstancePool() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + // this example is just showing the usage of "InstancePools_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-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstancePoolResource + InstancePoolCollection collection = resourceGroupResource.GetInstancePools(); + + // invoke the operation + string instancePoolName = "testIP"; + NullableResponse response = await collection.GetIfExistsAsync(instancePoolName); + InstancePoolResource 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 + InstancePoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create an instance pool with all properties. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LedgerDigestUploadCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LedgerDigestUploadCollection.cs index be5fe3a235f2..46e36a82e0dc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LedgerDigestUploadCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LedgerDigestUploadCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetsTheCurrentLedgerDigestUploadConfigurationForADataba Console.WriteLine($"Succeeded: {result}"); } + // Gets the current ledger digest upload configuration for a database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheCurrentLedgerDigestUploadConfigurationForADatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsGet.json + // this example is just showing the usage of "LedgerDigestUploads_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "ledgertestrg"; + string serverName = "ledgertestserver"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this LedgerDigestUploadResource + LedgerDigestUploadCollection collection = sqlDatabase.GetLedgerDigestUploads(); + + // invoke the operation + LedgerDigestUploadsName ledgerDigestUploads = LedgerDigestUploadsName.Current; + NullableResponse response = await collection.GetIfExistsAsync(ledgerDigestUploads); + LedgerDigestUploadResource 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 + LedgerDigestUploadData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Enables ledger digest upload configuration for a database [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LogicalDatabaseTransparentDataEncryptionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LogicalDatabaseTransparentDataEncryptionCollection.cs index e92c6181898d..a2bdc8587ad2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LogicalDatabaseTransparentDataEncryptionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LogicalDatabaseTransparentDataEncryptionCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetADatabaseSTransparentDataEncryption() Console.WriteLine($"Succeeded: {result}"); } + // Get a database's transparent data encryption + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSTransparentDataEncryption() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/TransparentDataEncryptionGet.json + // this example is just showing the usage of "TransparentDataEncryptions_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "security-tde-resourcegroup"; + string serverName = "securitytde"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this LogicalDatabaseTransparentDataEncryptionResource + LogicalDatabaseTransparentDataEncryptionCollection collection = sqlDatabase.GetLogicalDatabaseTransparentDataEncryptions(); + + // invoke the operation + TransparentDataEncryptionName tdeName = TransparentDataEncryptionName.Current; + NullableResponse response = await collection.GetIfExistsAsync(tdeName); + LogicalDatabaseTransparentDataEncryptionResource 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 + LogicalDatabaseTransparentDataEncryptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a database's Transparent Data Encryption state with minimal parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyCollection.cs index b07ab6309101..81231e40dc95 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_LongTermRetentionPolicyCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetTheLongTermRetentionPolicyForTheDatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get the long term retention policy for the database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheLongTermRetentionPolicyForTheDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + // this example is just showing the usage of "LongTermRetentionPolicies_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "resourceGroup"; + string serverName = "testserver"; + string databaseName = "testDatabase"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this LongTermRetentionPolicyResource + LongTermRetentionPolicyCollection collection = sqlDatabase.GetLongTermRetentionPolicies(); + + // invoke the operation + LongTermRetentionPolicyName policyName = LongTermRetentionPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + LongTermRetentionPolicyResource 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 + LongTermRetentionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update the long term retention policy for the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedBackupShortTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedBackupShortTermRetentionPolicyCollection.cs index 89c4bf35f032..9e1a4b97989d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedBackupShortTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedBackupShortTermRetentionPolicyCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetTheShortTermRetentionPolicyForTheDatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get the short term retention policy for the database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheShortTermRetentionPolicyForTheDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicy.json + // this example is just showing the usage of "ManagedBackupShortTermRetentionPolicies_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string managedInstanceName = "testsvr"; + string databaseName = "testdb"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedBackupShortTermRetentionPolicyResource + ManagedBackupShortTermRetentionPolicyCollection collection = managedDatabase.GetManagedBackupShortTermRetentionPolicies(); + + // invoke the operation + ManagedShortTermRetentionPolicyName policyName = ManagedShortTermRetentionPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + ManagedBackupShortTermRetentionPolicyResource 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 + ManagedBackupShortTermRetentionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update the short term retention policy for the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseAdvancedThreatProtectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseAdvancedThreatProtectionCollection.cs index 9d34989a5b7f..7b675d24338d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseAdvancedThreatProtectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseAdvancedThreatProtectionCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetAManagedDatabaseSAdvancedThreatProtectionSettings() Console.WriteLine($"Succeeded: {result}"); } + // Get a managed database's Advanced Threat Protection settings. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAManagedDatabaseSAdvancedThreatProtectionSettings() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsGet.json + // this example is just showing the usage of "ManagedDatabaseAdvancedThreatProtectionSettings_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "threatprotection-6852"; + string managedInstanceName = "threatprotection-2080"; + string databaseName = "testdb"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedDatabaseAdvancedThreatProtectionResource + ManagedDatabaseAdvancedThreatProtectionCollection collection = managedDatabase.GetManagedDatabaseAdvancedThreatProtections(); + + // invoke the operation + AdvancedThreatProtectionName advancedThreatProtectionName = AdvancedThreatProtectionName.Default; + NullableResponse response = await collection.GetIfExistsAsync(advancedThreatProtectionName); + ManagedDatabaseAdvancedThreatProtectionResource 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 + ManagedDatabaseAdvancedThreatProtectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a managed database's Advanced Threat Protection settings with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseCollection.cs index ecb55bf23dec..f1981e67f1c0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsAManagedDatabase() Console.WriteLine($"Succeeded: {result}"); } + // Gets a managed database + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAManagedDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedDatabaseGet.json + // this example is just showing the usage of "ManagedDatabases_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Test1"; + string managedInstanceName = "managedInstance"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedDatabaseResource + ManagedDatabaseCollection collection = managedInstance.GetManagedDatabases(); + + // invoke the operation + string databaseName = "managedDatabase"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + ManagedDatabaseResource 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 + ManagedDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates a new managed database by restoring from an external backup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseColumnCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseColumnCollection.cs index bb769f173768..e6ccedb9bcc0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseColumnCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseColumnCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -127,5 +128,51 @@ public async Task Exists_GetManagedDatabaseColumn() Console.WriteLine($"Succeeded: {result}"); } + + // Get managed database column + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedDatabaseColumn() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnGet.json + // this example is just showing the usage of "ManagedDatabaseColumns_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 ManagedDatabaseTableResource created on azure + // for more information of creating ManagedDatabaseTableResource, please refer to the document of ManagedDatabaseTableResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string managedInstanceName = "myManagedInstanceName"; + string databaseName = "myDatabase"; + string schemaName = "dbo"; + string tableName = "table1"; + ResourceIdentifier managedDatabaseTableResourceId = ManagedDatabaseTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName); + ManagedDatabaseTableResource managedDatabaseTable = client.GetManagedDatabaseTableResource(managedDatabaseTableResourceId); + + // get the collection of this ManagedDatabaseColumnResource + ManagedDatabaseColumnCollection collection = managedDatabaseTable.GetManagedDatabaseColumns(); + + // invoke the operation + string columnName = "column1"; + NullableResponse response = await collection.GetIfExistsAsync(columnName); + ManagedDatabaseColumnResource 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 + DatabaseColumnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseRestoreDetailCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseRestoreDetailCollection.cs index ead84cc0a9c4..2653a458fae1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseRestoreDetailCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseRestoreDetailCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,5 +85,49 @@ public async Task Exists_ManagedDatabaseRestoreDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Managed database restore details. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagedDatabaseRestoreDetails() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseRestoreDetails.json + // this example is just showing the usage of "ManagedDatabaseRestoreDetails_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string managedInstanceName = "managedInstance"; + string databaseName = "testdb"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedDatabaseRestoreDetailResource + ManagedDatabaseRestoreDetailCollection collection = managedDatabase.GetManagedDatabaseRestoreDetails(); + + // invoke the operation + RestoreDetailsName restoreDetailsName = RestoreDetailsName.Default; + NullableResponse response = await collection.GetIfExistsAsync(restoreDetailsName); + ManagedDatabaseRestoreDetailResource 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 + ManagedDatabaseRestoreDetailData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSchemaCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSchemaCollection.cs index 454e2cfc8cc8..d20b1a864830 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSchemaCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSchemaCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetManagedDatabaseSchema() Console.WriteLine($"Succeeded: {result}"); } + + // Get managed database schema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedDatabaseSchema() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaGet.json + // this example is just showing the usage of "ManagedDatabaseSchemas_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string managedInstanceName = "myManagedInstanceName"; + string databaseName = "myDatabase"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedDatabaseSchemaResource + ManagedDatabaseSchemaCollection collection = managedDatabase.GetManagedDatabaseSchemas(); + + // invoke the operation + string schemaName = "dbo"; + NullableResponse response = await collection.GetIfExistsAsync(schemaName); + ManagedDatabaseSchemaResource 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 + DatabaseSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSecurityAlertPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSecurityAlertPolicyCollection.cs index bbf1f3a38050..c9f814aa02c0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSecurityAlertPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSecurityAlertPolicyCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetADatabaseSThreatDetectionPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a database's threat detection policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSThreatDetectionPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertGet.json + // this example is just showing the usage of "ManagedDatabaseSecurityAlertPolicies_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "securityalert-6852"; + string managedInstanceName = "securityalert-2080"; + string databaseName = "testdb"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedDatabaseSecurityAlertPolicyResource + ManagedDatabaseSecurityAlertPolicyCollection collection = managedDatabase.GetManagedDatabaseSecurityAlertPolicies(); + + // invoke the operation + SqlSecurityAlertPolicyName securityAlertPolicyName = SqlSecurityAlertPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(securityAlertPolicyName); + ManagedDatabaseSecurityAlertPolicyResource 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 + ManagedDatabaseSecurityAlertPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a database's threat detection policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSensitivityLabelCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSensitivityLabelCollection.cs index 615b450253ad..dd67748ae043 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSensitivityLabelCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseSensitivityLabelCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -90,5 +91,52 @@ public async Task Exists_GetsTheSensitivityLabelOfAGivenColumnInAManagedDatabase Console.WriteLine($"Succeeded: {result}"); } + + // Gets the sensitivity label of a given column in a managed database + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheSensitivityLabelOfAGivenColumnInAManagedDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelGet.json + // this example is just showing the usage of "ManagedDatabaseSensitivityLabels_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 ManagedDatabaseColumnResource created on azure + // for more information of creating ManagedDatabaseColumnResource, please refer to the document of ManagedDatabaseColumnResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string managedInstanceName = "myManagedInstanceName"; + string databaseName = "myDatabase"; + string schemaName = "dbo"; + string tableName = "myTable"; + string columnName = "myColumn"; + ResourceIdentifier managedDatabaseColumnResourceId = ManagedDatabaseColumnResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + ManagedDatabaseColumnResource managedDatabaseColumn = client.GetManagedDatabaseColumnResource(managedDatabaseColumnResourceId); + + // get the collection of this ManagedDatabaseSensitivityLabelResource + ManagedDatabaseSensitivityLabelCollection collection = managedDatabaseColumn.GetManagedDatabaseSensitivityLabels(); + + // invoke the operation + SensitivityLabelSource sensitivityLabelSource = SensitivityLabelSource.Current; + NullableResponse response = await collection.GetIfExistsAsync(sensitivityLabelSource); + ManagedDatabaseSensitivityLabelResource 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 + SensitivityLabelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseTableCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseTableCollection.cs index 5e067223973f..7182806286ff 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseTableCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseTableCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetManagedDatabaseTable() Console.WriteLine($"Succeeded: {result}"); } + + // Get managed database table + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedDatabaseTable() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableGet.json + // this example is just showing the usage of "ManagedDatabaseTables_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 ManagedDatabaseSchemaResource created on azure + // for more information of creating ManagedDatabaseSchemaResource, please refer to the document of ManagedDatabaseSchemaResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string managedInstanceName = "myManagedInstanceName"; + string databaseName = "myDatabase"; + string schemaName = "dbo"; + ResourceIdentifier managedDatabaseSchemaResourceId = ManagedDatabaseSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName, schemaName); + ManagedDatabaseSchemaResource managedDatabaseSchema = client.GetManagedDatabaseSchemaResource(managedDatabaseSchemaResourceId); + + // get the collection of this ManagedDatabaseTableResource + ManagedDatabaseTableCollection collection = managedDatabaseSchema.GetManagedDatabaseTables(); + + // invoke the operation + string tableName = "table1"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + ManagedDatabaseTableResource 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 + DatabaseTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentCollection.cs index 646a64a7721c..315602d50007 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetADatabaseSVulnerabilityAssessment() Console.WriteLine($"Succeeded: {result}"); } + // Get a database's vulnerability assessment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSVulnerabilityAssessment() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentGet.json + // this example is just showing the usage of "ManagedDatabaseVulnerabilityAssessments_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4799"; + string managedInstanceName = "vulnerabilityaseessmenttest-6440"; + string databaseName = "testdb"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedDatabaseVulnerabilityAssessmentResource + ManagedDatabaseVulnerabilityAssessmentCollection collection = managedDatabase.GetManagedDatabaseVulnerabilityAssessments(); + + // invoke the operation + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + NullableResponse response = await collection.GetIfExistsAsync(vulnerabilityAssessmentName); + ManagedDatabaseVulnerabilityAssessmentResource 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 + DatabaseVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a database's vulnerability assessment with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs index a638738d7410..a35b256467b9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs @@ -90,6 +90,52 @@ public async Task Exists_GetsADatabaseSVulnerabilityAssessmentRuleBaseline() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database's vulnerability assessment rule baseline. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseSVulnerabilityAssessmentRuleBaseline() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineGet.json + // this example is just showing the usage of "ManagedDatabaseVulnerabilityAssessmentRuleBaselines_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 ManagedDatabaseVulnerabilityAssessmentResource created on azure + // for more information of creating ManagedDatabaseVulnerabilityAssessmentResource, please refer to the document of ManagedDatabaseVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4711"; + string managedInstanceName = "vulnerabilityaseessmenttest-6411"; + string databaseName = "testdb"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + ResourceIdentifier managedDatabaseVulnerabilityAssessmentResourceId = ManagedDatabaseVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + ManagedDatabaseVulnerabilityAssessmentResource managedDatabaseVulnerabilityAssessment = client.GetManagedDatabaseVulnerabilityAssessmentResource(managedDatabaseVulnerabilityAssessmentResourceId); + + // get the collection of this ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource + ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection collection = managedDatabaseVulnerabilityAssessment.GetManagedDatabaseVulnerabilityAssessmentRuleBaselines(); + + // invoke the operation + string ruleId = "VA1001"; + VulnerabilityAssessmentPolicyBaselineName baselineName = VulnerabilityAssessmentPolicyBaselineName.Master; + NullableResponse response = await collection.GetIfExistsAsync(ruleId, baselineName); + ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource 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 + DatabaseVulnerabilityAssessmentRuleBaselineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a database's vulnerability assessment rule baseline. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentScanCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentScanCollection.cs index 5e8994e33491..84c7b9b2f9a5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentScanCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedDatabaseVulnerabilityAssessmentScanCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -125,5 +126,50 @@ public async Task Exists_GetsADatabaseVulnerabilityAssessmentScanRecordByScanID( Console.WriteLine($"Succeeded: {result}"); } + + // Gets a database vulnerability assessment scan record by scan ID + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseVulnerabilityAssessmentScanRecordByScanID() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsGet.json + // this example is just showing the usage of "ManagedDatabaseVulnerabilityAssessmentScans_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 ManagedDatabaseVulnerabilityAssessmentResource created on azure + // for more information of creating ManagedDatabaseVulnerabilityAssessmentResource, please refer to the document of ManagedDatabaseVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityassessmenttest-4711"; + string managedInstanceName = "vulnerabilityassessmenttest-6411"; + string databaseName = "testdb"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + ResourceIdentifier managedDatabaseVulnerabilityAssessmentResourceId = ManagedDatabaseVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + ManagedDatabaseVulnerabilityAssessmentResource managedDatabaseVulnerabilityAssessment = client.GetManagedDatabaseVulnerabilityAssessmentResource(managedDatabaseVulnerabilityAssessmentResourceId); + + // get the collection of this ManagedDatabaseVulnerabilityAssessmentScanResource + ManagedDatabaseVulnerabilityAssessmentScanCollection collection = managedDatabaseVulnerabilityAssessment.GetManagedDatabaseVulnerabilityAssessmentScans(); + + // invoke the operation + string scanId = "scan001"; + NullableResponse response = await collection.GetIfExistsAsync(scanId); + ManagedDatabaseVulnerabilityAssessmentScanResource 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 + VulnerabilityAssessmentScanRecordData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAdministratorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAdministratorCollection.cs index bbed8c9ea082..42b8ceda38d3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAdministratorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAdministratorCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAdministratorOfManagedInstance() Console.WriteLine($"Succeeded: {result}"); } + // Get administrator of managed instance + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAdministratorOfManagedInstance() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorGet.json + // this example is just showing the usage of "ManagedInstanceAdministrators_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string managedInstanceName = "managedInstance"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceAdministratorResource + ManagedInstanceAdministratorCollection collection = managedInstance.GetManagedInstanceAdministrators(); + + // invoke the operation + SqlAdministratorName administratorName = SqlAdministratorName.ActiveDirectory; + NullableResponse response = await collection.GetIfExistsAsync(administratorName); + ManagedInstanceAdministratorResource 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 + ManagedInstanceAdministratorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create administrator of managed instance [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAdvancedThreatProtectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAdvancedThreatProtectionCollection.cs index 1995dceb051e..8c5f94431418 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAdvancedThreatProtectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAdvancedThreatProtectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAManagedInstanceSAdvancedThreatProtectionSettings() Console.WriteLine($"Succeeded: {result}"); } + // Get a managed instance's Advanced Threat Protection settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAManagedInstanceSAdvancedThreatProtectionSettings() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsGet.json + // this example is just showing the usage of "ManagedInstanceAdvancedThreatProtectionSettings_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "threatprotection-4799"; + string managedInstanceName = "threatprotection-6440"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceAdvancedThreatProtectionResource + ManagedInstanceAdvancedThreatProtectionCollection collection = managedInstance.GetManagedInstanceAdvancedThreatProtections(); + + // invoke the operation + AdvancedThreatProtectionName advancedThreatProtectionName = AdvancedThreatProtectionName.Default; + NullableResponse response = await collection.GetIfExistsAsync(advancedThreatProtectionName); + ManagedInstanceAdvancedThreatProtectionResource 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 + ManagedInstanceAdvancedThreatProtectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a managed instance's Advanced Threat Protection settings with all parameters. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAzureADOnlyAuthenticationCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAzureADOnlyAuthenticationCollection.cs index a62afed855ab..68b04c40fcef 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAzureADOnlyAuthenticationCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceAzureADOnlyAuthenticationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsAAzureActiveDirectoryOnlyAuthenticationProperty() Console.WriteLine($"Succeeded: {result}"); } + // Gets a Azure Active Directory only authentication property. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAAzureActiveDirectoryOnlyAuthenticationProperty() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthGet.json + // this example is just showing the usage of "ManagedInstanceAzureADOnlyAuthentications_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string managedInstanceName = "managedInstance"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceAzureADOnlyAuthenticationResource + ManagedInstanceAzureADOnlyAuthenticationCollection collection = managedInstance.GetManagedInstanceAzureADOnlyAuthentications(); + + // invoke the operation + AuthenticationName authenticationName = AuthenticationName.Default; + NullableResponse response = await collection.GetIfExistsAsync(authenticationName); + ManagedInstanceAzureADOnlyAuthenticationResource 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 + ManagedInstanceAzureADOnlyAuthenticationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates Azure Active Directory only authentication object. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceCollection.cs index f755d2ec5b0b..21f2a0b69695 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceCollection.cs @@ -155,6 +155,48 @@ public async Task Exists_GetManagedInstance() Console.WriteLine($"Succeeded: {result}"); } + // Get managed instance + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedInstance() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGet.json + // this example is just showing the usage of "ManagedInstances_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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedInstanceResource + ManagedInstanceCollection collection = resourceGroupResource.GetManagedInstances(); + + // invoke the operation + string managedInstanceName = "testinstance"; + NullableResponse response = await collection.GetIfExistsAsync(managedInstanceName); + ManagedInstanceResource 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 + ManagedInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get managed instance with $expand=administrators/activedirectory [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -219,6 +261,48 @@ public async Task Exists_GetManagedInstanceWithExpandAdministratorsActivedirecto Console.WriteLine($"Succeeded: {result}"); } + // Get managed instance with $expand=administrators/activedirectory + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedInstanceWithExpandAdministratorsActivedirectory() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + // this example is just showing the usage of "ManagedInstances_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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedInstanceResource + ManagedInstanceCollection collection = resourceGroupResource.GetManagedInstances(); + + // invoke the operation + string managedInstanceName = "testinstance"; + NullableResponse response = await collection.GetIfExistsAsync(managedInstanceName); + ManagedInstanceResource 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 + ManagedInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create managed instance with all properties [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceDtcCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceDtcCollection.cs index 746ef33a0a76..af5ebe7db4c7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceDtcCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceDtcCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsManagedInstanceDTCSettings() Console.WriteLine($"Succeeded: {result}"); } + // Gets managed instance DTC settings. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsManagedInstanceDTCSettings() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcGet.json + // this example is just showing the usage of "ManagedInstanceDtcs_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testinstance"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceDtcResource + ManagedInstanceDtcCollection collection = managedInstance.GetManagedInstanceDtcs(); + + // invoke the operation + DtcName dtcName = DtcName.Current; + NullableResponse response = await collection.GetIfExistsAsync(dtcName); + ManagedInstanceDtcResource 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 + ManagedInstanceDtcData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Updates managed instance DTC settings by enabling DTC. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceEncryptionProtectorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceEncryptionProtectorCollection.cs index f8a201d0f7ea..967576326c7d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceEncryptionProtectorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceEncryptionProtectorCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetTheEncryptionProtector() Console.WriteLine($"Succeeded: {result}"); } + // Get the encryption protector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheEncryptionProtector() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorGet.json + // this example is just showing the usage of "ManagedInstanceEncryptionProtectors_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + string managedInstanceName = "sqlcrudtest-4645"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceEncryptionProtectorResource + ManagedInstanceEncryptionProtectorCollection collection = managedInstance.GetManagedInstanceEncryptionProtectors(); + + // invoke the operation + EncryptionProtectorName encryptionProtectorName = EncryptionProtectorName.Current; + NullableResponse response = await collection.GetIfExistsAsync(encryptionProtectorName); + ManagedInstanceEncryptionProtectorResource 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 + ManagedInstanceEncryptionProtectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update the encryption protector to key vault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceKeyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceKeyCollection.cs index 3a2e08b85834..6c99fc1d8808 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceKeyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceKeyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetTheManagedInstanceKey() Console.WriteLine($"Succeeded: {result}"); } + // Get the managed instance key + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheManagedInstanceKey() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyGet.json + // this example is just showing the usage of "ManagedInstanceKeys_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + string managedInstanceName = "sqlcrudtest-4645"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceKeyResource + ManagedInstanceKeyCollection collection = managedInstance.GetManagedInstanceKeys(); + + // invoke the operation + string keyName = "someVault_someKey_01234567890123456789012345678901"; + NullableResponse response = await collection.GetIfExistsAsync(keyName); + ManagedInstanceKeyResource 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 + ManagedInstanceKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a managed instance key [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceLongTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceLongTermRetentionPolicyCollection.cs index c2b544cebcf1..907de9ce7dbd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceLongTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceLongTermRetentionPolicyCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetTheLongTermRetentionPolicyForTheManagedDatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get the long term retention policy for the managed database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheLongTermRetentionPolicyForTheManagedDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyGet.json + // this example is just showing the usage of "ManagedInstanceLongTermRetentionPolicies_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testResourceGroup"; + string managedInstanceName = "testInstance"; + string databaseName = "testDatabase"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedInstanceLongTermRetentionPolicyResource + ManagedInstanceLongTermRetentionPolicyCollection collection = managedDatabase.GetManagedInstanceLongTermRetentionPolicies(); + + // invoke the operation + ManagedInstanceLongTermRetentionPolicyName policyName = ManagedInstanceLongTermRetentionPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + ManagedInstanceLongTermRetentionPolicyResource 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 + ManagedInstanceLongTermRetentionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update the LTR policy for the managed database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceOperationCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceOperationCollection.cs index e60c9aaceb3c..10836c8d1edf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceOperationCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceOperationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsTheManagedInstanceManagementOperation() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the managed instance management operation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheManagedInstanceManagementOperation() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedInstanceOperation.json + // this example is just showing the usage of "ManagedInstanceOperations_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + string managedInstanceName = "sqlcrudtest-4645"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceOperationResource + ManagedInstanceOperationCollection collection = managedInstance.GetManagedInstanceOperations(); + + // invoke the operation + Guid operationId = Guid.Parse("00000000-1111-2222-3333-444444444444"); + NullableResponse response = await collection.GetIfExistsAsync(operationId); + ManagedInstanceOperationResource 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 + ManagedInstanceOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstancePrivateEndpointConnectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstancePrivateEndpointConnectionCollection.cs index f3dabab35224..3562a21a6eb1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstancePrivateEndpointConnectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstancePrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionGet.json + // this example is just showing the usage of "ManagedInstancePrivateEndpointConnections_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string managedInstanceName = "test-cl"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstancePrivateEndpointConnectionResource + ManagedInstancePrivateEndpointConnectionCollection collection = managedInstance.GetManagedInstancePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "private-endpoint-connection-name"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + ManagedInstancePrivateEndpointConnectionResource 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 + ManagedInstancePrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a private endpoint connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstancePrivateLinkCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstancePrivateLinkCollection.cs index 7db9c806f43d..1a1f0c7b89b4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstancePrivateLinkCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstancePrivateLinkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsAPrivateLinkResourceForSQL() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a private link resource for SQL. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAPrivateLinkResourceForSQL() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesGet.json + // this example is just showing the usage of "ManagedInstancePrivateLinkResources_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string managedInstanceName = "test-cl"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstancePrivateLinkResource + ManagedInstancePrivateLinkCollection collection = managedInstance.GetManagedInstancePrivateLinks(); + + // invoke the operation + string groupName = "plr"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + ManagedInstancePrivateLinkResource 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 + ManagedInstancePrivateLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceServerConfigurationOptionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceServerConfigurationOptionCollection.cs index 73927cfb95cc..0cffda8dca36 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceServerConfigurationOptionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceServerConfigurationOptionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsManagedInstanceServerConfigurationOption() Console.WriteLine($"Succeeded: {result}"); } + // Gets managed instance server configuration option. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsManagedInstanceServerConfigurationOption() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerConfigurationOptionGet.json + // this example is just showing the usage of "ServerConfigurationOptions_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testinstance"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceServerConfigurationOptionResource + ManagedInstanceServerConfigurationOptionCollection collection = managedInstance.GetManagedInstanceServerConfigurationOptions(); + + // invoke the operation + ManagedInstanceServerConfigurationOptionName serverConfigurationOptionName = ManagedInstanceServerConfigurationOptionName.AllowPolybaseExport; + NullableResponse response = await collection.GetIfExistsAsync(serverConfigurationOptionName); + ManagedInstanceServerConfigurationOptionResource 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 + ManagedInstanceServerConfigurationOptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Updates managed instance server configuration option. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceServerTrustCertificateCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceServerTrustCertificateCollection.cs index e8379be6cc0b..0dde8d5f557a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceServerTrustCertificateCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceServerTrustCertificateCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetsServerTrustCertificate() Console.WriteLine($"Succeeded: {result}"); } + // Gets server trust certificate. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsServerTrustCertificate() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesGet.json + // this example is just showing the usage of "ServerTrustCertificates_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "38e0dc56-907f-45ba-a97c-74233baad471"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testcl"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceServerTrustCertificateResource + ManagedInstanceServerTrustCertificateCollection collection = managedInstance.GetManagedInstanceServerTrustCertificates(); + + // invoke the operation + string certificateName = "customerCertificateName"; + NullableResponse response = await collection.GetIfExistsAsync(certificateName); + ManagedInstanceServerTrustCertificateResource 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 + ServerTrustCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create server trust certificate. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceStartStopScheduleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceStartStopScheduleCollection.cs index b94e16bbcfb2..099257562e87 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceStartStopScheduleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceStartStopScheduleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsTheManagedInstanceSStartStopSchedule() Console.WriteLine($"Succeeded: {result}"); } + // Gets the managed instance's Start/Stop schedule. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheManagedInstanceSStartStopSchedule() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StartStopManagedInstanceScheduleGet.json + // this example is just showing the usage of "StartStopManagedInstanceSchedules_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "schedulerg"; + string managedInstanceName = "schedulemi"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceStartStopScheduleResource + ManagedInstanceStartStopScheduleCollection collection = managedInstance.GetManagedInstanceStartStopSchedules(); + + // invoke the operation + ManagedInstanceStartStopScheduleName startStopScheduleName = ManagedInstanceStartStopScheduleName.Default; + NullableResponse response = await collection.GetIfExistsAsync(startStopScheduleName); + ManagedInstanceStartStopScheduleResource 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 + ManagedInstanceStartStopScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates the managed instance's Start/Stop schedule with all optional parameters specified. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceVulnerabilityAssessmentCollection.cs index 2542939a84c1..984e163cc826 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceVulnerabilityAssessmentCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAManagedInstanceSVulnerabilityAssessment() Console.WriteLine($"Succeeded: {result}"); } + // Get a managed instance's vulnerability assessment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAManagedInstanceSVulnerabilityAssessment() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentGet.json + // this example is just showing the usage of "ManagedInstanceVulnerabilityAssessments_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4799"; + string managedInstanceName = "vulnerabilityaseessmenttest-6440"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedInstanceVulnerabilityAssessmentResource + ManagedInstanceVulnerabilityAssessmentCollection collection = managedInstance.GetManagedInstanceVulnerabilityAssessments(); + + // invoke the operation + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + NullableResponse response = await collection.GetIfExistsAsync(vulnerabilityAssessmentName); + ManagedInstanceVulnerabilityAssessmentResource 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 + ManagedInstanceVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a managed instance's vulnerability assessment with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedLedgerDigestUploadCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedLedgerDigestUploadCollection.cs index f3d400c95300..848da46bcec0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedLedgerDigestUploadCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedLedgerDigestUploadCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetsTheCurrentLedgerDigestUploadConfigurationForADataba Console.WriteLine($"Succeeded: {result}"); } + // Gets the current ledger digest upload configuration for a database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheCurrentLedgerDigestUploadConfigurationForADatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedLedgerDigestUploadsGet.json + // this example is just showing the usage of "ManagedLedgerDigestUploads_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "ledgertestrg"; + string managedInstanceName = "ledgertestserver"; + string databaseName = "testdb"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedLedgerDigestUploadResource + ManagedLedgerDigestUploadCollection collection = managedDatabase.GetManagedLedgerDigestUploads(); + + // invoke the operation + ManagedLedgerDigestUploadsName ledgerDigestUploads = ManagedLedgerDigestUploadsName.Current; + NullableResponse response = await collection.GetIfExistsAsync(ledgerDigestUploads); + ManagedLedgerDigestUploadResource 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 + ManagedLedgerDigestUploadData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Enables managed ledger digest upload configuration for a database [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.cs index bc2fafb21f9d..81be6465bae0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetTheShortTermRetentionPolicyForTheDatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get the short term retention policy for the database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheShortTermRetentionPolicyForTheDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicyRestorableDropped.json + // this example is just showing the usage of "ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_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 RestorableDroppedManagedDatabaseResource created on azure + // for more information of creating RestorableDroppedManagedDatabaseResource, please refer to the document of RestorableDroppedManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string managedInstanceName = "testsvr"; + string restorableDroppedDatabaseId = "testdb,131403269876900000"; + ResourceIdentifier restorableDroppedManagedDatabaseResourceId = RestorableDroppedManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, restorableDroppedDatabaseId); + RestorableDroppedManagedDatabaseResource restorableDroppedManagedDatabase = client.GetRestorableDroppedManagedDatabaseResource(restorableDroppedManagedDatabaseResourceId); + + // get the collection of this ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource + ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection collection = restorableDroppedManagedDatabase.GetManagedRestorableDroppedDbBackupShortTermRetentionPolicies(); + + // invoke the operation + ManagedShortTermRetentionPolicyName policyName = ManagedShortTermRetentionPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(policyName); + ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource 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 + ManagedBackupShortTermRetentionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update the short term retention policy for the restorable dropped database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedServerDnsAliasCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedServerDnsAliasCollection.cs index 7286c87ef9ad..041e6335056d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedServerDnsAliasCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedServerDnsAliasCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetManagedServerDNSAlias() Console.WriteLine($"Succeeded: {result}"); } + // Get managed server DNS alias + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedServerDNSAlias() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasGet.json + // this example is just showing the usage of "ManagedServerDnsAliases_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string managedInstanceName = "dns-mi"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedServerDnsAliasResource + ManagedServerDnsAliasCollection collection = managedInstance.GetManagedServerDnsAliases(); + + // invoke the operation + string dnsAliasName = "dns-alias-mi"; + NullableResponse response = await collection.GetIfExistsAsync(dnsAliasName); + ManagedServerDnsAliasResource 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 + ManagedServerDnsAliasData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create managed server DNS alias [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedServerSecurityAlertPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedServerSecurityAlertPolicyCollection.cs index 988493eeb1e8..8ef9e1226312 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedServerSecurityAlertPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedServerSecurityAlertPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAManagedServerSThreatDetectionPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a managed server's threat detection policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAManagedServerSThreatDetectionPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertGet.json + // this example is just showing the usage of "ManagedServerSecurityAlertPolicies_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "securityalert-4799"; + string managedInstanceName = "securityalert-6440"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this ManagedServerSecurityAlertPolicyResource + ManagedServerSecurityAlertPolicyCollection collection = managedInstance.GetManagedServerSecurityAlertPolicies(); + + // invoke the operation + SqlSecurityAlertPolicyName securityAlertPolicyName = SqlSecurityAlertPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(securityAlertPolicyName); + ManagedServerSecurityAlertPolicyResource 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 + ManagedServerSecurityAlertPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a managed server's threat detection policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedTransparentDataEncryptionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedTransparentDataEncryptionCollection.cs index d75e93a18a47..c35a7e1137a5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedTransparentDataEncryptionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedTransparentDataEncryptionCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetADatabaseSTransparentDataEncryption() Console.WriteLine($"Succeeded: {result}"); } + // Get a database's transparent data encryption + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSTransparentDataEncryption() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionGet.json + // this example is just showing the usage of "ManagedDatabaseTransparentDataEncryption_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 ManagedDatabaseResource created on azure + // for more information of creating ManagedDatabaseResource, please refer to the document of ManagedDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "security-tde-resourcegroup"; + string managedInstanceName = "securitytde"; + string databaseName = "testdb"; + ResourceIdentifier managedDatabaseResourceId = ManagedDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, databaseName); + ManagedDatabaseResource managedDatabase = client.GetManagedDatabaseResource(managedDatabaseResourceId); + + // get the collection of this ManagedTransparentDataEncryptionResource + ManagedTransparentDataEncryptionCollection collection = managedDatabase.GetManagedTransparentDataEncryptions(); + + // invoke the operation + TransparentDataEncryptionName tdeName = TransparentDataEncryptionName.Current; + NullableResponse response = await collection.GetIfExistsAsync(tdeName); + ManagedTransparentDataEncryptionResource 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 + ManagedTransparentDataEncryptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a database's Transparent Data Encryption state with minimal parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_OutboundFirewallRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_OutboundFirewallRuleCollection.cs index 2d52debbde4a..020ab78a0a5f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_OutboundFirewallRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_OutboundFirewallRuleCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetsOutboundFirewallRule() Console.WriteLine($"Succeeded: {result}"); } + // Gets outbound firewall rule. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsOutboundFirewallRule() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleGet.json + // this example is just showing the usage of "OutboundFirewallRules_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + string serverName = "sqlcrudtest-4645"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this OutboundFirewallRuleResource + OutboundFirewallRuleCollection collection = sqlServer.GetOutboundFirewallRules(); + + // invoke the operation + string outboundRuleFqdn = "server.database.windows.net"; + NullableResponse response = await collection.GetIfExistsAsync(outboundRuleFqdn); + OutboundFirewallRuleResource 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 + OutboundFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a outbound firewall rule with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecommendedActionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecommendedActionCollection.cs index 34b84d396391..758905c36f07 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecommendedActionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecommendedActionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetDatabaseRecommendedAction() Console.WriteLine($"Succeeded: {result}"); } + + // Get database recommended action + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatabaseRecommendedAction() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionGet.json + // this example is just showing the usage of "DatabaseRecommendedActions_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 SqlDatabaseAdvisorResource created on azure + // for more information of creating SqlDatabaseAdvisorResource, please refer to the document of SqlDatabaseAdvisorResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "workloadinsight-demos"; + string serverName = "misosisvr"; + string databaseName = "IndexAdvisor_test_3"; + string advisorName = "CreateIndex"; + ResourceIdentifier sqlDatabaseAdvisorResourceId = SqlDatabaseAdvisorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, advisorName); + SqlDatabaseAdvisorResource sqlDatabaseAdvisor = client.GetSqlDatabaseAdvisorResource(sqlDatabaseAdvisorResourceId); + + // get the collection of this RecommendedActionResource + RecommendedActionCollection collection = sqlDatabaseAdvisor.GetRecommendedActions(); + + // invoke the operation + string recommendedActionName = "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"; + NullableResponse response = await collection.GetIfExistsAsync(recommendedActionName); + RecommendedActionResource 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 + RecommendedActionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecoverableDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecoverableDatabaseCollection.cs index cc94d2422ab3..80bbcfd5e8f6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecoverableDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecoverableDatabaseCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -119,6 +120,49 @@ public async Task Exists_GetARecoverableDatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get a recoverable database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARecoverableDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/RecoverableDatabaseGet.json + // this example is just showing the usage of "RecoverableDatabases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "recoverabledatabasetest-6852"; + string serverName = "recoverabledatabasetest-2080"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this RecoverableDatabaseResource + RecoverableDatabaseCollection collection = sqlServer.GetRecoverableDatabases(); + + // invoke the operation + string databaseName = "recoverabledatabasetest-9187"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + RecoverableDatabaseResource 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 + RecoverableDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets a recoverable database with expand equals keys. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -186,5 +230,49 @@ public async Task Exists_GetsARecoverableDatabaseWithExpandEqualsKeys() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a recoverable database with expand equals keys. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsARecoverableDatabaseWithExpandEqualsKeys() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/RecoverableDatabaseGetWithExpandEqualsKeys.json + // this example is just showing the usage of "RecoverableDatabases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "recoverabledatabasetest-6852"; + string serverName = "recoverabledatabasetest-2080"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this RecoverableDatabaseResource + RecoverableDatabaseCollection collection = sqlServer.GetRecoverableDatabases(); + + // invoke the operation + string databaseName = "recoverabledatabasetest-9187"; + string expand = "keys"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName, expand: expand); + RecoverableDatabaseResource 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 + RecoverableDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecoverableManagedDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecoverableManagedDatabaseCollection.cs index 7b57f8573bda..4834dc4ffc60 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecoverableManagedDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RecoverableManagedDatabaseCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsARecoverableDatabasesByManagedInstances() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a recoverable databases by managed instances + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsARecoverableDatabasesByManagedInstances() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetRecoverableManagedDatabase.json + // this example is just showing the usage of "RecoverableManagedDatabases_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Test1"; + string managedInstanceName = "managedInstance"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this RecoverableManagedDatabaseResource + RecoverableManagedDatabaseCollection collection = managedInstance.GetRecoverableManagedDatabases(); + + // invoke the operation + string recoverableDatabaseName = "testdb"; + NullableResponse response = await collection.GetIfExistsAsync(recoverableDatabaseName); + RecoverableManagedDatabaseResource 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 + RecoverableManagedDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupCollection.cs index c62990cde982..9da730005e0f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionBackupCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -87,6 +88,51 @@ public async Task Exists_GetTheLongTermRetentionBackup() Console.WriteLine($"Succeeded: {result}"); } + // Get the long term retention backup. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheLongTermRetentionBackup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + // this example is just showing the usage of "LongTermRetentionBackups_GetByResourceGroup" 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-1111-2222-3333-444444444444"; + string resourceGroupName = "testResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ResourceGroupLongTermRetentionBackupResource + AzureLocation locationName = new AzureLocation("japaneast"); + string longTermRetentionServerName = "testserver"; + string longTermRetentionDatabaseName = "testDatabase"; + ResourceGroupLongTermRetentionBackupCollection collection = resourceGroupResource.GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + + // invoke the operation + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + ResourceGroupLongTermRetentionBackupResource 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 + LongTermRetentionBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get all long term retention backups under the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionManagedInstanceBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionManagedInstanceBackupCollection.cs index 5940dc512bdc..f347fda6edf1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionManagedInstanceBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ResourceGroupLongTermRetentionManagedInstanceBackupCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -87,6 +88,51 @@ public async Task Exists_GetTheLongTermRetentionBackup() Console.WriteLine($"Succeeded: {result}"); } + // Get the long term retention backup. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheLongTermRetentionBackup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupGet.json + // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_GetByResourceGroup" 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-1111-2222-3333-444444444444"; + string resourceGroupName = "testResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ResourceGroupLongTermRetentionManagedInstanceBackupResource + AzureLocation locationName = new AzureLocation("japaneast"); + string managedInstanceName = "testInstance"; + string databaseName = "testDatabase"; + ResourceGroupLongTermRetentionManagedInstanceBackupCollection collection = resourceGroupResource.GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName); + + // invoke the operation + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + ResourceGroupLongTermRetentionManagedInstanceBackupResource 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 + ManagedInstanceLongTermRetentionBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get all long term retention backups under the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RestorableDroppedDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RestorableDroppedDatabaseCollection.cs index 2f4a1ef613e1..29986d2c4d2d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RestorableDroppedDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RestorableDroppedDatabaseCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,6 +122,50 @@ public async Task Exists_GetsARestorableDroppedDatabaseWithExpandEqualsKeys() Console.WriteLine($"Succeeded: {result}"); } + // Gets a restorable dropped database with expand equals keys. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsARestorableDroppedDatabaseWithExpandEqualsKeys() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetRestorableDroppedDatabaseWithExpandEqualsKeys.json + // this example is just showing the usage of "RestorableDroppedDatabases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this RestorableDroppedDatabaseResource + RestorableDroppedDatabaseCollection collection = sqlServer.GetRestorableDroppedDatabases(); + + // invoke the operation + string restorableDroppedDatabaseId = "testdb,131403269876900000"; + string expand = "keys"; + NullableResponse response = await collection.GetIfExistsAsync(restorableDroppedDatabaseId, expand: expand); + RestorableDroppedDatabaseResource 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 + RestorableDroppedDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets a restorable dropped database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -186,5 +231,48 @@ public async Task Exists_GetsARestorableDroppedDatabase() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a restorable dropped database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsARestorableDroppedDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetRestorableDroppedDatabase.json + // this example is just showing the usage of "RestorableDroppedDatabases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this RestorableDroppedDatabaseResource + RestorableDroppedDatabaseCollection collection = sqlServer.GetRestorableDroppedDatabases(); + + // invoke the operation + string restorableDroppedDatabaseId = "testdb,131403269876900000"; + NullableResponse response = await collection.GetIfExistsAsync(restorableDroppedDatabaseId); + RestorableDroppedDatabaseResource 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 + RestorableDroppedDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RestorableDroppedManagedDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RestorableDroppedManagedDatabaseCollection.cs index bbf8df0ade67..fcc888efb0c5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RestorableDroppedManagedDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_RestorableDroppedManagedDatabaseCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsARestorableDroppedManagedDatabase() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a restorable dropped managed database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsARestorableDroppedManagedDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedManagedDatabase.json + // this example is just showing the usage of "RestorableDroppedManagedDatabases_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Test1"; + string managedInstanceName = "managedInstance"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this RestorableDroppedManagedDatabaseResource + RestorableDroppedManagedDatabaseCollection collection = managedInstance.GetRestorableDroppedManagedDatabases(); + + // invoke the operation + string restorableDroppedDatabaseId = "testdb,131403269876900000"; + NullableResponse response = await collection.GetIfExistsAsync(restorableDroppedDatabaseId); + RestorableDroppedManagedDatabaseResource 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 + RestorableDroppedManagedDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ServerAdvancedThreatProtectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ServerAdvancedThreatProtectionCollection.cs index ffdd4b7e07d5..8ead2e4926ca 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ServerAdvancedThreatProtectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ServerAdvancedThreatProtectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAServerSAdvancedThreatProtectionSettings() Console.WriteLine($"Succeeded: {result}"); } + // Get a server's Advanced Threat Protection settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerSAdvancedThreatProtectionSettings() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsGet.json + // this example is just showing the usage of "ServerAdvancedThreatProtectionSettings_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "threatprotection-4799"; + string serverName = "threatprotection-6440"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this ServerAdvancedThreatProtectionResource + ServerAdvancedThreatProtectionCollection collection = sqlServer.GetServerAdvancedThreatProtections(); + + // invoke the operation + AdvancedThreatProtectionName advancedThreatProtectionName = AdvancedThreatProtectionName.Default; + NullableResponse response = await collection.GetIfExistsAsync(advancedThreatProtectionName); + ServerAdvancedThreatProtectionResource 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 + ServerAdvancedThreatProtectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a server's Advanced Threat Protection settings with all parameters. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ServiceObjectiveCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ServiceObjectiveCollection.cs index 9a60fcba2e25..09baa36e2101 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ServiceObjectiveCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ServiceObjectiveCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetAServiceObjective() Console.WriteLine($"Succeeded: {result}"); } + // Get a service objective + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServiceObjective() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json + // this example is just showing the usage of "ServiceObjectives_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "sqlcrudtest"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this ServiceObjectiveResource + ServiceObjectiveCollection collection = sqlServer.GetServiceObjectives(); + + // invoke the operation + string serviceObjectiveName = "29dd7459-4a7c-4e56-be22-f0adda49440d"; + NullableResponse response = await collection.GetIfExistsAsync(serviceObjectiveName); + ServiceObjectiveResource 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 + ServiceObjectiveData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List service objectives [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseAdvisorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseAdvisorCollection.cs index a8a851219371..06dd27477016 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseAdvisorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseAdvisorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -160,5 +161,49 @@ public async Task Exists_GetDatabaseAdvisor() Console.WriteLine($"Succeeded: {result}"); } + + // Get database advisor + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatabaseAdvisor() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorGet.json + // this example is just showing the usage of "DatabaseAdvisors_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "workloadinsight-demos"; + string serverName = "misosisvr"; + string databaseName = "IndexAdvisor_test_3"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlDatabaseAdvisorResource + SqlDatabaseAdvisorCollection collection = sqlDatabase.GetSqlDatabaseAdvisors(); + + // invoke the operation + string advisorName = "CreateIndex"; + NullableResponse response = await collection.GetIfExistsAsync(advisorName); + SqlDatabaseAdvisorResource 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 + SqlAdvisorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseBlobAuditingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseBlobAuditingPolicyCollection.cs index 6f84b1ec7484..53326d5c65d3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseBlobAuditingPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseBlobAuditingPolicyCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetADatabaseSBlobAuditingPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a database's blob auditing policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSBlobAuditingPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingGet.json + // this example is just showing the usage of "DatabaseBlobAuditingPolicies_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "blobauditingtest-6852"; + string serverName = "blobauditingtest-2080"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlDatabaseBlobAuditingPolicyResource + SqlDatabaseBlobAuditingPolicyCollection collection = sqlDatabase.GetSqlDatabaseBlobAuditingPolicies(); + + // invoke the operation + BlobAuditingPolicyName blobAuditingPolicyName = BlobAuditingPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(blobAuditingPolicyName); + SqlDatabaseBlobAuditingPolicyResource 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 + SqlDatabaseBlobAuditingPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a database's azure monitor auditing policy with minimal parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseCollection.cs index 545688616fb1..c2ca26329949 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseCollection.cs @@ -159,6 +159,49 @@ public async Task Exists_GetsADatabaseConfiguredWithDefaultEnclaveType() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database configured with Default enclave type. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseConfiguredWithDefaultEnclaveType() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetVCoreDatabaseDefaultEnclave.json + // this example is just showing the usage of "Databases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlDatabaseResource + SqlDatabaseCollection collection = sqlServer.GetSqlDatabases(); + + // invoke the operation + string databaseName = "testdb"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + SqlDatabaseResource 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 + SqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets a database configured with VBS enclave type. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -225,6 +268,49 @@ public async Task Exists_GetsADatabaseConfiguredWithVBSEnclaveType() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database configured with VBS enclave type. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseConfiguredWithVBSEnclaveType() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetVCoreDatabaseVBSEnclave.json + // this example is just showing the usage of "Databases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlDatabaseResource + SqlDatabaseCollection collection = sqlServer.GetSqlDatabases(); + + // invoke the operation + string databaseName = "testdb"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + SqlDatabaseResource 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 + SqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets a database with Availability zone specified. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -291,6 +377,49 @@ public async Task Exists_GetsADatabaseWithAvailabilityZoneSpecified() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database with Availability zone specified. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseWithAvailabilityZoneSpecified() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetDatabaseWithAvailabilityZone.json + // this example is just showing the usage of "Databases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlDatabaseResource + SqlDatabaseCollection collection = sqlServer.GetSqlDatabases(); + + // invoke the operation + string databaseName = "testdb"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + SqlDatabaseResource 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 + SqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets a database with database level keys expanded. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -359,6 +488,50 @@ public async Task Exists_GetsADatabaseWithDatabaseLevelKeysExpanded() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database with database level keys expanded. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseWithDatabaseLevelKeysExpanded() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetVCoreDatabaseWithExpandEqualsKeys.json + // this example is just showing the usage of "Databases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlDatabaseResource + SqlDatabaseCollection collection = sqlServer.GetSqlDatabases(); + + // invoke the operation + string databaseName = "testdb"; + string expand = "keys"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName, expand: expand); + SqlDatabaseResource 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 + SqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets a database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -425,6 +598,49 @@ public async Task Exists_GetsADatabase() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetVCoreDatabase.json + // this example is just showing the usage of "Databases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlDatabaseResource + SqlDatabaseCollection collection = sqlServer.GetSqlDatabases(); + + // invoke the operation + string databaseName = "testdb"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + SqlDatabaseResource 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 + SqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates a VCore database by specifying service objective name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseColumnCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseColumnCollection.cs index 574f6683384a..57a2390aa479 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseColumnCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseColumnCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -127,5 +128,51 @@ public async Task Exists_GetDatabaseColumn() Console.WriteLine($"Succeeded: {result}"); } + + // Get database column + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatabaseColumn() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnGet.json + // this example is just showing the usage of "DatabaseColumns_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 SqlDatabaseTableResource created on azure + // for more information of creating SqlDatabaseTableResource, please refer to the document of SqlDatabaseTableResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string serverName = "serverName"; + string databaseName = "myDatabase"; + string schemaName = "dbo"; + string tableName = "table1"; + ResourceIdentifier sqlDatabaseTableResourceId = SqlDatabaseTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName); + SqlDatabaseTableResource sqlDatabaseTable = client.GetSqlDatabaseTableResource(sqlDatabaseTableResourceId); + + // get the collection of this SqlDatabaseColumnResource + SqlDatabaseColumnCollection collection = sqlDatabaseTable.GetSqlDatabaseColumns(); + + // invoke the operation + string columnName = "column1"; + NullableResponse response = await collection.GetIfExistsAsync(columnName); + SqlDatabaseColumnResource 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 + DatabaseColumnData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSchemaCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSchemaCollection.cs index 6744081b8262..12217ff90e23 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSchemaCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSchemaCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetDatabaseSchema() Console.WriteLine($"Succeeded: {result}"); } + + // Get database schema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatabaseSchema() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaGet.json + // this example is just showing the usage of "DatabaseSchemas_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string serverName = "serverName"; + string databaseName = "myDatabase"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlDatabaseSchemaResource + SqlDatabaseSchemaCollection collection = sqlDatabase.GetSqlDatabaseSchemas(); + + // invoke the operation + string schemaName = "dbo"; + NullableResponse response = await collection.GetIfExistsAsync(schemaName); + SqlDatabaseSchemaResource 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 + DatabaseSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSecurityAlertPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSecurityAlertPolicyCollection.cs index 47f8affcfe42..a782d7db1c54 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSecurityAlertPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSecurityAlertPolicyCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetADatabaseSThreatDetectionPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a database's threat detection policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSThreatDetectionPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertGet.json + // this example is just showing the usage of "DatabaseSecurityAlertPolicies_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "securityalert-6852"; + string serverName = "securityalert-2080"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlDatabaseSecurityAlertPolicyResource + SqlDatabaseSecurityAlertPolicyCollection collection = sqlDatabase.GetSqlDatabaseSecurityAlertPolicies(); + + // invoke the operation + SqlSecurityAlertPolicyName securityAlertPolicyName = SqlSecurityAlertPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(securityAlertPolicyName); + SqlDatabaseSecurityAlertPolicyResource 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 + SqlDatabaseSecurityAlertPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a database's threat detection policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSensitivityLabelCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSensitivityLabelCollection.cs index 6654892f5f99..ffa6966879d3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSensitivityLabelCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSensitivityLabelCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -90,5 +91,52 @@ public async Task Exists_GetsTheSensitivityLabelOfAGivenColumn() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the sensitivity label of a given column + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheSensitivityLabelOfAGivenColumn() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelGet.json + // this example is just showing the usage of "SensitivityLabels_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 SqlDatabaseColumnResource created on azure + // for more information of creating SqlDatabaseColumnResource, please refer to the document of SqlDatabaseColumnResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string serverName = "myServer"; + string databaseName = "myDatabase"; + string schemaName = "dbo"; + string tableName = "myTable"; + string columnName = "myColumn"; + ResourceIdentifier sqlDatabaseColumnResourceId = SqlDatabaseColumnResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + SqlDatabaseColumnResource sqlDatabaseColumn = client.GetSqlDatabaseColumnResource(sqlDatabaseColumnResourceId); + + // get the collection of this SqlDatabaseSensitivityLabelResource + SqlDatabaseSensitivityLabelCollection collection = sqlDatabaseColumn.GetSqlDatabaseSensitivityLabels(); + + // invoke the operation + SensitivityLabelSource sensitivityLabelSource = SensitivityLabelSource.Current; + NullableResponse response = await collection.GetIfExistsAsync(sensitivityLabelSource); + SqlDatabaseSensitivityLabelResource 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 + SensitivityLabelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.cs index 91091d85391f..05b1cede2430 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.cs @@ -128,6 +128,51 @@ public async Task Exists_GetsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBasel Console.WriteLine($"Succeeded: {result}"); } + // Gets a list of database's sql vulnerability assessment rule baselines. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineGet.json + // this example is just showing the usage of "DatabaseSqlVulnerabilityAssessmentBaselines_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 SqlDatabaseSqlVulnerabilityAssessmentResource created on azure + // for more information of creating SqlDatabaseSqlVulnerabilityAssessmentResource, please refer to the document of SqlDatabaseSqlVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4711"; + string serverName = "vulnerabilityaseessmenttest-6411"; + string databaseName = "testdb"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + ResourceIdentifier sqlDatabaseSqlVulnerabilityAssessmentResourceId = SqlDatabaseSqlVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + SqlDatabaseSqlVulnerabilityAssessmentResource sqlDatabaseSqlVulnerabilityAssessment = client.GetSqlDatabaseSqlVulnerabilityAssessmentResource(sqlDatabaseSqlVulnerabilityAssessmentResourceId); + + // get the collection of this SqlDatabaseSqlVulnerabilityAssessmentBaselineResource + SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection collection = sqlDatabaseSqlVulnerabilityAssessment.GetSqlDatabaseSqlVulnerabilityAssessmentBaselines(); + + // invoke the operation + SqlVulnerabilityAssessmentBaselineName baselineName = SqlVulnerabilityAssessmentBaselineName.Default; + NullableResponse response = await collection.GetIfExistsAsync(baselineName); + SqlDatabaseSqlVulnerabilityAssessmentBaselineResource 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 + SqlVulnerabilityAssessmentBaselineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Add a database's vulnerability assessment rule baseline from the latest scan result. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.cs index 66c3a10598ba..38fa3caa7f80 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.cs @@ -130,6 +130,52 @@ public async Task Exists_GetsADatabaseSSqlVulnerabilityAssessmentRuleBaseline() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database's sql vulnerability assessment rule baseline. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseSSqlVulnerabilityAssessmentRuleBaseline() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineGet.json + // this example is just showing the usage of "DatabaseSqlVulnerabilityAssessmentRuleBaselines_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 SqlDatabaseSqlVulnerabilityAssessmentBaselineResource created on azure + // for more information of creating SqlDatabaseSqlVulnerabilityAssessmentBaselineResource, please refer to the document of SqlDatabaseSqlVulnerabilityAssessmentBaselineResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4711"; + string serverName = "vulnerabilityaseessmenttest-6411"; + string databaseName = "testdb"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + SqlVulnerabilityAssessmentBaselineName baselineName = SqlVulnerabilityAssessmentBaselineName.Default; + ResourceIdentifier sqlDatabaseSqlVulnerabilityAssessmentBaselineResourceId = SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName); + SqlDatabaseSqlVulnerabilityAssessmentBaselineResource sqlDatabaseSqlVulnerabilityAssessmentBaseline = client.GetSqlDatabaseSqlVulnerabilityAssessmentBaselineResource(sqlDatabaseSqlVulnerabilityAssessmentBaselineResourceId); + + // get the collection of this SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource + SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection collection = sqlDatabaseSqlVulnerabilityAssessmentBaseline.GetSqlDatabaseSqlVulnerabilityAssessmentBaselineRules(); + + // invoke the operation + string ruleId = "VA1001"; + NullableResponse response = await collection.GetIfExistsAsync(ruleId); + SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource 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 + SqlVulnerabilityAssessmentBaselineRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a database's vulnerability assessment rule baseline. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentCollection.cs index 5457c4f4e952..f1b0e521f433 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -122,5 +123,49 @@ public async Task Exists_GetSQLVulnerabilityAssessmentPolicyForDatabase() Console.WriteLine($"Succeeded: {result}"); } + + // Get SQL Vulnerability Assessment policy for database + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSQLVulnerabilityAssessmentPolicyForDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/DatabaseSqlVulnerabilityAssessmentGet.json + // this example is just showing the usage of "DatabaseSqlVulnerabilityAssessmentsSettings_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4799"; + string serverName = "vulnerabilityaseessmenttest-6440"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlDatabaseSqlVulnerabilityAssessmentResource + SqlDatabaseSqlVulnerabilityAssessmentCollection collection = sqlDatabase.GetSqlDatabaseSqlVulnerabilityAssessments(); + + // invoke the operation + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + NullableResponse response = await collection.GetIfExistsAsync(vulnerabilityAssessmentName); + SqlDatabaseSqlVulnerabilityAssessmentResource 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 + SqlVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentScanCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentScanCollection.cs index aa7f23d949e7..89a7219ed551 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentScanCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentScanCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -125,5 +126,50 @@ public async Task Exists_GetADatabaseSVulnerabilityAssessmentScan() Console.WriteLine($"Succeeded: {result}"); } + + // Get a database's vulnerability assessment scan. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSVulnerabilityAssessmentScan() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScan.json + // this example is just showing the usage of "DatabaseSqlVulnerabilityAssessmentScans_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 SqlDatabaseSqlVulnerabilityAssessmentResource created on azure + // for more information of creating SqlDatabaseSqlVulnerabilityAssessmentResource, please refer to the document of SqlDatabaseSqlVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityassessmenttest-4711"; + string serverName = "vulnerabilityassessmenttest-6411"; + string databaseName = "testdb"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + ResourceIdentifier sqlDatabaseSqlVulnerabilityAssessmentResourceId = SqlDatabaseSqlVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + SqlDatabaseSqlVulnerabilityAssessmentResource sqlDatabaseSqlVulnerabilityAssessment = client.GetSqlDatabaseSqlVulnerabilityAssessmentResource(sqlDatabaseSqlVulnerabilityAssessmentResourceId); + + // get the collection of this SqlDatabaseSqlVulnerabilityAssessmentScanResource + SqlDatabaseSqlVulnerabilityAssessmentScanCollection collection = sqlDatabaseSqlVulnerabilityAssessment.GetSqlDatabaseSqlVulnerabilityAssessmentScans(); + + // invoke the operation + string scanId = "scan001"; + NullableResponse response = await collection.GetIfExistsAsync(scanId); + SqlDatabaseSqlVulnerabilityAssessmentScanResource 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 + SqlVulnerabilityAssessmentScanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.cs index 158fb693ef8f..806f3684ca52 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -128,5 +129,51 @@ public async Task Exists_GetADatabaseSQLVulnerabilityAssessmentScanResultForScan Console.WriteLine($"Succeeded: {result}"); } + + // Get a database SQL Vulnerability Assessment scan result for scan id and scan result id + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSQLVulnerabilityAssessmentScanResultForScanIdAndScanResultId() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScansResults.json + // this example is just showing the usage of "DatabaseSqlVulnerabilityAssessmentScanResult_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 SqlDatabaseSqlVulnerabilityAssessmentScanResource created on azure + // for more information of creating SqlDatabaseSqlVulnerabilityAssessmentScanResource, please refer to the document of SqlDatabaseSqlVulnerabilityAssessmentScanResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityassessmenttest-4711"; + string serverName = "vulnerabilityassessmenttest-6411"; + string databaseName = "master"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + string scanId = "scanId1"; + ResourceIdentifier sqlDatabaseSqlVulnerabilityAssessmentScanResourceId = SqlDatabaseSqlVulnerabilityAssessmentScanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + SqlDatabaseSqlVulnerabilityAssessmentScanResource sqlDatabaseSqlVulnerabilityAssessmentScan = client.GetSqlDatabaseSqlVulnerabilityAssessmentScanResource(sqlDatabaseSqlVulnerabilityAssessmentScanResourceId); + + // get the collection of this SqlDatabaseSqlVulnerabilityAssessmentScanResultResource + SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection collection = sqlDatabaseSqlVulnerabilityAssessmentScan.GetSqlDatabaseSqlVulnerabilityAssessmentScanResults(); + + // invoke the operation + string scanResultId = "VA1234"; + NullableResponse response = await collection.GetIfExistsAsync(scanResultId); + SqlDatabaseSqlVulnerabilityAssessmentScanResultResource 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 + SqlVulnerabilityAssessmentScanResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseTableCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseTableCollection.cs index 4636a7a537c8..d44a7e648986 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseTableCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseTableCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetDatabaseTable() Console.WriteLine($"Succeeded: {result}"); } + + // Get database table + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatabaseTable() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableGet.json + // this example is just showing the usage of "DatabaseTables_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 SqlDatabaseSchemaResource created on azure + // for more information of creating SqlDatabaseSchemaResource, please refer to the document of SqlDatabaseSchemaResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "myRG"; + string serverName = "serverName"; + string databaseName = "myDatabase"; + string schemaName = "dbo"; + ResourceIdentifier sqlDatabaseSchemaResourceId = SqlDatabaseSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, schemaName); + SqlDatabaseSchemaResource sqlDatabaseSchema = client.GetSqlDatabaseSchemaResource(sqlDatabaseSchemaResourceId); + + // get the collection of this SqlDatabaseTableResource + SqlDatabaseTableCollection collection = sqlDatabaseSchema.GetSqlDatabaseTables(); + + // invoke the operation + string tableName = "table1"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + SqlDatabaseTableResource 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 + DatabaseTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentCollection.cs index bbd0342b328b..3fa42573c997 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetADatabaseSVulnerabilityAssessment() Console.WriteLine($"Succeeded: {result}"); } + // Get a database's vulnerability assessment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADatabaseSVulnerabilityAssessment() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentGet.json + // this example is just showing the usage of "DatabaseVulnerabilityAssessments_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4799"; + string serverName = "vulnerabilityaseessmenttest-6440"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlDatabaseVulnerabilityAssessmentResource + SqlDatabaseVulnerabilityAssessmentCollection collection = sqlDatabase.GetSqlDatabaseVulnerabilityAssessments(); + + // invoke the operation + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + NullableResponse response = await collection.GetIfExistsAsync(vulnerabilityAssessmentName); + SqlDatabaseVulnerabilityAssessmentResource 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 + DatabaseVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a database's vulnerability assessment with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs index 38f110be2c49..1f92d5b2ebaf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs @@ -90,6 +90,52 @@ public async Task Exists_GetsADatabaseSVulnerabilityAssessmentRuleBaseline() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database's vulnerability assessment rule baseline. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseSVulnerabilityAssessmentRuleBaseline() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineGet.json + // this example is just showing the usage of "DatabaseVulnerabilityAssessmentRuleBaselines_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 SqlDatabaseVulnerabilityAssessmentResource created on azure + // for more information of creating SqlDatabaseVulnerabilityAssessmentResource, please refer to the document of SqlDatabaseVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4711"; + string serverName = "vulnerabilityaseessmenttest-6411"; + string databaseName = "testdb"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + ResourceIdentifier sqlDatabaseVulnerabilityAssessmentResourceId = SqlDatabaseVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + SqlDatabaseVulnerabilityAssessmentResource sqlDatabaseVulnerabilityAssessment = client.GetSqlDatabaseVulnerabilityAssessmentResource(sqlDatabaseVulnerabilityAssessmentResourceId); + + // get the collection of this SqlDatabaseVulnerabilityAssessmentRuleBaselineResource + SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection collection = sqlDatabaseVulnerabilityAssessment.GetSqlDatabaseVulnerabilityAssessmentRuleBaselines(); + + // invoke the operation + string ruleId = "VA1001"; + VulnerabilityAssessmentPolicyBaselineName baselineName = VulnerabilityAssessmentPolicyBaselineName.Master; + NullableResponse response = await collection.GetIfExistsAsync(ruleId, baselineName); + SqlDatabaseVulnerabilityAssessmentRuleBaselineResource 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 + DatabaseVulnerabilityAssessmentRuleBaselineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a database's vulnerability assessment rule baseline. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentScanCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentScanCollection.cs index 751c23298246..aed14d45d2ac 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentScanCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlDatabaseVulnerabilityAssessmentScanCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -125,5 +126,50 @@ public async Task Exists_GetsADatabaseVulnerabilityAssessmentScanRecordByScanID( Console.WriteLine($"Succeeded: {result}"); } + + // Gets a database vulnerability assessment scan record by scan ID + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseVulnerabilityAssessmentScanRecordByScanID() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsGet.json + // this example is just showing the usage of "DatabaseVulnerabilityAssessmentScans_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 SqlDatabaseVulnerabilityAssessmentResource created on azure + // for more information of creating SqlDatabaseVulnerabilityAssessmentResource, please refer to the document of SqlDatabaseVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityassessmenttest-4711"; + string serverName = "vulnerabilityassessmenttest-6411"; + string databaseName = "testdb"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + ResourceIdentifier sqlDatabaseVulnerabilityAssessmentResourceId = SqlDatabaseVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + SqlDatabaseVulnerabilityAssessmentResource sqlDatabaseVulnerabilityAssessment = client.GetSqlDatabaseVulnerabilityAssessmentResource(sqlDatabaseVulnerabilityAssessmentResourceId); + + // get the collection of this SqlDatabaseVulnerabilityAssessmentScanResource + SqlDatabaseVulnerabilityAssessmentScanCollection collection = sqlDatabaseVulnerabilityAssessment.GetSqlDatabaseVulnerabilityAssessmentScans(); + + // invoke the operation + string scanId = "scan001"; + NullableResponse response = await collection.GetIfExistsAsync(scanId); + SqlDatabaseVulnerabilityAssessmentScanResource 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 + VulnerabilityAssessmentScanRecordData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlFirewallRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlFirewallRuleCollection.cs index a3efcefb19c6..6708356ebf10 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlFirewallRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlFirewallRuleCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetFirewallRule() Console.WriteLine($"Succeeded: {result}"); } + // Get Firewall Rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetFirewallRule() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleGet.json + // this example is just showing the usage of "FirewallRules_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "firewallrulecrudtest-12"; + string serverName = "firewallrulecrudtest-6285"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlFirewallRuleResource + SqlFirewallRuleCollection collection = sqlServer.GetSqlFirewallRules(); + + // invoke the operation + string firewallRuleName = "firewallrulecrudtest-2304"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + SqlFirewallRuleResource 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 + SqlFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a firewall rule max/min [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlPrivateEndpointConnectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlPrivateEndpointConnectionCollection.cs index 71e1046eb624..6dc2552a755e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlPrivateEndpointConnectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlPrivateEndpointConnectionCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "test-svr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlPrivateEndpointConnectionResource + SqlPrivateEndpointConnectionCollection collection = sqlServer.GetSqlPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "private-endpoint-connection-name"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + SqlPrivateEndpointConnectionResource 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 + SqlPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approve or reject a private endpoint connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlPrivateLinkResourceCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlPrivateLinkResourceCollection.cs index 1529a4b9e7d1..c14a8c637a2a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlPrivateLinkResourceCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsAPrivateLinkResourceForSQL() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a private link resource for SQL. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAPrivateLinkResourceForSQL() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesGet.json + // this example is just showing the usage of "PrivateLinkResources_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "test-svr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlPrivateLinkResource + SqlPrivateLinkResourceCollection collection = sqlServer.GetSqlPrivateLinkResources(); + + // invoke the operation + string groupName = "plr"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + SqlPrivateLinkResource 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 + SqlPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAdvisorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAdvisorCollection.cs index a3a1601d5f9d..74484fb63409 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAdvisorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAdvisorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -156,5 +157,48 @@ public async Task Exists_GetServerAdvisor() Console.WriteLine($"Succeeded: {result}"); } + + // Get server advisor + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetServerAdvisor() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorGet.json + // this example is just showing the usage of "ServerAdvisors_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "workloadinsight-demos"; + string serverName = "misosisvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerAdvisorResource + SqlServerAdvisorCollection collection = sqlServer.GetSqlServerAdvisors(); + + // invoke the operation + string advisorName = "CreateIndex"; + NullableResponse response = await collection.GetIfExistsAsync(advisorName); + SqlServerAdvisorResource 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 + SqlAdvisorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAzureADAdministratorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAzureADAdministratorCollection.cs index 717b743bedb8..46af308b4298 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAzureADAdministratorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAzureADAdministratorCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsAAzureActiveDirectoryAdministrator() Console.WriteLine($"Succeeded: {result}"); } + // Gets a Azure Active Directory administrator. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAAzureActiveDirectoryAdministrator() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorGet.json + // this example is just showing the usage of "ServerAzureADAdministrators_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-4799"; + string serverName = "sqlcrudtest-6440"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerAzureADAdministratorResource + SqlServerAzureADAdministratorCollection collection = sqlServer.GetSqlServerAzureADAdministrators(); + + // invoke the operation + SqlAdministratorName administratorName = SqlAdministratorName.ActiveDirectory; + NullableResponse response = await collection.GetIfExistsAsync(administratorName); + SqlServerAzureADAdministratorResource 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 + SqlServerAzureADAdministratorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates an existing Azure Active Directory administrator. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAzureADOnlyAuthenticationCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAzureADOnlyAuthenticationCollection.cs index 06c9b6e5b93e..168d8cd1f824 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAzureADOnlyAuthenticationCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerAzureADOnlyAuthenticationCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsAAzureActiveDirectoryOnlyAuthenticationProperty() Console.WriteLine($"Succeeded: {result}"); } + // Gets a Azure Active Directory only authentication property. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAAzureActiveDirectoryOnlyAuthenticationProperty() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthGet.json + // this example is just showing the usage of "ServerAzureADOnlyAuthentications_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-4799"; + string serverName = "sqlcrudtest-6440"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerAzureADOnlyAuthenticationResource + SqlServerAzureADOnlyAuthenticationCollection collection = sqlServer.GetSqlServerAzureADOnlyAuthentications(); + + // invoke the operation + AuthenticationName authenticationName = AuthenticationName.Default; + NullableResponse response = await collection.GetIfExistsAsync(authenticationName); + SqlServerAzureADOnlyAuthenticationResource 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 + SqlServerAzureADOnlyAuthenticationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates Azure Active Directory only authentication object. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerBlobAuditingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerBlobAuditingPolicyCollection.cs index f80d79bb6174..809b2268a174 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerBlobAuditingPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerBlobAuditingPolicyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAServerSBlobAuditingPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a server's blob auditing policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerSBlobAuditingPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingGet.json + // this example is just showing the usage of "ServerBlobAuditingPolicies_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "blobauditingtest-4799"; + string serverName = "blobauditingtest-6440"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerBlobAuditingPolicyResource + SqlServerBlobAuditingPolicyCollection collection = sqlServer.GetSqlServerBlobAuditingPolicies(); + + // invoke the operation + BlobAuditingPolicyName blobAuditingPolicyName = BlobAuditingPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(blobAuditingPolicyName); + SqlServerBlobAuditingPolicyResource 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 + SqlServerBlobAuditingPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a server's blob auditing policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerCollection.cs index 2ba54711d107..c3126fc21fdd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerCollection.cs @@ -155,6 +155,48 @@ public async Task Exists_GetServer() Console.WriteLine($"Succeeded: {result}"); } + // Get server + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetServer() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerGet.json + // this example is just showing the usage of "Servers_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-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SqlServerResource + SqlServerCollection collection = resourceGroupResource.GetSqlServers(); + + // invoke the operation + string serverName = "sqlcrudtest-4645"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + SqlServerResource 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 + SqlServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get server with $expand=administrators/activedirectory [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -219,6 +261,48 @@ public async Task Exists_GetServerWithExpandAdministratorsActivedirectory() Console.WriteLine($"Succeeded: {result}"); } + // Get server with $expand=administrators/activedirectory + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetServerWithExpandAdministratorsActivedirectory() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerGetWithExpandEqualsAdministrators.json + // this example is just showing the usage of "Servers_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-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SqlServerResource + SqlServerCollection collection = resourceGroupResource.GetSqlServers(); + + // invoke the operation + string serverName = "sqlcrudtest-4645"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + SqlServerResource 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 + SqlServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerCommunicationLinkCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerCommunicationLinkCollection.cs index 2b9357e3ff83..65b7a84b3ec6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerCommunicationLinkCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerCommunicationLinkCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetAServerCommunicationLink() Console.WriteLine($"Succeeded: {result}"); } + // Get a server communication link + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerCommunicationLink() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkGet.json + // this example is just showing the usage of "ServerCommunicationLinks_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + string serverName = "sqlcrudtest-4645"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerCommunicationLinkResource + SqlServerCommunicationLinkCollection collection = sqlServer.GetSqlServerCommunicationLinks(); + + // invoke the operation + string communicationLinkName = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(communicationLinkName); + SqlServerCommunicationLinkResource 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 + SqlServerCommunicationLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a server communication link [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerConnectionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerConnectionPolicyCollection.cs index 88046e8966dd..89c0181a4e1c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerConnectionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerConnectionPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetsAServerConnectionPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Gets a server connection policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAServerConnectionPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesGet.json + // this example is just showing the usage of "ServerConnectionPolicies_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rgtest-12"; + string serverName = "servertest-6285"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerConnectionPolicyResource + SqlServerConnectionPolicyCollection collection = sqlServer.GetSqlServerConnectionPolicies(); + + // invoke the operation + ConnectionPolicyName connectionPolicyName = ConnectionPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(connectionPolicyName); + SqlServerConnectionPolicyResource 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 + SqlServerConnectionPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Updates a server connection policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkCollection.cs index 202ef24428d8..d564fb591985 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseReplicationLinkCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetsTheReplicationLink() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the replication link. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheReplicationLink() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkGet.json + // this example is just showing the usage of "ReplicationLinks_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "sourcesvr"; + string databaseName = "gamma-db"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlServerDatabaseReplicationLinkResource + SqlServerDatabaseReplicationLinkCollection collection = sqlDatabase.GetSqlServerDatabaseReplicationLinks(); + + // invoke the operation + string linkId = "4891ca10-ebd0-47d7-9182-c722651780fb"; + NullableResponse response = await collection.GetIfExistsAsync(linkId); + SqlServerDatabaseReplicationLinkResource 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 + SqlServerDatabaseReplicationLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseRestorePointCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseRestorePointCollection.cs index 491ef51ddba9..3b71ad68a55f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseRestorePointCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDatabaseRestorePointCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -160,6 +161,50 @@ public async Task Exists_GetsADatabaseRestorePoint() Console.WriteLine($"Succeeded: {result}"); } + // Gets a database restore point. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatabaseRestorePoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsGet.json + // this example is just showing the usage of "RestorePoints_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testserver"; + string databaseName = "testDatabase"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlServerDatabaseRestorePointResource + SqlServerDatabaseRestorePointCollection collection = sqlDatabase.GetSqlServerDatabaseRestorePoints(); + + // invoke the operation + string restorePointName = "131546477590000000"; + NullableResponse response = await collection.GetIfExistsAsync(restorePointName); + SqlServerDatabaseRestorePointResource 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 + SqlServerDatabaseRestorePointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets a datawarehouse database restore point. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -227,5 +272,49 @@ public async Task Exists_GetsADatawarehouseDatabaseRestorePoint() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a datawarehouse database restore point. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsADatawarehouseDatabaseRestorePoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsGet.json + // this example is just showing the usage of "RestorePoints_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testserver"; + string databaseName = "testDatabase"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SqlServerDatabaseRestorePointResource + SqlServerDatabaseRestorePointCollection collection = sqlDatabase.GetSqlServerDatabaseRestorePoints(); + + // invoke the operation + string restorePointName = "131546477590000000"; + NullableResponse response = await collection.GetIfExistsAsync(restorePointName); + SqlServerDatabaseRestorePointResource 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 + SqlServerDatabaseRestorePointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDevOpsAuditingSettingCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDevOpsAuditingSettingCollection.cs index 6969461b8bb2..2d1f8f236eda 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDevOpsAuditingSettingCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDevOpsAuditingSettingCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAServerSDevOpsAuditSettings() Console.WriteLine($"Succeeded: {result}"); } + // Get a server's DevOps audit settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerSDevOpsAuditSettings() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditGet.json + // this example is just showing the usage of "ServerDevOpsAuditSettings_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "devAuditTestRG"; + string serverName = "devOpsAuditTestSvr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerDevOpsAuditingSettingResource + SqlServerDevOpsAuditingSettingCollection collection = sqlServer.GetSqlServerDevOpsAuditingSettings(); + + // invoke the operation + string devOpsAuditingSettingsName = "Default"; + NullableResponse response = await collection.GetIfExistsAsync(devOpsAuditingSettingsName); + SqlServerDevOpsAuditingSettingResource 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 + SqlServerDevOpsAuditingSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a server's DevOps audit settings with all params [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDnsAliasCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDnsAliasCollection.cs index 4e3668866d19..e477f46b57d7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDnsAliasCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerDnsAliasCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetServerDNSAlias() Console.WriteLine($"Succeeded: {result}"); } + // Get server DNS alias + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetServerDNSAlias() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasGet.json + // this example is just showing the usage of "ServerDnsAliases_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "dns-alias-server"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerDnsAliasResource + SqlServerDnsAliasCollection collection = sqlServer.GetSqlServerDnsAliases(); + + // invoke the operation + string dnsAliasName = "dns-alias-name-1"; + NullableResponse response = await collection.GetIfExistsAsync(dnsAliasName); + SqlServerDnsAliasResource 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 + SqlServerDnsAliasData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create server DNS alias [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobAgentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobAgentCollection.cs index acf61c33b6a2..2b48a83c477e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobAgentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobAgentCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_GetAJobAgent() Console.WriteLine($"Succeeded: {result}"); } + // Get a job agent + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAJobAgent() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobAgent.json + // this example is just showing the usage of "JobAgents_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerJobAgentResource + SqlServerJobAgentCollection collection = sqlServer.GetSqlServerJobAgents(); + + // invoke the operation + string jobAgentName = "agent1"; + NullableResponse response = await collection.GetIfExistsAsync(jobAgentName); + SqlServerJobAgentResource 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 + SqlServerJobAgentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a job agent [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobCollection.cs index cc8ea7364bc9..3b53fbae0b5c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_GetAJob() Console.WriteLine($"Succeeded: {result}"); } + // Get a job + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAJob() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJob.json + // this example is just showing the usage of "Jobs_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 SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this SqlServerJobResource + SqlServerJobCollection collection = sqlServerJobAgent.GetSqlServerJobs(); + + // invoke the operation + string jobName = "job1"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + SqlServerJobResource 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 + SqlServerJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a job with all properties specified [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobCredentialCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobCredentialCollection.cs index e01b9a428b80..d5bda58298b6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobCredentialCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobCredentialCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_GetACredential() Console.WriteLine($"Succeeded: {result}"); } + // Get a credential + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACredential() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobCredential.json + // this example is just showing the usage of "JobCredentials_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 SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this SqlServerJobCredentialResource + SqlServerJobCredentialCollection collection = sqlServerJobAgent.GetSqlServerJobCredentials(); + + // invoke the operation + string credentialName = "cred1"; + NullableResponse response = await collection.GetIfExistsAsync(credentialName); + SqlServerJobCredentialResource 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 + SqlServerJobCredentialData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a credential [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionCollection.cs index 544e06819474..d2c571fa53fc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionCollection.cs @@ -128,6 +128,51 @@ public async Task Exists_GetAJobExecution() Console.WriteLine($"Succeeded: {result}"); } + // Get a job execution. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAJobExecution() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecution.json + // this example is just showing the usage of "JobExecutions_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 SqlServerJobResource created on azure + // for more information of creating SqlServerJobResource, please refer to the document of SqlServerJobResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string jobName = "job1"; + ResourceIdentifier sqlServerJobResourceId = SqlServerJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, jobName); + SqlServerJobResource sqlServerJob = client.GetSqlServerJobResource(sqlServerJobResourceId); + + // get the collection of this SqlServerJobExecutionResource + SqlServerJobExecutionCollection collection = sqlServerJob.GetSqlServerJobExecutions(); + + // invoke the operation + Guid jobExecutionId = Guid.Parse("5A86BF65-43AC-F258-2524-9E92992F97CA"); + NullableResponse response = await collection.GetIfExistsAsync(jobExecutionId); + SqlServerJobExecutionResource 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 + SqlServerJobExecutionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create job execution. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionStepCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionStepCollection.cs index 42a8726031f0..f72d070e0629 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionStepCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionStepCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -129,5 +130,51 @@ public async Task Exists_GetAJobStepExecution() Console.WriteLine($"Succeeded: {result}"); } + + // Get a job step execution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAJobStepExecution() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionStep.json + // this example is just showing the usage of "JobStepExecutions_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 SqlServerJobExecutionResource created on azure + // for more information of creating SqlServerJobExecutionResource, please refer to the document of SqlServerJobExecutionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string jobName = "job1"; + Guid jobExecutionId = Guid.Parse("5A86BF65-43AC-F258-2524-9E92992F97CA"); + ResourceIdentifier sqlServerJobExecutionResourceId = SqlServerJobExecutionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + SqlServerJobExecutionResource sqlServerJobExecution = client.GetSqlServerJobExecutionResource(sqlServerJobExecutionResourceId); + + // get the collection of this SqlServerJobExecutionStepResource + SqlServerJobExecutionStepCollection collection = sqlServerJobExecution.GetSqlServerJobExecutionSteps(); + + // invoke the operation + string stepName = "step1"; + NullableResponse response = await collection.GetIfExistsAsync(stepName); + SqlServerJobExecutionStepResource 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 + SqlServerJobExecutionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionStepTargetCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionStepTargetCollection.cs index 5183fee4613b..34897cd67b33 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionStepTargetCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobExecutionStepTargetCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -132,5 +133,52 @@ public async Task Exists_GetAJobStepTargetExecution() Console.WriteLine($"Succeeded: {result}"); } + + // Get a job step target execution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAJobStepTargetExecution() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionTarget.json + // this example is just showing the usage of "JobTargetExecutions_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 SqlServerJobExecutionStepResource created on azure + // for more information of creating SqlServerJobExecutionStepResource, please refer to the document of SqlServerJobExecutionStepResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string jobName = "job1"; + Guid jobExecutionId = Guid.Parse("5A86BF65-43AC-F258-2524-9E92992F97CA"); + string stepName = "step1"; + ResourceIdentifier sqlServerJobExecutionStepResourceId = SqlServerJobExecutionStepResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName); + SqlServerJobExecutionStepResource sqlServerJobExecutionStep = client.GetSqlServerJobExecutionStepResource(sqlServerJobExecutionStepResourceId); + + // get the collection of this SqlServerJobExecutionStepTargetResource + SqlServerJobExecutionStepTargetCollection collection = sqlServerJobExecutionStep.GetSqlServerJobExecutionStepTargets(); + + // invoke the operation + Guid targetId = Guid.Parse("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); + NullableResponse response = await collection.GetIfExistsAsync(targetId); + SqlServerJobExecutionStepTargetResource 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 + SqlServerJobExecutionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobStepCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobStepCollection.cs index 30a3211883c4..929286d3be83 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobStepCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobStepCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_GetTheLatestVersionOfAJobStep() Console.WriteLine($"Succeeded: {result}"); } + // Get the latest version of a job step. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheLatestVersionOfAJobStep() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByJob.json + // this example is just showing the usage of "JobSteps_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 SqlServerJobResource created on azure + // for more information of creating SqlServerJobResource, please refer to the document of SqlServerJobResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string jobName = "job1"; + ResourceIdentifier sqlServerJobResourceId = SqlServerJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, jobName); + SqlServerJobResource sqlServerJob = client.GetSqlServerJobResource(sqlServerJobResourceId); + + // get the collection of this SqlServerJobStepResource + SqlServerJobStepCollection collection = sqlServerJob.GetSqlServerJobSteps(); + + // invoke the operation + string stepName = "step1"; + NullableResponse response = await collection.GetIfExistsAsync(stepName); + SqlServerJobStepResource 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 + SqlServerJobStepData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a job step with all properties specified. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobTargetGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobTargetGroupCollection.cs index 35971f37fb13..c83df5e4d5a5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobTargetGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobTargetGroupCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetATargetGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get a target group. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetATargetGroup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobTargetGroup.json + // this example is just showing the usage of "JobTargetGroups_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 SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this SqlServerJobTargetGroupResource + SqlServerJobTargetGroupCollection collection = sqlServerJobAgent.GetSqlServerJobTargetGroups(); + + // invoke the operation + string targetGroupName = "targetGroup1"; + NullableResponse response = await collection.GetIfExistsAsync(targetGroupName); + SqlServerJobTargetGroupResource 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 + SqlServerJobTargetGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a target group with all properties. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobVersionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobVersionCollection.cs index 75439c5557c7..2db7e3303c45 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobVersionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobVersionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -124,5 +125,50 @@ public async Task Exists_GetAVersionOfAJob() Console.WriteLine($"Succeeded: {result}"); } + + // Get a version of a job. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVersionOfAJob() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobVersion.json + // this example is just showing the usage of "JobVersions_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 SqlServerJobResource created on azure + // for more information of creating SqlServerJobResource, please refer to the document of SqlServerJobResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string jobName = "job1"; + ResourceIdentifier sqlServerJobResourceId = SqlServerJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, jobName); + SqlServerJobResource sqlServerJob = client.GetSqlServerJobResource(sqlServerJobResourceId); + + // get the collection of this SqlServerJobVersionResource + SqlServerJobVersionCollection collection = sqlServerJob.GetSqlServerJobVersions(); + + // invoke the operation + int jobVersion = 1; + NullableResponse response = await collection.GetIfExistsAsync(jobVersion); + SqlServerJobVersionResource 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 + SqlServerJobVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobVersionStepCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobVersionStepCollection.cs index a6ef285232ce..3d8798f92083 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobVersionStepCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerJobVersionStepCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -127,5 +128,51 @@ public async Task Exists_GetTheSpecifiedVersionOfAJobStep() Console.WriteLine($"Succeeded: {result}"); } + + // Get the specified version of a job step. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheSpecifiedVersionOfAJobStep() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByVersion.json + // this example is just showing the usage of "JobSteps_GetByVersion" 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 SqlServerJobVersionResource created on azure + // for more information of creating SqlServerJobVersionResource, please refer to the document of SqlServerJobVersionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string jobName = "job1"; + int jobVersion = 1; + ResourceIdentifier sqlServerJobVersionResourceId = SqlServerJobVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, jobName, jobVersion); + SqlServerJobVersionResource sqlServerJobVersion = client.GetSqlServerJobVersionResource(sqlServerJobVersionResourceId); + + // get the collection of this SqlServerJobVersionStepResource + SqlServerJobVersionStepCollection collection = sqlServerJobVersion.GetSqlServerJobVersionSteps(); + + // invoke the operation + string stepName = "step1"; + NullableResponse response = await collection.GetIfExistsAsync(stepName); + SqlServerJobVersionStepResource 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 + SqlServerJobStepData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerKeyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerKeyCollection.cs index a3211bf5398f..e1735fc059f7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerKeyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerKeyCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetTheServerKey() Console.WriteLine($"Succeeded: {result}"); } + // Get the server key + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheServerKey() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyGet.json + // this example is just showing the usage of "ServerKeys_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + string serverName = "sqlcrudtest-4645"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerKeyResource + SqlServerKeyCollection collection = sqlServer.GetSqlServerKeys(); + + // invoke the operation + string keyName = "someVault_someKey_01234567890123456789012345678901"; + NullableResponse response = await collection.GetIfExistsAsync(keyName); + SqlServerKeyResource 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 + SqlServerKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a server key [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSecurityAlertPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSecurityAlertPolicyCollection.cs index 7928bd96ba31..a83c36d9429e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSecurityAlertPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSecurityAlertPolicyCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAServerSThreatDetectionPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get a server's threat detection policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerSThreatDetectionPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsGet.json + // this example is just showing the usage of "ServerSecurityAlertPolicies_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "securityalert-4799"; + string serverName = "securityalert-6440"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerSecurityAlertPolicyResource + SqlServerSecurityAlertPolicyCollection collection = sqlServer.GetSqlServerSecurityAlertPolicies(); + + // invoke the operation + SqlSecurityAlertPolicyName securityAlertPolicyName = SqlSecurityAlertPolicyName.Default; + NullableResponse response = await collection.GetIfExistsAsync(securityAlertPolicyName); + SqlServerSecurityAlertPolicyResource 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 + SqlServerSecurityAlertPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update a server's threat detection policy with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentBaselineCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentBaselineCollection.cs index 26b89929ccd3..b2c3ce75f300 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentBaselineCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentBaselineCollection.cs @@ -125,6 +125,50 @@ public async Task Exists_GetsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBasel Console.WriteLine($"Succeeded: {result}"); } + // Gets a list of database's sql vulnerability assessment rule baselines. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/SqlVulnerabilityAssessmentBaselineGet.json + // this example is just showing the usage of "SqlVulnerabilityAssessmentBaseline_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 SqlServerSqlVulnerabilityAssessmentResource created on azure + // for more information of creating SqlServerSqlVulnerabilityAssessmentResource, please refer to the document of SqlServerSqlVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4711"; + string serverName = "vulnerabilityaseessmenttest-6411"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + ResourceIdentifier sqlServerSqlVulnerabilityAssessmentResourceId = SqlServerSqlVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, vulnerabilityAssessmentName); + SqlServerSqlVulnerabilityAssessmentResource sqlServerSqlVulnerabilityAssessment = client.GetSqlServerSqlVulnerabilityAssessmentResource(sqlServerSqlVulnerabilityAssessmentResourceId); + + // get the collection of this SqlServerSqlVulnerabilityAssessmentBaselineResource + SqlServerSqlVulnerabilityAssessmentBaselineCollection collection = sqlServerSqlVulnerabilityAssessment.GetSqlServerSqlVulnerabilityAssessmentBaselines(); + + // invoke the operation + SqlVulnerabilityAssessmentBaselineName baselineName = SqlVulnerabilityAssessmentBaselineName.Default; + NullableResponse response = await collection.GetIfExistsAsync(baselineName); + SqlServerSqlVulnerabilityAssessmentBaselineResource 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 + SqlVulnerabilityAssessmentBaselineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Add a database's vulnerability assessment rule baseline from the latest scan result. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.cs index 2b96b8f6d7c4..d064745a6d7a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.cs @@ -127,6 +127,51 @@ public async Task Exists_GetsASystemDatabaseSSqlVulnerabilityAssessmentRuleBasel Console.WriteLine($"Succeeded: {result}"); } + // Gets a system database's sql vulnerability assessment rule baseline. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsASystemDatabaseSSqlVulnerabilityAssessmentRuleBaseline() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineGet.json + // this example is just showing the usage of "SqlVulnerabilityAssessmentRuleBaseline_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 SqlServerSqlVulnerabilityAssessmentBaselineResource created on azure + // for more information of creating SqlServerSqlVulnerabilityAssessmentBaselineResource, please refer to the document of SqlServerSqlVulnerabilityAssessmentBaselineResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4711"; + string serverName = "vulnerabilityaseessmenttest-6411"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + SqlVulnerabilityAssessmentBaselineName baselineName = SqlVulnerabilityAssessmentBaselineName.Default; + ResourceIdentifier sqlServerSqlVulnerabilityAssessmentBaselineResourceId = SqlServerSqlVulnerabilityAssessmentBaselineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName); + SqlServerSqlVulnerabilityAssessmentBaselineResource sqlServerSqlVulnerabilityAssessmentBaseline = client.GetSqlServerSqlVulnerabilityAssessmentBaselineResource(sqlServerSqlVulnerabilityAssessmentBaselineResourceId); + + // get the collection of this SqlServerSqlVulnerabilityAssessmentBaselineRuleResource + SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection collection = sqlServerSqlVulnerabilityAssessmentBaseline.GetSqlServerSqlVulnerabilityAssessmentBaselineRules(); + + // invoke the operation + string ruleId = "VA1001"; + NullableResponse response = await collection.GetIfExistsAsync(ruleId); + SqlServerSqlVulnerabilityAssessmentBaselineRuleResource 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 + SqlVulnerabilityAssessmentBaselineRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a database's vulnerability assessment rule baseline. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentCollection.cs index b44511a292a5..e0da4d192a21 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetSQLVulnerabilityAssessmentPolicy() Console.WriteLine($"Succeeded: {result}"); } + // Get SQL Vulnerability Assessment policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSQLVulnerabilityAssessmentPolicy() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/SqlVulnerabilityAssessmentGet.json + // this example is just showing the usage of "SqlVulnerabilityAssessmentsSettings_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4799"; + string serverName = "vulnerabilityaseessmenttest-6440"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerSqlVulnerabilityAssessmentResource + SqlServerSqlVulnerabilityAssessmentCollection collection = sqlServer.GetSqlServerSqlVulnerabilityAssessments(); + + // invoke the operation + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + NullableResponse response = await collection.GetIfExistsAsync(vulnerabilityAssessmentName); + SqlServerSqlVulnerabilityAssessmentResource 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 + SqlVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a SQL Vulnerability Assessment policy [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentScanCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentScanCollection.cs index 1a4e0abc5bda..3ca6b1625ea2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentScanCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentScanCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -122,5 +123,49 @@ public async Task Exists_GetsTheADatabaseVulnerabilityAssessmentScanRecords() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the a database vulnerability assessment scan records + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheADatabaseVulnerabilityAssessmentScanRecords() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/SqlVulnerabilityAssessmentScan.json + // this example is just showing the usage of "SqlVulnerabilityAssessmentScans_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 SqlServerSqlVulnerabilityAssessmentResource created on azure + // for more information of creating SqlServerSqlVulnerabilityAssessmentResource, please refer to the document of SqlServerSqlVulnerabilityAssessmentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityassessmenttest-4711"; + string serverName = "vulnerabilityassessmenttest-6411"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + ResourceIdentifier sqlServerSqlVulnerabilityAssessmentResourceId = SqlServerSqlVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, vulnerabilityAssessmentName); + SqlServerSqlVulnerabilityAssessmentResource sqlServerSqlVulnerabilityAssessment = client.GetSqlServerSqlVulnerabilityAssessmentResource(sqlServerSqlVulnerabilityAssessmentResourceId); + + // get the collection of this SqlServerSqlVulnerabilityAssessmentScanResource + SqlServerSqlVulnerabilityAssessmentScanCollection collection = sqlServerSqlVulnerabilityAssessment.GetSqlServerSqlVulnerabilityAssessmentScans(); + + // invoke the operation + string scanId = "scan001"; + NullableResponse response = await collection.GetIfExistsAsync(scanId); + SqlServerSqlVulnerabilityAssessmentScanResource 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 + SqlVulnerabilityAssessmentScanData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentScanResultCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentScanResultCollection.cs index cd6ba6e19368..29e4858a7cea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentScanResultCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerSqlVulnerabilityAssessmentScanResultCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -125,5 +126,50 @@ public async Task Exists_GetASystemDatabaseSQLVulnerabilityAssessmentScanResultF Console.WriteLine($"Succeeded: {result}"); } + + // Get a system database SQL Vulnerability Assessment scan result for scan id and scan result id + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASystemDatabaseSQLVulnerabilityAssessmentScanResultForScanIdAndScanResultId() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/SqlVulnerabilityAssessmentScansResults.json + // this example is just showing the usage of "SqlVulnerabilityAssessmentScanResult_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 SqlServerSqlVulnerabilityAssessmentScanResource created on azure + // for more information of creating SqlServerSqlVulnerabilityAssessmentScanResource, please refer to the document of SqlServerSqlVulnerabilityAssessmentScanResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityassessmenttest-4711"; + string serverName = "vulnerabilityassessmenttest-6411"; + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + string scanId = "scanId1"; + ResourceIdentifier sqlServerSqlVulnerabilityAssessmentScanResourceId = SqlServerSqlVulnerabilityAssessmentScanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, vulnerabilityAssessmentName, scanId); + SqlServerSqlVulnerabilityAssessmentScanResource sqlServerSqlVulnerabilityAssessmentScan = client.GetSqlServerSqlVulnerabilityAssessmentScanResource(sqlServerSqlVulnerabilityAssessmentScanResourceId); + + // get the collection of this SqlServerSqlVulnerabilityAssessmentScanResultResource + SqlServerSqlVulnerabilityAssessmentScanResultCollection collection = sqlServerSqlVulnerabilityAssessmentScan.GetSqlServerSqlVulnerabilityAssessmentScanResults(); + + // invoke the operation + string scanResultId = "VA1234"; + NullableResponse response = await collection.GetIfExistsAsync(scanResultId); + SqlServerSqlVulnerabilityAssessmentScanResultResource 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 + SqlVulnerabilityAssessmentScanResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerTrustGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerTrustGroupCollection.cs index b34b963edf30..d1a26ad20cbe 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerTrustGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerTrustGroupCollection.cs @@ -85,6 +85,49 @@ public async Task Exists_GetServerTrustGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get server trust group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetServerTrustGroup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupGet.json + // this example is just showing the usage of "ServerTrustGroups_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-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SqlServerTrustGroupResource + AzureLocation locationName = new AzureLocation("Japan East"); + SqlServerTrustGroupCollection collection = resourceGroupResource.GetSqlServerTrustGroups(locationName); + + // invoke the operation + string serverTrustGroupName = "server-trust-group-test"; + NullableResponse response = await collection.GetIfExistsAsync(serverTrustGroupName); + SqlServerTrustGroupResource 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 + SqlServerTrustGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create server trust group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerVirtualNetworkRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerVirtualNetworkRuleCollection.cs index 0421541f15c5..5c1900c29539 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerVirtualNetworkRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerVirtualNetworkRuleCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetsAVirtualNetworkRule() Console.WriteLine($"Succeeded: {result}"); } + // Gets a virtual network rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAVirtualNetworkRule() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesGet.json + // this example is just showing the usage of "VirtualNetworkRules_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default"; + string serverName = "vnet-test-svr"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerVirtualNetworkRuleResource + SqlServerVirtualNetworkRuleCollection collection = sqlServer.GetSqlServerVirtualNetworkRules(); + + // invoke the operation + string virtualNetworkRuleName = "vnet-firewall-rule"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkRuleName); + SqlServerVirtualNetworkRuleResource 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 + SqlServerVirtualNetworkRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update a virtual network rule [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerVulnerabilityAssessmentCollection.cs index f3ef2fe925eb..1e359ae98fbb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlServerVulnerabilityAssessmentCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetAServerSVulnerabilityAssessment() Console.WriteLine($"Succeeded: {result}"); } + // Get a server's vulnerability assessment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAServerSVulnerabilityAssessment() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentGet.json + // this example is just showing the usage of "ServerVulnerabilityAssessments_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "vulnerabilityaseessmenttest-4799"; + string serverName = "vulnerabilityaseessmenttest-6440"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SqlServerVulnerabilityAssessmentResource + SqlServerVulnerabilityAssessmentCollection collection = sqlServer.GetSqlServerVulnerabilityAssessments(); + + // invoke the operation + VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default; + NullableResponse response = await collection.GetIfExistsAsync(vulnerabilityAssessmentName); + SqlServerVulnerabilityAssessmentResource 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 + SqlServerVulnerabilityAssessmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a server's vulnerability assessment with all parameters [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlTimeZoneCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlTimeZoneCollection.cs index 93f4ad21cdf0..9d6e62559567 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlTimeZoneCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SqlTimeZoneCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_GetManagedInstanceTimeZone() Console.WriteLine($"Succeeded: {result}"); } + + // Get managed instance time zone + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetManagedInstanceTimeZone() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneGet.json + // this example is just showing the usage of "TimeZones_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "37d5e605-6142-4d79-b564-28b6dbfeec0f"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SqlTimeZoneResource + AzureLocation locationName = new AzureLocation("canadaeast"); + SqlTimeZoneCollection collection = subscriptionResource.GetSqlTimeZones(locationName); + + // invoke the operation + string timeZoneId = "Haiti Standard Time"; + NullableResponse response = await collection.GetIfExistsAsync(timeZoneId); + SqlTimeZoneResource 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 + SqlTimeZoneData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupCollection.cs index 2dad4babcd0e..f58bef73e408 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionBackupCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -85,6 +86,50 @@ public async Task Exists_GetTheLongTermRetentionBackup() Console.WriteLine($"Succeeded: {result}"); } + // Get the long term retention backup. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheLongTermRetentionBackup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json + // this example is just showing the usage of "LongTermRetentionBackups_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionLongTermRetentionBackupResource + AzureLocation locationName = new AzureLocation("japaneast"); + string longTermRetentionServerName = "testserver"; + string longTermRetentionDatabaseName = "testDatabase"; + SubscriptionLongTermRetentionBackupCollection collection = subscriptionResource.GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + + // invoke the operation + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + SubscriptionLongTermRetentionBackupResource 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 + LongTermRetentionBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get all long term retention backups under the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionManagedInstanceBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionManagedInstanceBackupCollection.cs index 6544400a0505..b553f5b2087f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionManagedInstanceBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionLongTermRetentionManagedInstanceBackupCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -85,6 +86,50 @@ public async Task Exists_GetTheLongTermRetentionBackupOfAManagedDatabase() Console.WriteLine($"Succeeded: {result}"); } + // Get the long term retention backup of a managed database. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheLongTermRetentionBackupOfAManagedDatabase() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupGet.json + // this example is just showing the usage of "LongTermRetentionManagedInstanceBackups_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionLongTermRetentionManagedInstanceBackupResource + AzureLocation locationName = new AzureLocation("japaneast"); + string managedInstanceName = "testInstance"; + string databaseName = "testDatabase"; + SubscriptionLongTermRetentionManagedInstanceBackupCollection collection = subscriptionResource.GetSubscriptionLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName); + + // invoke the operation + string backupName = "55555555-6666-7777-8888-999999999999;131637960820000000"; + NullableResponse response = await collection.GetIfExistsAsync(backupName); + SubscriptionLongTermRetentionManagedInstanceBackupResource 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 + ManagedInstanceLongTermRetentionBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get all long term retention backups under the database. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionUsageCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionUsageCollection.cs index e335a524506e..2adfe4b7086d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionUsageCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionUsageCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_GetSpecificSubscriptionUsageInTheGivenLocation() Console.WriteLine($"Succeeded: {result}"); } + + // Get specific subscription usage in the given location. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSpecificSubscriptionUsageInTheGivenLocation() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageGet.json + // this example is just showing the usage of "SubscriptionUsages_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionUsageResource + AzureLocation locationName = new AzureLocation("WestUS"); + SubscriptionUsageCollection collection = subscriptionResource.GetSubscriptionUsages(locationName); + + // invoke the operation + string usageName = "ServerQuota"; + NullableResponse response = await collection.GetIfExistsAsync(usageName); + SubscriptionUsageResource 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 + SubscriptionUsageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncAgentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncAgentCollection.cs index b5b8e40070f3..62808d6b8df3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncAgentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncAgentCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetASyncAgent() Console.WriteLine($"Succeeded: {result}"); } + // Get a sync agent + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASyncAgent() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGet.json + // this example is just showing the usage of "SyncAgents_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 SqlServerResource created on azure + // for more information of creating SqlServerResource, please refer to the document of SqlServerResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "syncagentcrud-65440"; + string serverName = "syncagentcrud-8475"; + ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId); + + // get the collection of this SyncAgentResource + SyncAgentCollection collection = sqlServer.GetSyncAgents(); + + // invoke the operation + string syncAgentName = "syncagentcrud-3187"; + NullableResponse response = await collection.GetIfExistsAsync(syncAgentName); + SyncAgentResource 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 + SyncAgentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a new sync agent [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncGroupCollection.cs index ef56667972ef..52a5470aa4a7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncGroupCollection.cs @@ -86,6 +86,50 @@ public async Task Exists_GetASyncGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get a sync group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASyncGroup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGet.json + // this example is just showing the usage of "SyncGroups_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "syncgroupcrud-65440"; + string serverName = "syncgroupcrud-8475"; + string databaseName = "syncgroupcrud-4328"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this SyncGroupResource + SyncGroupCollection collection = sqlDatabase.GetSyncGroups(); + + // invoke the operation + string syncGroupName = "syncgroupcrud-3187"; + NullableResponse response = await collection.GetIfExistsAsync(syncGroupName); + SyncGroupResource 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 + SyncGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a sync group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncMemberCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncMemberCollection.cs index 249aee0032f4..49f491d965c7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncMemberCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SyncMemberCollection.cs @@ -88,6 +88,51 @@ public async Task Exists_GetASyncMember() Console.WriteLine($"Succeeded: {result}"); } + // Get a sync member + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASyncMember() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGet.json + // this example is just showing the usage of "SyncMembers_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 SyncGroupResource created on azure + // for more information of creating SyncGroupResource, please refer to the document of SyncGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "syncgroupcrud-65440"; + string serverName = "syncgroupcrud-8475"; + string databaseName = "syncgroupcrud-4328"; + string syncGroupName = "syncgroupcrud-3187"; + ResourceIdentifier syncGroupResourceId = SyncGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, syncGroupName); + SyncGroupResource syncGroup = client.GetSyncGroupResource(syncGroupResourceId); + + // get the collection of this SyncMemberResource + SyncMemberCollection collection = syncGroup.GetSyncMembers(); + + // invoke the operation + string syncMemberName = "syncmembercrud-4879"; + NullableResponse response = await collection.GetIfExistsAsync(syncMemberName); + SyncMemberResource 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 + SyncMemberData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a new sync member [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_VirtualClusterCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_VirtualClusterCollection.cs index b6f46ea4475e..c920983e91fa 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_VirtualClusterCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_VirtualClusterCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_GetsAVirtualCluster() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a virtual cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAVirtualCluster() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterGet.json + // this example is just showing the usage of "VirtualClusters_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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualClusterResource + VirtualClusterCollection collection = resourceGroupResource.GetVirtualClusters(); + + // invoke the operation + string virtualClusterName = "vc-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"; + NullableResponse response = await collection.GetIfExistsAsync(virtualClusterName); + VirtualClusterResource 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 + VirtualClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_WorkloadClassifierCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_WorkloadClassifierCollection.cs index 7d9ecaa89119..b5e2d917ad67 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_WorkloadClassifierCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_WorkloadClassifierCollection.cs @@ -87,6 +87,51 @@ public async Task Exists_GetsAWorkloadClassifierForADataWarehouse() Console.WriteLine($"Succeeded: {result}"); } + // Gets a workload classifier for a data warehouse + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAWorkloadClassifierForADataWarehouse() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifier.json + // this example is just showing the usage of "WorkloadClassifiers_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 WorkloadGroupResource created on azure + // for more information of creating WorkloadGroupResource, please refer to the document of WorkloadGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + string databaseName = "testdb"; + string workloadGroupName = "wlm_workloadgroup"; + ResourceIdentifier workloadGroupResourceId = WorkloadGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, workloadGroupName); + WorkloadGroupResource workloadGroup = client.GetWorkloadGroupResource(workloadGroupResourceId); + + // get the collection of this WorkloadClassifierResource + WorkloadClassifierCollection collection = workloadGroup.GetWorkloadClassifiers(); + + // invoke the operation + string workloadClassifierName = "wlm_classifier"; + NullableResponse response = await collection.GetIfExistsAsync(workloadClassifierName); + WorkloadClassifierResource 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 + WorkloadClassifierData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a workload group with all properties specified. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_WorkloadGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_WorkloadGroupCollection.cs index 4399669aed98..30687984a6bd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_WorkloadGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_WorkloadGroupCollection.cs @@ -85,6 +85,50 @@ public async Task Exists_GetsAWorkloadGroupForADataWarehouse() Console.WriteLine($"Succeeded: {result}"); } + // Gets a workload group for a data warehouse + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAWorkloadGroupForADataWarehouse() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroup.json + // this example is just showing the usage of "WorkloadGroups_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 SqlDatabaseResource created on azure + // for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "Default-SQL-SouthEastAsia"; + string serverName = "testsvr"; + string databaseName = "testdb"; + ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName); + SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId); + + // get the collection of this WorkloadGroupResource + WorkloadGroupCollection collection = sqlDatabase.GetWorkloadGroups(); + + // invoke the operation + string workloadGroupName = "smallrc"; + NullableResponse response = await collection.GetIfExistsAsync(workloadGroupName); + WorkloadGroupResource 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 + WorkloadGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create a workload group with all properties specified. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPolicyCollection.cs index a90a83be0b9f..d541ab9fc1e9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(ShortTermRetentionPolicyName policyName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// BackupShortTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. Should always be "default". + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(ShortTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _backupShortTermRetentionPolicyClientDiagnostics.CreateScope("BackupShortTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _backupShortTermRetentionPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupShortTermRetentionPolicyResource(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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// BackupShortTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. Should always be "default". + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(ShortTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _backupShortTermRetentionPolicyClientDiagnostics.CreateScope("BackupShortTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _backupShortTermRetentionPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BackupShortTermRetentionPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivityCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivityCollection.cs index a1f35899db90..f345f8fff47c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivityCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivityCollection.cs @@ -226,6 +226,72 @@ public virtual Response Exists(DataWarehouseUserActivityName dataWarehouse } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName} + /// + /// + /// Operation Id + /// DataWarehouseUserActivities_Get + /// + /// + /// + /// The activity name of the data warehouse. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default) + { + using var scope = _dataWarehouseUserActivityClientDiagnostics.CreateScope("DataWarehouseUserActivityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataWarehouseUserActivityRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataWarehouseUserActivityName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataWarehouseUserActivityResource(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.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName} + /// + /// + /// Operation Id + /// DataWarehouseUserActivities_Get + /// + /// + /// + /// The activity name of the data warehouse. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default) + { + using var scope = _dataWarehouseUserActivityClientDiagnostics.CreateScope("DataWarehouseUserActivityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataWarehouseUserActivityRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataWarehouseUserActivityName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataWarehouseUserActivityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvancedThreatProtectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvancedThreatProtectionCollection.cs index fe40cda943b7..3759abb3d6a1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvancedThreatProtectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvancedThreatProtectionCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(AdvancedThreatProtectionName advancedThreat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName} + /// + /// + /// Operation Id + /// DatabaseAdvancedThreatProtectionSettings_Get + /// + /// + /// + /// The name of the Advanced Threat Protection state. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AdvancedThreatProtectionName advancedThreatProtectionName, CancellationToken cancellationToken = default) + { + using var scope = _databaseAdvancedThreatProtectionDatabaseAdvancedThreatProtectionSettingsClientDiagnostics.CreateScope("DatabaseAdvancedThreatProtectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseAdvancedThreatProtectionDatabaseAdvancedThreatProtectionSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advancedThreatProtectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseAdvancedThreatProtectionResource(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.Sql/servers/{serverName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName} + /// + /// + /// Operation Id + /// DatabaseAdvancedThreatProtectionSettings_Get + /// + /// + /// + /// The name of the Advanced Threat Protection state. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AdvancedThreatProtectionName advancedThreatProtectionName, CancellationToken cancellationToken = default) + { + using var scope = _databaseAdvancedThreatProtectionDatabaseAdvancedThreatProtectionSettingsClientDiagnostics.CreateScope("DatabaseAdvancedThreatProtectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseAdvancedThreatProtectionDatabaseAdvancedThreatProtectionSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advancedThreatProtectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseAdvancedThreatProtectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServerCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServerCollection.cs index b5d9f16c314f..64437b08e6ef 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServerCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServerCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string deletedServerName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName} + /// + /// + /// Operation Id + /// DeletedServers_Get + /// + /// + /// + /// The name of the deleted server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deletedServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deletedServerName, nameof(deletedServerName)); + + using var scope = _deletedServerClientDiagnostics.CreateScope("DeletedServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _deletedServerRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_locationName), deletedServerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedServerResource(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}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName} + /// + /// + /// Operation Id + /// DeletedServers_Get + /// + /// + /// + /// The name of the deleted server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deletedServerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deletedServerName, nameof(deletedServerName)); + + using var scope = _deletedServerClientDiagnostics.CreateScope("DeletedServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _deletedServerRestClient.Get(Id.SubscriptionId, new AzureLocation(_locationName), deletedServerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DeletedServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs index 65ce5489d901..728d36bb4dd5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string distributedAvailabilityGroupName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// + /// + /// Operation Id + /// DistributedAvailabilityGroups_Get + /// + /// + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroupResource(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.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// + /// + /// Operation Id + /// DistributedAvailabilityGroups_Get + /// + /// + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, distributedAvailabilityGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DistributedAvailabilityGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs index 097e7709211e..2b1d98469ef1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string elasticPoolName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName} + /// + /// + /// Operation Id + /// ElasticPools_Get + /// + /// + /// + /// The name of the elastic pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string elasticPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(elasticPoolName, nameof(elasticPoolName)); + + using var scope = _elasticPoolClientDiagnostics.CreateScope("ElasticPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _elasticPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, elasticPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticPoolResource(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.Sql/servers/{serverName}/elasticPools/{elasticPoolName} + /// + /// + /// Operation Id + /// ElasticPools_Get + /// + /// + /// + /// The name of the elastic pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string elasticPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(elasticPoolName, nameof(elasticPoolName)); + + using var scope = _elasticPoolClientDiagnostics.CreateScope("ElasticPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _elasticPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, elasticPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorCollection.cs index 56161877fac7..e708bffc718d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(EncryptionProtectorName encryptionProtector } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName} + /// + /// + /// Operation Id + /// EncryptionProtectors_Get + /// + /// + /// + /// The name of the encryption protector to be retrieved. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + { + using var scope = _encryptionProtectorClientDiagnostics.CreateScope("EncryptionProtectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _encryptionProtectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionProtectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EncryptionProtectorResource(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.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName} + /// + /// + /// Operation Id + /// EncryptionProtectors_Get + /// + /// + /// + /// The name of the encryption protector to be retrieved. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + { + using var scope = _encryptionProtectorClientDiagnostics.CreateScope("EncryptionProtectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _encryptionProtectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionProtectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EncryptionProtectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateCollection.cs index b098b415779e..201970aef685 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string endpointType, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// + /// + /// Operation Id + /// EndpointCertificates_Get + /// + /// + /// + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string endpointType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _endpointCertificateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointType, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EndpointCertificateResource(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.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType} + /// + /// + /// Operation Id + /// EndpointCertificates_Get + /// + /// + /// + /// Type of the endpoint whose certificate the customer is looking for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string endpointType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(endpointType, nameof(endpointType)); + + using var scope = _endpointCertificateClientDiagnostics.CreateScope("EndpointCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _endpointCertificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointType, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EndpointCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyCollection.cs index 1d56d45030fd..5064530ec8b5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(BlobAuditingPolicyName blobAuditingPolicyNa } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// ExtendedDatabaseBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _extendedDatabaseBlobAuditingPolicyClientDiagnostics.CreateScope("ExtendedDatabaseBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _extendedDatabaseBlobAuditingPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExtendedDatabaseBlobAuditingPolicyResource(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.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// ExtendedDatabaseBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _extendedDatabaseBlobAuditingPolicyClientDiagnostics.CreateScope("ExtendedDatabaseBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _extendedDatabaseBlobAuditingPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExtendedDatabaseBlobAuditingPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyCollection.cs index 123051f1f0e9..afdb41f5d1ff 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(BlobAuditingPolicyName blobAuditingPolicyNa } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// ExtendedServerBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _extendedServerBlobAuditingPolicyClientDiagnostics.CreateScope("ExtendedServerBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _extendedServerBlobAuditingPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExtendedServerBlobAuditingPolicyResource(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.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// ExtendedServerBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _extendedServerBlobAuditingPolicyClientDiagnostics.CreateScope("ExtendedServerBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _extendedServerBlobAuditingPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ExtendedServerBlobAuditingPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupCollection.cs index 46092100e5a9..915a173f88fd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string failoverGroupName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName} + /// + /// + /// Operation Id + /// FailoverGroups_Get + /// + /// + /// + /// The name of the failover group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string failoverGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(failoverGroupName, nameof(failoverGroupName)); + + using var scope = _failoverGroupClientDiagnostics.CreateScope("FailoverGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _failoverGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, failoverGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FailoverGroupResource(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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName} + /// + /// + /// Operation Id + /// FailoverGroups_Get + /// + /// + /// + /// The name of the failover group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string failoverGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(failoverGroupName, nameof(failoverGroupName)); + + using var scope = _failoverGroupClientDiagnostics.CreateScope("FailoverGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _failoverGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, failoverGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FailoverGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/GeoBackupPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/GeoBackupPolicyCollection.cs index f5f1137fcdf6..582215646977 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/GeoBackupPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/GeoBackupPolicyCollection.cs @@ -302,6 +302,72 @@ public virtual Response Exists(GeoBackupPolicyName geoBackupPolicyName, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName} + /// + /// + /// Operation Id + /// GeoBackupPolicies_Get + /// + /// + /// + /// The name of the geo backup policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(GeoBackupPolicyName geoBackupPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _geoBackupPolicyClientDiagnostics.CreateScope("GeoBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _geoBackupPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, geoBackupPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GeoBackupPolicyResource(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.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName} + /// + /// + /// Operation Id + /// GeoBackupPolicies_Get + /// + /// + /// + /// The name of the geo backup policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(GeoBackupPolicyName geoBackupPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _geoBackupPolicyClientDiagnostics.CreateScope("GeoBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _geoBackupPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, geoBackupPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GeoBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs index e6367d210a7d..42db8259c4be 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// IPv6FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _iPv6FirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRuleResource(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.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// IPv6FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _iPv6FirewallRuleClientDiagnostics.CreateScope("IPv6FirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _iPv6FirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IPv6FirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupCollection.cs index d7b5700ae955..c43c87faef18 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string failoverGroupName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} + /// + /// + /// Operation Id + /// InstanceFailoverGroups_Get + /// + /// + /// + /// The name of the failover group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string failoverGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(failoverGroupName, nameof(failoverGroupName)); + + using var scope = _instanceFailoverGroupClientDiagnostics.CreateScope("InstanceFailoverGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _instanceFailoverGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_locationName), failoverGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InstanceFailoverGroupResource(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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} + /// + /// + /// Operation Id + /// InstanceFailoverGroups_Get + /// + /// + /// + /// The name of the failover group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string failoverGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(failoverGroupName, nameof(failoverGroupName)); + + using var scope = _instanceFailoverGroupClientDiagnostics.CreateScope("InstanceFailoverGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _instanceFailoverGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_locationName), failoverGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InstanceFailoverGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolCollection.cs index d7a527f6a2a1..dcf7da2c18ed 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string instancePoolName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// + /// + /// Operation Id + /// InstancePools_Get + /// + /// + /// + /// The name of the instance pool to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string instancePoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancePoolName, nameof(instancePoolName)); + + using var scope = _instancePoolClientDiagnostics.CreateScope("InstancePoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _instancePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, instancePoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InstancePoolResource(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.Sql/instancePools/{instancePoolName} + /// + /// + /// Operation Id + /// InstancePools_Get + /// + /// + /// + /// The name of the instance pool to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string instancePoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancePoolName, nameof(instancePoolName)); + + using var scope = _instancePoolClientDiagnostics.CreateScope("InstancePoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _instancePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, instancePoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InstancePoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadCollection.cs index 9e0c8b2d98d3..b2162745dbf7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(LedgerDigestUploadsName ledgerDigestUploads } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads} + /// + /// + /// Operation Id + /// LedgerDigestUploads_Get + /// + /// + /// + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + using var scope = _ledgerDigestUploadClientDiagnostics.CreateScope("LedgerDigestUploadCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _ledgerDigestUploadRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ledgerDigestUploads, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LedgerDigestUploadResource(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.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads} + /// + /// + /// Operation Id + /// LedgerDigestUploads_Get + /// + /// + /// + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + using var scope = _ledgerDigestUploadClientDiagnostics.CreateScope("LedgerDigestUploadCollection.GetIfExists"); + scope.Start(); + try + { + var response = _ledgerDigestUploadRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ledgerDigestUploads, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LedgerDigestUploadResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LogicalDatabaseTransparentDataEncryptionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LogicalDatabaseTransparentDataEncryptionCollection.cs index 7a24e7f9450d..fdb9cc865566 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LogicalDatabaseTransparentDataEncryptionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LogicalDatabaseTransparentDataEncryptionCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(TransparentDataEncryptionName tdeName, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName} + /// + /// + /// Operation Id + /// TransparentDataEncryptions_Get + /// + /// + /// + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + using var scope = _logicalDatabaseTransparentDataEncryptionTransparentDataEncryptionsClientDiagnostics.CreateScope("LogicalDatabaseTransparentDataEncryptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _logicalDatabaseTransparentDataEncryptionTransparentDataEncryptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tdeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicalDatabaseTransparentDataEncryptionResource(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.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName} + /// + /// + /// Operation Id + /// TransparentDataEncryptions_Get + /// + /// + /// + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + using var scope = _logicalDatabaseTransparentDataEncryptionTransparentDataEncryptionsClientDiagnostics.CreateScope("LogicalDatabaseTransparentDataEncryptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _logicalDatabaseTransparentDataEncryptionTransparentDataEncryptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tdeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LogicalDatabaseTransparentDataEncryptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyCollection.cs index e6bf4a6b20ff..aa6df03585cf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(LongTermRetentionPolicyName policyName, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// LongTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. Should always be Default. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _longTermRetentionPolicyClientDiagnostics.CreateScope("LongTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _longTermRetentionPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LongTermRetentionPolicyResource(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.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// LongTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. Should always be Default. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _longTermRetentionPolicyClientDiagnostics.CreateScope("LongTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _longTermRetentionPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LongTermRetentionPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPolicyCollection.cs index 3dd878d71004..be999dd7471d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(ManagedShortTermRetentionPolicyName policyN } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// ManagedBackupShortTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(ManagedShortTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _managedBackupShortTermRetentionPolicyClientDiagnostics.CreateScope("ManagedBackupShortTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedBackupShortTermRetentionPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedBackupShortTermRetentionPolicyResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// ManagedBackupShortTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(ManagedShortTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _managedBackupShortTermRetentionPolicyClientDiagnostics.CreateScope("ManagedBackupShortTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedBackupShortTermRetentionPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedBackupShortTermRetentionPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseAdvancedThreatProtectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseAdvancedThreatProtectionCollection.cs index 0650c6a4d739..8806f9a7e6ff 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseAdvancedThreatProtectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseAdvancedThreatProtectionCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(AdvancedThreatProtectionName advancedThreat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName} + /// + /// + /// Operation Id + /// ManagedDatabaseAdvancedThreatProtectionSettings_Get + /// + /// + /// + /// The name of the Advanced Threat Protection state. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AdvancedThreatProtectionName advancedThreatProtectionName, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseAdvancedThreatProtectionManagedDatabaseAdvancedThreatProtectionSettingsClientDiagnostics.CreateScope("ManagedDatabaseAdvancedThreatProtectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseAdvancedThreatProtectionManagedDatabaseAdvancedThreatProtectionSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advancedThreatProtectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseAdvancedThreatProtectionResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName} + /// + /// + /// Operation Id + /// ManagedDatabaseAdvancedThreatProtectionSettings_Get + /// + /// + /// + /// The name of the Advanced Threat Protection state. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AdvancedThreatProtectionName advancedThreatProtectionName, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseAdvancedThreatProtectionManagedDatabaseAdvancedThreatProtectionSettingsClientDiagnostics.CreateScope("ManagedDatabaseAdvancedThreatProtectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseAdvancedThreatProtectionManagedDatabaseAdvancedThreatProtectionSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advancedThreatProtectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseAdvancedThreatProtectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseCollection.cs index 7b583a976255..9e91996b9f22 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName} + /// + /// + /// Operation Id + /// ManagedDatabases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _managedDatabaseClientDiagnostics.CreateScope("ManagedDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName} + /// + /// + /// Operation Id + /// ManagedDatabases_Get + /// + /// + /// + /// The name of the database. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _managedDatabaseClientDiagnostics.CreateScope("ManagedDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnCollection.cs index 741906a1c20c..951c3f81eeea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string columnName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName} + /// + /// + /// Operation Id + /// ManagedDatabaseColumns_Get + /// + /// + /// + /// The name of the column. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string columnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + + using var scope = _managedDatabaseColumnClientDiagnostics.CreateScope("ManagedDatabaseColumnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseColumnRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, columnName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseColumnResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName} + /// + /// + /// Operation Id + /// ManagedDatabaseColumns_Get + /// + /// + /// + /// The name of the column. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string columnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + + using var scope = _managedDatabaseColumnClientDiagnostics.CreateScope("ManagedDatabaseColumnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseColumnRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, columnName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseColumnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailCollection.cs index 07db8b8ed4c4..bfca87db1255 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailCollection.cs @@ -178,5 +178,71 @@ public virtual Response Exists(RestoreDetailsName restoreDetailsName, Canc throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails/{restoreDetailsName} + /// + /// + /// Operation Id + /// ManagedDatabaseRestoreDetails_Get + /// + /// + /// + /// The name of the restore details to retrieve. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(RestoreDetailsName restoreDetailsName, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseRestoreDetailClientDiagnostics.CreateScope("ManagedDatabaseRestoreDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseRestoreDetailRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, restoreDetailsName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseRestoreDetailResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails/{restoreDetailsName} + /// + /// + /// Operation Id + /// ManagedDatabaseRestoreDetails_Get + /// + /// + /// + /// The name of the restore details to retrieve. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(RestoreDetailsName restoreDetailsName, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseRestoreDetailClientDiagnostics.CreateScope("ManagedDatabaseRestoreDetailCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseRestoreDetailRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, restoreDetailsName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseRestoreDetailResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaCollection.cs index 1bfa68ebe411..c0096e193ccf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string schemaName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// ManagedDatabaseSchemas_Get + /// + /// + /// + /// The name of the schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _managedDatabaseSchemaClientDiagnostics.CreateScope("ManagedDatabaseSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseSchemaResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// ManagedDatabaseSchemas_Get + /// + /// + /// + /// The name of the schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _managedDatabaseSchemaClientDiagnostics.CreateScope("ManagedDatabaseSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPolicyCollection.cs index 7235f7d39345..7c2d7bd6dcbb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlSecurityAlertPolicyName securityAlertPol } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ManagedDatabaseSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseSecurityAlertPolicyClientDiagnostics.CreateScope("ManagedDatabaseSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseSecurityAlertPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseSecurityAlertPolicyResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ManagedDatabaseSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseSecurityAlertPolicyClientDiagnostics.CreateScope("ManagedDatabaseSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseSecurityAlertPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseSecurityAlertPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelCollection.cs index 95b89301bf16..2c7558e2fe09 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelCollection.cs @@ -254,5 +254,71 @@ public virtual Response Exists(SensitivityLabelSource sensitivityLabelSour throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource} + /// + /// + /// Operation Id + /// ManagedDatabaseSensitivityLabels_Get + /// + /// + /// + /// The source of the sensitivity label. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseSensitivityLabelClientDiagnostics.CreateScope("ManagedDatabaseSensitivityLabelCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseSensitivityLabelRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, sensitivityLabelSource, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseSensitivityLabelResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource} + /// + /// + /// Operation Id + /// ManagedDatabaseSensitivityLabels_Get + /// + /// + /// + /// The source of the sensitivity label. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseSensitivityLabelClientDiagnostics.CreateScope("ManagedDatabaseSensitivityLabelCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseSensitivityLabelRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, sensitivityLabelSource, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseSensitivityLabelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableCollection.cs index e04ea7b9bce4..3d53a7b8ba0d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string tableName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName} + /// + /// + /// Operation Id + /// ManagedDatabaseTables_Get + /// + /// + /// + /// The name of the table. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _managedDatabaseTableClientDiagnostics.CreateScope("ManagedDatabaseTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseTableRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseTableResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName} + /// + /// + /// Operation Id + /// ManagedDatabaseTables_Get + /// + /// + /// + /// The name of the table. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _managedDatabaseTableClientDiagnostics.CreateScope("ManagedDatabaseTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseTableRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseTableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentCollection.cs index aa98e83a8645..16279a10ec43 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(VulnerabilityAssessmentName vulnerabilityAs } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// ManagedDatabaseVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseVulnerabilityAssessmentClientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseVulnerabilityAssessmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseVulnerabilityAssessmentResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// ManagedDatabaseVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _managedDatabaseVulnerabilityAssessmentClientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseVulnerabilityAssessmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs index 20c95f86ebe2..cb3a9ea097a2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs @@ -282,5 +282,81 @@ public virtual Response Exists(string ruleId, VulnerabilityAssessmentPolic throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName} + /// + /// + /// Operation Id + /// ManagedDatabaseVulnerabilityAssessmentRuleBaselines_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _managedDatabaseVulnerabilityAssessmentRuleBaselineClientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseVulnerabilityAssessmentRuleBaselineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName} + /// + /// + /// Operation Id + /// ManagedDatabaseVulnerabilityAssessmentRuleBaselines_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _managedDatabaseVulnerabilityAssessmentRuleBaselineClientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseVulnerabilityAssessmentRuleBaselineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScanCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScanCollection.cs index 426e9af0ef6b..046ea2fa62eb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScanCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScanCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string scanId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// ManagedDatabaseVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _managedDatabaseVulnerabilityAssessmentScanClientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDatabaseVulnerabilityAssessmentScanRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseVulnerabilityAssessmentScanResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// ManagedDatabaseVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _managedDatabaseVulnerabilityAssessmentScanClientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDatabaseVulnerabilityAssessmentScanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDatabaseVulnerabilityAssessmentScanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorCollection.cs index 00efc8d01b27..060aa495f7b9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlAdministratorName administratorName, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName} + /// + /// + /// Operation Id + /// ManagedInstanceAdministrators_Get + /// + /// + /// + /// The SqlAdministratorName to use. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlAdministratorName administratorName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceAdministratorClientDiagnostics.CreateScope("ManagedInstanceAdministratorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceAdministratorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, administratorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceAdministratorResource(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.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName} + /// + /// + /// Operation Id + /// ManagedInstanceAdministrators_Get + /// + /// + /// + /// The SqlAdministratorName to use. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlAdministratorName administratorName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceAdministratorClientDiagnostics.CreateScope("ManagedInstanceAdministratorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceAdministratorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, administratorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceAdministratorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdvancedThreatProtectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdvancedThreatProtectionCollection.cs index 3603f19b98a3..16c15f8dbf93 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdvancedThreatProtectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdvancedThreatProtectionCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(AdvancedThreatProtectionName advancedThreat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName} + /// + /// + /// Operation Id + /// ManagedInstanceAdvancedThreatProtectionSettings_Get + /// + /// + /// + /// The name of the Advanced Threat Protection state. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AdvancedThreatProtectionName advancedThreatProtectionName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceAdvancedThreatProtectionManagedInstanceAdvancedThreatProtectionSettingsClientDiagnostics.CreateScope("ManagedInstanceAdvancedThreatProtectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceAdvancedThreatProtectionManagedInstanceAdvancedThreatProtectionSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, advancedThreatProtectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceAdvancedThreatProtectionResource(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.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName} + /// + /// + /// Operation Id + /// ManagedInstanceAdvancedThreatProtectionSettings_Get + /// + /// + /// + /// The name of the Advanced Threat Protection state. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AdvancedThreatProtectionName advancedThreatProtectionName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceAdvancedThreatProtectionManagedInstanceAdvancedThreatProtectionSettingsClientDiagnostics.CreateScope("ManagedInstanceAdvancedThreatProtectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceAdvancedThreatProtectionManagedInstanceAdvancedThreatProtectionSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, advancedThreatProtectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceAdvancedThreatProtectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationCollection.cs index bf569a336f0b..b2e3c8419bc4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(AuthenticationName authenticationName, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName} + /// + /// + /// Operation Id + /// ManagedInstanceAzureADOnlyAuthentications_Get + /// + /// + /// + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceAzureADOnlyAuthenticationClientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceAzureADOnlyAuthenticationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceAzureADOnlyAuthenticationResource(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.Sql/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName} + /// + /// + /// Operation Id + /// ManagedInstanceAzureADOnlyAuthentications_Get + /// + /// + /// + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceAzureADOnlyAuthenticationClientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceAzureADOnlyAuthenticationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceAzureADOnlyAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceCollection.cs index 10de909ede13..f29d3b394ae3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceCollection.cs @@ -330,6 +330,82 @@ public virtual Response Exists(string managedInstanceName, string expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// + /// + /// Operation Id + /// ManagedInstances_Get + /// + /// + /// + /// The name of the managed instance. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var scope = _managedInstanceClientDiagnostics.CreateScope("ManagedInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, managedInstanceName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceResource(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.Sql/managedInstances/{managedInstanceName} + /// + /// + /// Operation Id + /// ManagedInstances_Get + /// + /// + /// + /// The name of the managed instance. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var scope = _managedInstanceClientDiagnostics.CreateScope("ManagedInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, managedInstanceName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcCollection.cs index fef8c2f1bc4b..827e6ec821aa 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(DtcName dtcName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// + /// + /// Operation Id + /// ManagedInstanceDtcs_Get + /// + /// + /// + /// The name of the managed instance DTC. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(DtcName dtcName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceDtcRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceDtcResource(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.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// + /// + /// Operation Id + /// ManagedInstanceDtcs_Get + /// + /// + /// + /// The name of the managed instance DTC. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(DtcName dtcName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceDtcRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceDtcResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorCollection.cs index 7958805349e3..579807f4e04c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(EncryptionProtectorName encryptionProtector } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName} + /// + /// + /// Operation Id + /// ManagedInstanceEncryptionProtectors_Get + /// + /// + /// + /// The name of the encryption protector to be retrieved. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceEncryptionProtectorClientDiagnostics.CreateScope("ManagedInstanceEncryptionProtectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceEncryptionProtectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionProtectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceEncryptionProtectorResource(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.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName} + /// + /// + /// Operation Id + /// ManagedInstanceEncryptionProtectors_Get + /// + /// + /// + /// The name of the encryption protector to be retrieved. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceEncryptionProtectorClientDiagnostics.CreateScope("ManagedInstanceEncryptionProtectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceEncryptionProtectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionProtectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceEncryptionProtectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeyCollection.cs index 8f6928c6bdb5..bcb6cb90e0e6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeyCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string keyName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName} + /// + /// + /// Operation Id + /// ManagedInstanceKeys_Get + /// + /// + /// + /// The name of the managed instance key to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _managedInstanceKeyClientDiagnostics.CreateScope("ManagedInstanceKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceKeyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceKeyResource(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.Sql/managedInstances/{managedInstanceName}/keys/{keyName} + /// + /// + /// Operation Id + /// ManagedInstanceKeys_Get + /// + /// + /// + /// The name of the managed instance key to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _managedInstanceKeyClientDiagnostics.CreateScope("ManagedInstanceKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceKeyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceKeyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPolicyCollection.cs index 4481c9f3a481..501b5d34d3e4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(ManagedInstanceLongTermRetentionPolicyName } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// ManagedInstanceLongTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. Should always be Default. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(ManagedInstanceLongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceLongTermRetentionPolicyClientDiagnostics.CreateScope("ManagedInstanceLongTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceLongTermRetentionPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceLongTermRetentionPolicyResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// ManagedInstanceLongTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. Should always be Default. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(ManagedInstanceLongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceLongTermRetentionPolicyClientDiagnostics.CreateScope("ManagedInstanceLongTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceLongTermRetentionPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceLongTermRetentionPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperationCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperationCollection.cs index 3bb2e81e19f5..9d9be8246d43 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperationCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperationCollection.cs @@ -225,6 +225,72 @@ public virtual Response Exists(Guid operationId, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId} + /// + /// + /// Operation Id + /// ManagedInstanceOperations_Get + /// + /// + /// + /// The Uuid to use. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid operationId, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceOperationClientDiagnostics.CreateScope("ManagedInstanceOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceOperationResource(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.Sql/managedInstances/{managedInstanceName}/operations/{operationId} + /// + /// + /// Operation Id + /// ManagedInstanceOperations_Get + /// + /// + /// + /// The Uuid to use. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid operationId, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceOperationClientDiagnostics.CreateScope("ManagedInstanceOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, operationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionCollection.cs index 32d93cad0ab1..1757ef53c272 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// ManagedInstancePrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _managedInstancePrivateEndpointConnectionClientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstancePrivateEndpointConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstancePrivateEndpointConnectionResource(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.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// ManagedInstancePrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _managedInstancePrivateEndpointConnectionClientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstancePrivateEndpointConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstancePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkCollection.cs index 66fee68721b4..40891362fd8e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// ManagedInstancePrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _managedInstancePrivateLinkManagedInstancePrivateLinkResourcesClientDiagnostics.CreateScope("ManagedInstancePrivateLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstancePrivateLinkManagedInstancePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstancePrivateLinkResource(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.Sql/managedInstances/{managedInstanceName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// ManagedInstancePrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _managedInstancePrivateLinkManagedInstancePrivateLinkResourcesClientDiagnostics.CreateScope("ManagedInstancePrivateLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstancePrivateLinkManagedInstancePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstancePrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerConfigurationOptionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerConfigurationOptionCollection.cs index 59ec491ec3f1..b72f01fa53b5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerConfigurationOptionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerConfigurationOptionCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(ManagedInstanceServerConfigurationOptionNam } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName} + /// + /// + /// Operation Id + /// ServerConfigurationOptions_Get + /// + /// + /// + /// The name of the server configuration option. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(ManagedInstanceServerConfigurationOptionName serverConfigurationOptionName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceServerConfigurationOptionServerConfigurationOptionsClientDiagnostics.CreateScope("ManagedInstanceServerConfigurationOptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceServerConfigurationOptionServerConfigurationOptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverConfigurationOptionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceServerConfigurationOptionResource(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.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName} + /// + /// + /// Operation Id + /// ServerConfigurationOptions_Get + /// + /// + /// + /// The name of the server configuration option. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(ManagedInstanceServerConfigurationOptionName serverConfigurationOptionName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceServerConfigurationOptionServerConfigurationOptionsClientDiagnostics.CreateScope("ManagedInstanceServerConfigurationOptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceServerConfigurationOptionServerConfigurationOptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverConfigurationOptionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceServerConfigurationOptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerTrustCertificateCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerTrustCertificateCollection.cs index 3b3931ee244e..22a4968319b3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerTrustCertificateCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerTrustCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// + /// + /// Operation Id + /// ServerTrustCertificates_Get + /// + /// + /// + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _managedInstanceServerTrustCertificateServerTrustCertificatesClientDiagnostics.CreateScope("ManagedInstanceServerTrustCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceServerTrustCertificateServerTrustCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceServerTrustCertificateResource(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.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName} + /// + /// + /// Operation Id + /// ServerTrustCertificates_Get + /// + /// + /// + /// Name of of the certificate to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _managedInstanceServerTrustCertificateServerTrustCertificatesClientDiagnostics.CreateScope("ManagedInstanceServerTrustCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceServerTrustCertificateServerTrustCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceServerTrustCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceStartStopScheduleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceStartStopScheduleCollection.cs index 992e98018d39..6745e49525a9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceStartStopScheduleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceStartStopScheduleCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(ManagedInstanceStartStopScheduleName startS } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName} + /// + /// + /// Operation Id + /// StartStopManagedInstanceSchedules_Get + /// + /// + /// + /// Name of the managed instance Start/Stop schedule. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(ManagedInstanceStartStopScheduleName startStopScheduleName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceStartStopScheduleStartStopManagedInstanceSchedulesClientDiagnostics.CreateScope("ManagedInstanceStartStopScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceStartStopScheduleStartStopManagedInstanceSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, startStopScheduleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceStartStopScheduleResource(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.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName} + /// + /// + /// Operation Id + /// StartStopManagedInstanceSchedules_Get + /// + /// + /// + /// Name of the managed instance Start/Stop schedule. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(ManagedInstanceStartStopScheduleName startStopScheduleName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceStartStopScheduleStartStopManagedInstanceSchedulesClientDiagnostics.CreateScope("ManagedInstanceStartStopScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceStartStopScheduleStartStopManagedInstanceSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, startStopScheduleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceStartStopScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentCollection.cs index 3c09b55b8926..db5a9b52089c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(VulnerabilityAssessmentName vulnerabilityAs } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// ManagedInstanceVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceVulnerabilityAssessmentClientDiagnostics.CreateScope("ManagedInstanceVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedInstanceVulnerabilityAssessmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceVulnerabilityAssessmentResource(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.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// ManagedInstanceVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceVulnerabilityAssessmentClientDiagnostics.CreateScope("ManagedInstanceVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedInstanceVulnerabilityAssessmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedLedgerDigestUploadCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedLedgerDigestUploadCollection.cs index 36948ca85644..cb294ff5b122 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedLedgerDigestUploadCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedLedgerDigestUploadCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(ManagedLedgerDigestUploadsName ledgerDigest } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads} + /// + /// + /// Operation Id + /// ManagedLedgerDigestUploads_Get + /// + /// + /// + /// The ManagedLedgerDigestUploadsName to use. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(ManagedLedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + using var scope = _managedLedgerDigestUploadClientDiagnostics.CreateScope("ManagedLedgerDigestUploadCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedLedgerDigestUploadRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ledgerDigestUploads, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedLedgerDigestUploadResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads} + /// + /// + /// Operation Id + /// ManagedLedgerDigestUploads_Get + /// + /// + /// + /// The ManagedLedgerDigestUploadsName to use. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(ManagedLedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + using var scope = _managedLedgerDigestUploadClientDiagnostics.CreateScope("ManagedLedgerDigestUploadCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedLedgerDigestUploadRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ledgerDigestUploads, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedLedgerDigestUploadResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.cs index af7a48561e13..447b57e6952c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(ManagedShortTermRetentionPolicyName policyN } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(ManagedShortTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _managedRestorableDroppedDbBackupShortTermRetentionPolicyManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientDiagnostics.CreateScope("ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedRestorableDroppedDbBackupShortTermRetentionPolicyManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource(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.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName} + /// + /// + /// Operation Id + /// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(ManagedShortTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + using var scope = _managedRestorableDroppedDbBackupShortTermRetentionPolicyManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientDiagnostics.CreateScope("ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedRestorableDroppedDbBackupShortTermRetentionPolicyManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs index 085aca3e474e..b867e766ff4c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string dnsAliasName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// + /// + /// Operation Id + /// ManagedServerDnsAliases_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(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.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// + /// + /// Operation Id + /// ManagedServerDnsAliases_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPolicyCollection.cs index c14b957d33f0..168002655ca7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlSecurityAlertPolicyName securityAlertPol } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ManagedServerSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _managedServerSecurityAlertPolicyClientDiagnostics.CreateScope("ManagedServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedServerSecurityAlertPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServerSecurityAlertPolicyResource(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.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ManagedServerSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _managedServerSecurityAlertPolicyClientDiagnostics.CreateScope("ManagedServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedServerSecurityAlertPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedServerSecurityAlertPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedTransparentDataEncryptionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedTransparentDataEncryptionCollection.cs index 4f506cc7004c..0f261871e1d2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedTransparentDataEncryptionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedTransparentDataEncryptionCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(TransparentDataEncryptionName tdeName, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption/{tdeName} + /// + /// + /// Operation Id + /// ManagedDatabaseTransparentDataEncryption_Get + /// + /// + /// + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + using var scope = _managedTransparentDataEncryptionManagedDatabaseTransparentDataEncryptionClientDiagnostics.CreateScope("ManagedTransparentDataEncryptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedTransparentDataEncryptionManagedDatabaseTransparentDataEncryptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tdeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedTransparentDataEncryptionResource(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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption/{tdeName} + /// + /// + /// Operation Id + /// ManagedDatabaseTransparentDataEncryption_Get + /// + /// + /// + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + using var scope = _managedTransparentDataEncryptionManagedDatabaseTransparentDataEncryptionClientDiagnostics.CreateScope("ManagedTransparentDataEncryptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedTransparentDataEncryptionManagedDatabaseTransparentDataEncryptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tdeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedTransparentDataEncryptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRuleCollection.cs index 1b10b07324bb..da67d73aedae 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string outboundRuleFqdn, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/outboundFirewallRules/{outboundRuleFqdn} + /// + /// + /// Operation Id + /// OutboundFirewallRules_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(outboundRuleFqdn, nameof(outboundRuleFqdn)); + + using var scope = _outboundFirewallRuleClientDiagnostics.CreateScope("OutboundFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _outboundFirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleFqdn, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OutboundFirewallRuleResource(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.Sql/servers/{serverName}/outboundFirewallRules/{outboundRuleFqdn} + /// + /// + /// Operation Id + /// OutboundFirewallRules_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(outboundRuleFqdn, nameof(outboundRuleFqdn)); + + using var scope = _outboundFirewallRuleClientDiagnostics.CreateScope("OutboundFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _outboundFirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleFqdn, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OutboundFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedActionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedActionCollection.cs index b7d042d835a4..9c892be1a3b6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedActionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedActionCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string recommendedActionName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName} + /// + /// + /// Operation Id + /// DatabaseRecommendedActions_Get + /// + /// + /// + /// The name of Database Recommended Action. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recommendedActionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recommendedActionName, nameof(recommendedActionName)); + + using var scope = _recommendedActionDatabaseRecommendedActionsClientDiagnostics.CreateScope("RecommendedActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _recommendedActionDatabaseRecommendedActionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, recommendedActionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecommendedActionResource(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.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName} + /// + /// + /// Operation Id + /// DatabaseRecommendedActions_Get + /// + /// + /// + /// The name of Database Recommended Action. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recommendedActionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recommendedActionName, nameof(recommendedActionName)); + + using var scope = _recommendedActionDatabaseRecommendedActionsClientDiagnostics.CreateScope("RecommendedActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _recommendedActionDatabaseRecommendedActionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, recommendedActionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecommendedActionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableDatabaseCollection.cs index 4ce079e22b74..62a3439a6dd3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableDatabaseCollection.cs @@ -249,6 +249,84 @@ public virtual Response Exists(string databaseName, string expand = null, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName} + /// + /// + /// Operation Id + /// RecoverableDatabases_Get + /// + /// + /// + /// The name of the database. + /// The child resources to include in the response. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, string expand = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _recoverableDatabaseClientDiagnostics.CreateScope("RecoverableDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _recoverableDatabaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, expand, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecoverableDatabaseResource(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.Sql/servers/{serverName}/recoverableDatabases/{databaseName} + /// + /// + /// Operation Id + /// RecoverableDatabases_Get + /// + /// + /// + /// The name of the database. + /// The child resources to include in the response. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, string expand = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _recoverableDatabaseClientDiagnostics.CreateScope("RecoverableDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _recoverableDatabaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, expand, filter, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecoverableDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabaseCollection.cs index 798486228ad9..177ce40f8e4b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabaseCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string recoverableDatabaseName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName} + /// + /// + /// Operation Id + /// RecoverableManagedDatabases_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string recoverableDatabaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoverableDatabaseName, nameof(recoverableDatabaseName)); + + using var scope = _recoverableManagedDatabaseClientDiagnostics.CreateScope("RecoverableManagedDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _recoverableManagedDatabaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, recoverableDatabaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecoverableManagedDatabaseResource(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.Sql/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName} + /// + /// + /// Operation Id + /// RecoverableManagedDatabases_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string recoverableDatabaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoverableDatabaseName, nameof(recoverableDatabaseName)); + + using var scope = _recoverableManagedDatabaseClientDiagnostics.CreateScope("RecoverableManagedDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _recoverableManagedDatabaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, recoverableDatabaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RecoverableManagedDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupCollection.cs index d60f17a3d86e..8fec276c64a5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupCollection.cs @@ -258,6 +258,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionBackups_GetByResourceGroup + /// + /// + /// + /// The backup name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupLongTermRetentionBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsRestClient.GetByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_locationName), _longTermRetentionServerName, _longTermRetentionDatabaseName, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupLongTermRetentionBackupResource(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.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionBackups_GetByResourceGroup + /// + /// + /// + /// The backup name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupLongTermRetentionBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceGroupLongTermRetentionBackupLongTermRetentionBackupsRestClient.GetByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_locationName), _longTermRetentionServerName, _longTermRetentionDatabaseName, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupLongTermRetentionBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionManagedInstanceBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionManagedInstanceBackupCollection.cs index 47ef521b9449..e519630a60e8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionManagedInstanceBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionManagedInstanceBackupCollection.cs @@ -258,6 +258,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup + /// + /// + /// + /// The backup name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _resourceGroupLongTermRetentionManagedInstanceBackupLongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupLongTermRetentionManagedInstanceBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourceGroupLongTermRetentionManagedInstanceBackupLongTermRetentionManagedInstanceBackupsRestClient.GetByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_locationName), _managedInstanceName, _databaseName, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupLongTermRetentionManagedInstanceBackupResource(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.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup + /// + /// + /// + /// The backup name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _resourceGroupLongTermRetentionManagedInstanceBackupLongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupLongTermRetentionManagedInstanceBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourceGroupLongTermRetentionManagedInstanceBackupLongTermRetentionManagedInstanceBackupsRestClient.GetByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_locationName), _managedInstanceName, _databaseName, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourceGroupLongTermRetentionManagedInstanceBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseCollection.cs index f60260edcf69..9a0960112538 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseCollection.cs @@ -249,6 +249,84 @@ public virtual Response Exists(string restorableDroppedDatabaseId, string } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppedDatabaseId} + /// + /// + /// Operation Id + /// RestorableDroppedDatabases_Get + /// + /// + /// + /// The String to use. + /// The child resources to include in the response. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string restorableDroppedDatabaseId, string expand = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorableDroppedDatabaseId, nameof(restorableDroppedDatabaseId)); + + using var scope = _restorableDroppedDatabaseClientDiagnostics.CreateScope("RestorableDroppedDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _restorableDroppedDatabaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restorableDroppedDatabaseId, expand, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorableDroppedDatabaseResource(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.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppedDatabaseId} + /// + /// + /// Operation Id + /// RestorableDroppedDatabases_Get + /// + /// + /// + /// The String to use. + /// The child resources to include in the response. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string restorableDroppedDatabaseId, string expand = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorableDroppedDatabaseId, nameof(restorableDroppedDatabaseId)); + + using var scope = _restorableDroppedDatabaseClientDiagnostics.CreateScope("RestorableDroppedDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _restorableDroppedDatabaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restorableDroppedDatabaseId, expand, filter, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorableDroppedDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseCollection.cs index c40ee00b590e..882d18638525 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string restorableDroppedDatabaseId, Cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId} + /// + /// + /// Operation Id + /// RestorableDroppedManagedDatabases_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string restorableDroppedDatabaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorableDroppedDatabaseId, nameof(restorableDroppedDatabaseId)); + + using var scope = _restorableDroppedManagedDatabaseClientDiagnostics.CreateScope("RestorableDroppedManagedDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _restorableDroppedManagedDatabaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restorableDroppedDatabaseId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorableDroppedManagedDatabaseResource(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.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId} + /// + /// + /// Operation Id + /// RestorableDroppedManagedDatabases_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string restorableDroppedDatabaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorableDroppedDatabaseId, nameof(restorableDroppedDatabaseId)); + + using var scope = _restorableDroppedManagedDatabaseClientDiagnostics.CreateScope("RestorableDroppedManagedDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _restorableDroppedManagedDatabaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restorableDroppedDatabaseId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorableDroppedManagedDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvancedThreatProtectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvancedThreatProtectionCollection.cs index 83c16dfc55b2..dfe589ec30ea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvancedThreatProtectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvancedThreatProtectionCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(AdvancedThreatProtectionName advancedThreat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advancedThreatProtectionSettings/{advancedThreatProtectionName} + /// + /// + /// Operation Id + /// ServerAdvancedThreatProtectionSettings_Get + /// + /// + /// + /// The name of the Advanced Threat Protection state. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AdvancedThreatProtectionName advancedThreatProtectionName, CancellationToken cancellationToken = default) + { + using var scope = _serverAdvancedThreatProtectionServerAdvancedThreatProtectionSettingsClientDiagnostics.CreateScope("ServerAdvancedThreatProtectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serverAdvancedThreatProtectionServerAdvancedThreatProtectionSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, advancedThreatProtectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServerAdvancedThreatProtectionResource(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.Sql/servers/{serverName}/advancedThreatProtectionSettings/{advancedThreatProtectionName} + /// + /// + /// Operation Id + /// ServerAdvancedThreatProtectionSettings_Get + /// + /// + /// + /// The name of the Advanced Threat Protection state. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AdvancedThreatProtectionName advancedThreatProtectionName, CancellationToken cancellationToken = default) + { + using var scope = _serverAdvancedThreatProtectionServerAdvancedThreatProtectionSettingsClientDiagnostics.CreateScope("ServerAdvancedThreatProtectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serverAdvancedThreatProtectionServerAdvancedThreatProtectionSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, advancedThreatProtectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServerAdvancedThreatProtectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceObjectiveCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceObjectiveCollection.cs index f5198b2a0d90..bea4b9f318f7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceObjectiveCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceObjectiveCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string serviceObjectiveName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName} + /// + /// + /// Operation Id + /// ServiceObjectives_Get + /// + /// + /// + /// The name of the service objective to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceObjectiveName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceObjectiveName, nameof(serviceObjectiveName)); + + using var scope = _serviceObjectiveClientDiagnostics.CreateScope("ServiceObjectiveCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceObjectiveRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceObjectiveName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceObjectiveResource(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.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName} + /// + /// + /// Operation Id + /// ServiceObjectives_Get + /// + /// + /// + /// The name of the service objective to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceObjectiveName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceObjectiveName, nameof(serviceObjectiveName)); + + using var scope = _serviceObjectiveClientDiagnostics.CreateScope("ServiceObjectiveCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceObjectiveRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceObjectiveName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceObjectiveResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorCollection.cs index abd2a0e61caa..9ce2a897b53f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string advisorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName} + /// + /// + /// Operation Id + /// DatabaseAdvisors_Get + /// + /// + /// + /// The name of the Database Advisor. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string advisorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName)); + + using var scope = _sqlDatabaseAdvisorDatabaseAdvisorsClientDiagnostics.CreateScope("SqlDatabaseAdvisorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseAdvisorDatabaseAdvisorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advisorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseAdvisorResource(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.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName} + /// + /// + /// Operation Id + /// DatabaseAdvisors_Get + /// + /// + /// + /// The name of the Database Advisor. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string advisorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName)); + + using var scope = _sqlDatabaseAdvisorDatabaseAdvisorsClientDiagnostics.CreateScope("SqlDatabaseAdvisorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseAdvisorDatabaseAdvisorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advisorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseAdvisorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseBlobAuditingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseBlobAuditingPolicyCollection.cs index 626d0b3f9801..7969079fdfa5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseBlobAuditingPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseBlobAuditingPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(BlobAuditingPolicyName blobAuditingPolicyNa } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// DatabaseBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseBlobAuditingPolicyDatabaseBlobAuditingPoliciesClientDiagnostics.CreateScope("SqlDatabaseBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseBlobAuditingPolicyDatabaseBlobAuditingPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseBlobAuditingPolicyResource(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.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// DatabaseBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseBlobAuditingPolicyDatabaseBlobAuditingPoliciesClientDiagnostics.CreateScope("SqlDatabaseBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseBlobAuditingPolicyDatabaseBlobAuditingPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseBlobAuditingPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseCollection.cs index 09fda3d64fb8..818e3b2f50f8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseCollection.cs @@ -333,6 +333,84 @@ public virtual Response Exists(string databaseName, string expand = null, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The child resources to include in the response. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, string expand = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseDatabasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, expand, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseResource(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.Sql/servers/{serverName}/databases/{databaseName} + /// + /// + /// Operation Id + /// Databases_Get + /// + /// + /// + /// The name of the database. + /// The child resources to include in the response. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, string expand = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _sqlDatabaseDatabasesClientDiagnostics.CreateScope("SqlDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseDatabasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, expand, filter, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnCollection.cs index 29eb3eb9e615..d7ac80067076 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string columnName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName} + /// + /// + /// Operation Id + /// DatabaseColumns_Get + /// + /// + /// + /// The name of the column. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string columnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + + using var scope = _sqlDatabaseColumnDatabaseColumnsClientDiagnostics.CreateScope("SqlDatabaseColumnCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseColumnDatabaseColumnsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, columnName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseColumnResource(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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName} + /// + /// + /// Operation Id + /// DatabaseColumns_Get + /// + /// + /// + /// The name of the column. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string columnName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + + using var scope = _sqlDatabaseColumnDatabaseColumnsClientDiagnostics.CreateScope("SqlDatabaseColumnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseColumnDatabaseColumnsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, columnName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseColumnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaCollection.cs index f7100d5ef475..fc32846bed5b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string schemaName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// DatabaseSchemas_Get + /// + /// + /// + /// The name of the schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _sqlDatabaseSchemaDatabaseSchemasClientDiagnostics.CreateScope("SqlDatabaseSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseSchemaDatabaseSchemasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSchemaResource(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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName} + /// + /// + /// Operation Id + /// DatabaseSchemas_Get + /// + /// + /// + /// The name of the schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + using var scope = _sqlDatabaseSchemaDatabaseSchemasClientDiagnostics.CreateScope("SqlDatabaseSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseSchemaDatabaseSchemasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSecurityAlertPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSecurityAlertPolicyCollection.cs index 6925f1a486ce..5de5425d050f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSecurityAlertPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSecurityAlertPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlSecurityAlertPolicyName securityAlertPol } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// DatabaseSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseSecurityAlertPolicyDatabaseSecurityAlertPoliciesClientDiagnostics.CreateScope("SqlDatabaseSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseSecurityAlertPolicyDatabaseSecurityAlertPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSecurityAlertPolicyResource(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.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// DatabaseSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseSecurityAlertPolicyDatabaseSecurityAlertPoliciesClientDiagnostics.CreateScope("SqlDatabaseSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseSecurityAlertPolicyDatabaseSecurityAlertPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSecurityAlertPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSensitivityLabelCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSensitivityLabelCollection.cs index ecbdd9226bdb..d53d06d54316 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSensitivityLabelCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSensitivityLabelCollection.cs @@ -254,5 +254,71 @@ public virtual Response Exists(SensitivityLabelSource sensitivityLabelSour throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource} + /// + /// + /// Operation Id + /// SensitivityLabels_Get + /// + /// + /// + /// The source of the sensitivity label. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseSensitivityLabelCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseSensitivityLabelSensitivityLabelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, sensitivityLabelSource, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSensitivityLabelResource(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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource} + /// + /// + /// Operation Id + /// SensitivityLabels_Get + /// + /// + /// + /// The source of the sensitivity label. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseSensitivityLabelCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseSensitivityLabelSensitivityLabelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, sensitivityLabelSource, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSensitivityLabelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.cs index 2b7a4a8df934..f4d18477d03c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlVulnerabilityAssessmentBaselineName base } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentBaselines_Get + /// + /// + /// + /// The SqlVulnerabilityAssessmentBaselineName to use. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlVulnerabilityAssessmentBaselineName baselineName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentBaselineDatabaseSqlVulnerabilityAssessmentBaselinesClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseSqlVulnerabilityAssessmentBaselineDatabaseSqlVulnerabilityAssessmentBaselinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, baselineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentBaselineResource(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.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentBaselines_Get + /// + /// + /// + /// The SqlVulnerabilityAssessmentBaselineName to use. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlVulnerabilityAssessmentBaselineName baselineName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentBaselineDatabaseSqlVulnerabilityAssessmentBaselinesClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseSqlVulnerabilityAssessmentBaselineDatabaseSqlVulnerabilityAssessmentBaselinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, baselineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentBaselineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.cs index 016bff5cef7e..ad4585e3b32d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string ruleId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentRuleBaselines_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentBaselineRuleDatabaseSqlVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseSqlVulnerabilityAssessmentBaselineRuleDatabaseSqlVulnerabilityAssessmentRuleBaselinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource(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.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentRuleBaselines_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentBaselineRuleDatabaseSqlVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseSqlVulnerabilityAssessmentBaselineRuleDatabaseSqlVulnerabilityAssessmentRuleBaselinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentCollection.cs index 14fc19fffadb..24ad2625a85c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentCollection.cs @@ -226,6 +226,72 @@ public virtual Response Exists(VulnerabilityAssessmentName vulnerabilityAs } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentsSettings_Get + /// + /// + /// + /// The name of the SQL Vulnerability Assessment. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentDatabaseSqlVulnerabilityAssessmentsSettingsClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseSqlVulnerabilityAssessmentDatabaseSqlVulnerabilityAssessmentsSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentResource(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.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentsSettings_Get + /// + /// + /// + /// The name of the SQL Vulnerability Assessment. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentDatabaseSqlVulnerabilityAssessmentsSettingsClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseSqlVulnerabilityAssessmentDatabaseSqlVulnerabilityAssessmentsSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanCollection.cs index 6a784a2874d7..673f5a2afc82 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string scanId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentScanDatabaseSqlVulnerabilityAssessmentScansClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseSqlVulnerabilityAssessmentScanDatabaseSqlVulnerabilityAssessmentScansRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentScanResource(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.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentScanDatabaseSqlVulnerabilityAssessmentScansClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseSqlVulnerabilityAssessmentScanDatabaseSqlVulnerabilityAssessmentScansRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentScanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.cs index 8d6e56659914..3768eca4ae9c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string scanResultId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults/{scanResultId} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentScanResult_Get + /// + /// + /// + /// The scan result id of the specific result to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scanResultId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanResultId, nameof(scanResultId)); + + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentScanResultDatabaseSqlVulnerabilityAssessmentScanResultClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseSqlVulnerabilityAssessmentScanResultDatabaseSqlVulnerabilityAssessmentScanResultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanResultId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentScanResultResource(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.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults/{scanResultId} + /// + /// + /// Operation Id + /// DatabaseSqlVulnerabilityAssessmentScanResult_Get + /// + /// + /// + /// The scan result id of the specific result to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scanResultId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanResultId, nameof(scanResultId)); + + using var scope = _sqlDatabaseSqlVulnerabilityAssessmentScanResultDatabaseSqlVulnerabilityAssessmentScanResultClientDiagnostics.CreateScope("SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseSqlVulnerabilityAssessmentScanResultDatabaseSqlVulnerabilityAssessmentScanResultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanResultId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseSqlVulnerabilityAssessmentScanResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableCollection.cs index d9ad405e8d74..9b164d7417a1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string tableName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName} + /// + /// + /// Operation Id + /// DatabaseTables_Get + /// + /// + /// + /// The name of the table. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _sqlDatabaseTableDatabaseTablesClientDiagnostics.CreateScope("SqlDatabaseTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseTableDatabaseTablesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseTableResource(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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName} + /// + /// + /// Operation Id + /// DatabaseTables_Get + /// + /// + /// + /// The name of the table. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _sqlDatabaseTableDatabaseTablesClientDiagnostics.CreateScope("SqlDatabaseTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseTableDatabaseTablesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseTableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentCollection.cs index 1cbde24a704c..8fb4f0177864 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(VulnerabilityAssessmentName vulnerabilityAs } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// DatabaseVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseVulnerabilityAssessmentDatabaseVulnerabilityAssessmentsClientDiagnostics.CreateScope("SqlDatabaseVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseVulnerabilityAssessmentDatabaseVulnerabilityAssessmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseVulnerabilityAssessmentResource(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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// DatabaseVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _sqlDatabaseVulnerabilityAssessmentDatabaseVulnerabilityAssessmentsClientDiagnostics.CreateScope("SqlDatabaseVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseVulnerabilityAssessmentDatabaseVulnerabilityAssessmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs index e16932c9364a..43dbb79e1e9d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.cs @@ -282,5 +282,81 @@ public virtual Response Exists(string ruleId, VulnerabilityAssessmentPolic throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName} + /// + /// + /// Operation Id + /// DatabaseVulnerabilityAssessmentRuleBaselines_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _sqlDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseVulnerabilityAssessmentRuleBaselineResource(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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName} + /// + /// + /// Operation Id + /// DatabaseVulnerabilityAssessmentRuleBaselines_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _sqlDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseVulnerabilityAssessmentRuleBaselineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentScanCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentScanCollection.cs index 169631161115..01cf94422a01 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentScanCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentScanCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string scanId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// DatabaseVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _sqlDatabaseVulnerabilityAssessmentScanDatabaseVulnerabilityAssessmentScansClientDiagnostics.CreateScope("SqlDatabaseVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlDatabaseVulnerabilityAssessmentScanDatabaseVulnerabilityAssessmentScansRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseVulnerabilityAssessmentScanResource(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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// DatabaseVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _sqlDatabaseVulnerabilityAssessmentScanDatabaseVulnerabilityAssessmentScansClientDiagnostics.CreateScope("SqlDatabaseVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlDatabaseVulnerabilityAssessmentScanDatabaseVulnerabilityAssessmentScansRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlDatabaseVulnerabilityAssessmentScanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlFirewallRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlFirewallRuleCollection.cs index 491f445376a6..64e7e6a81eb9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlFirewallRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlFirewallRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _sqlFirewallRuleFirewallRulesClientDiagnostics.CreateScope("SqlFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlFirewallRuleResource(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.Sql/servers/{serverName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _sqlFirewallRuleFirewallRulesClientDiagnostics.CreateScope("SqlFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateEndpointConnectionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateEndpointConnectionCollection.cs index 37682dbdb079..41992f05afe4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateEndpointConnectionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _sqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("SqlPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlPrivateEndpointConnectionResource(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.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _sqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("SqlPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateLinkResourceCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateLinkResourceCollection.cs index 7f07d5322c6d..01fc346059bf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateLinkResourceCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _sqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("SqlPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlPrivateLinkResource(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.Sql/servers/{serverName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _sqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("SqlPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAdvisorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAdvisorCollection.cs index bc51b730590a..55ba36319a62 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAdvisorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAdvisorCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string advisorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName} + /// + /// + /// Operation Id + /// ServerAdvisors_Get + /// + /// + /// + /// The name of the Server Advisor. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string advisorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName)); + + using var scope = _sqlServerAdvisorServerAdvisorsClientDiagnostics.CreateScope("SqlServerAdvisorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerAdvisorServerAdvisorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, advisorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerAdvisorResource(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.Sql/servers/{serverName}/advisors/{advisorName} + /// + /// + /// Operation Id + /// ServerAdvisors_Get + /// + /// + /// + /// The name of the Server Advisor. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string advisorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName)); + + using var scope = _sqlServerAdvisorServerAdvisorsClientDiagnostics.CreateScope("SqlServerAdvisorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerAdvisorServerAdvisorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, advisorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerAdvisorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADAdministratorCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADAdministratorCollection.cs index aaeb04b930d4..ef08fa7316a3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADAdministratorCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADAdministratorCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlAdministratorName administratorName, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName} + /// + /// + /// Operation Id + /// ServerAzureADAdministrators_Get + /// + /// + /// + /// The name of server active directory administrator. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlAdministratorName administratorName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerAzureADAdministratorServerAzureADAdministratorsClientDiagnostics.CreateScope("SqlServerAzureADAdministratorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerAzureADAdministratorServerAzureADAdministratorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, administratorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerAzureADAdministratorResource(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.Sql/servers/{serverName}/administrators/{administratorName} + /// + /// + /// Operation Id + /// ServerAzureADAdministrators_Get + /// + /// + /// + /// The name of server active directory administrator. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlAdministratorName administratorName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerAzureADAdministratorServerAzureADAdministratorsClientDiagnostics.CreateScope("SqlServerAzureADAdministratorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerAzureADAdministratorServerAzureADAdministratorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, administratorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerAzureADAdministratorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADOnlyAuthenticationCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADOnlyAuthenticationCollection.cs index 94e84b97c36b..2949741d20d1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADOnlyAuthenticationCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADOnlyAuthenticationCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(AuthenticationName authenticationName, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/azureADOnlyAuthentications/{authenticationName} + /// + /// + /// Operation Id + /// ServerAzureADOnlyAuthentications_Get + /// + /// + /// + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerAzureADOnlyAuthenticationServerAzureADOnlyAuthenticationsClientDiagnostics.CreateScope("SqlServerAzureADOnlyAuthenticationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerAzureADOnlyAuthenticationServerAzureADOnlyAuthenticationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerAzureADOnlyAuthenticationResource(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.Sql/servers/{serverName}/azureADOnlyAuthentications/{authenticationName} + /// + /// + /// Operation Id + /// ServerAzureADOnlyAuthentications_Get + /// + /// + /// + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerAzureADOnlyAuthenticationServerAzureADOnlyAuthenticationsClientDiagnostics.CreateScope("SqlServerAzureADOnlyAuthenticationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerAzureADOnlyAuthenticationServerAzureADOnlyAuthenticationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerAzureADOnlyAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerBlobAuditingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerBlobAuditingPolicyCollection.cs index cd2744a3d24c..aab916ecf41e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerBlobAuditingPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerBlobAuditingPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(BlobAuditingPolicyName blobAuditingPolicyNa } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// ServerBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerBlobAuditingPolicyServerBlobAuditingPoliciesClientDiagnostics.CreateScope("SqlServerBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerBlobAuditingPolicyServerBlobAuditingPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerBlobAuditingPolicyResource(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.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName} + /// + /// + /// Operation Id + /// ServerBlobAuditingPolicies_Get + /// + /// + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerBlobAuditingPolicyServerBlobAuditingPoliciesClientDiagnostics.CreateScope("SqlServerBlobAuditingPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerBlobAuditingPolicyServerBlobAuditingPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, blobAuditingPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerBlobAuditingPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCollection.cs index 2491b30b07a6..4187611a349c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCollection.cs @@ -330,6 +330,82 @@ public virtual Response Exists(string serverName, string expand = null, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _sqlServerServersClientDiagnostics.CreateScope("SqlServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerServersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serverName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerResource(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.Sql/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _sqlServerServersClientDiagnostics.CreateScope("SqlServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerServersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serverName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCommunicationLinkCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCommunicationLinkCollection.cs index d9b050d2b6d3..058d00d7be2c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCommunicationLinkCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCommunicationLinkCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string communicationLinkName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName} + /// + /// + /// Operation Id + /// ServerCommunicationLinks_Get + /// + /// + /// + /// The name of the server communication link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string communicationLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(communicationLinkName, nameof(communicationLinkName)); + + using var scope = _sqlServerCommunicationLinkServerCommunicationLinksClientDiagnostics.CreateScope("SqlServerCommunicationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerCommunicationLinkServerCommunicationLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, communicationLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerCommunicationLinkResource(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.Sql/servers/{serverName}/communicationLinks/{communicationLinkName} + /// + /// + /// Operation Id + /// ServerCommunicationLinks_Get + /// + /// + /// + /// The name of the server communication link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string communicationLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(communicationLinkName, nameof(communicationLinkName)); + + using var scope = _sqlServerCommunicationLinkServerCommunicationLinksClientDiagnostics.CreateScope("SqlServerCommunicationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerCommunicationLinkServerCommunicationLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, communicationLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerCommunicationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerConnectionPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerConnectionPolicyCollection.cs index 7784fbcab688..f2d9adf0bf27 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerConnectionPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerConnectionPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(ConnectionPolicyName connectionPolicyName, } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName} + /// + /// + /// Operation Id + /// ServerConnectionPolicies_Get + /// + /// + /// + /// The name of the connection policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerConnectionPolicyServerConnectionPoliciesClientDiagnostics.CreateScope("SqlServerConnectionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerConnectionPolicyServerConnectionPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerConnectionPolicyResource(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.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName} + /// + /// + /// Operation Id + /// ServerConnectionPolicies_Get + /// + /// + /// + /// The name of the connection policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerConnectionPolicyServerConnectionPoliciesClientDiagnostics.CreateScope("SqlServerConnectionPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerConnectionPolicyServerConnectionPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerConnectionPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkCollection.cs index 4fe8a339b663..08d758902687 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string linkId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// ReplicationLinks_Get + /// + /// + /// + /// The name of the replication link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string linkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); + + using var scope = _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics.CreateScope("SqlServerDatabaseReplicationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerDatabaseReplicationLinkResource(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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId} + /// + /// + /// Operation Id + /// ReplicationLinks_Get + /// + /// + /// + /// The name of the replication link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkId, nameof(linkId)); + + using var scope = _sqlServerDatabaseReplicationLinkReplicationLinksClientDiagnostics.CreateScope("SqlServerDatabaseReplicationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerDatabaseReplicationLinkReplicationLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerDatabaseReplicationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseRestorePointCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseRestorePointCollection.cs index b02475cdbb6c..de37189055b1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseRestorePointCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseRestorePointCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string restorePointName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName} + /// + /// + /// Operation Id + /// RestorePoints_Get + /// + /// + /// + /// The name of the restore point. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string restorePointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorePointName, nameof(restorePointName)); + + using var scope = _sqlServerDatabaseRestorePointRestorePointsClientDiagnostics.CreateScope("SqlServerDatabaseRestorePointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerDatabaseRestorePointRestorePointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, restorePointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerDatabaseRestorePointResource(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.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName} + /// + /// + /// Operation Id + /// RestorePoints_Get + /// + /// + /// + /// The name of the restore point. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string restorePointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorePointName, nameof(restorePointName)); + + using var scope = _sqlServerDatabaseRestorePointRestorePointsClientDiagnostics.CreateScope("SqlServerDatabaseRestorePointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerDatabaseRestorePointRestorePointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, restorePointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerDatabaseRestorePointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDevOpsAuditingSettingCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDevOpsAuditingSettingCollection.cs index 1828d9b8cc74..29f26b501e15 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDevOpsAuditingSettingCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDevOpsAuditingSettingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string devOpsAuditingSettingsName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName} + /// + /// + /// Operation Id + /// ServerDevOpsAuditSettings_Get + /// + /// + /// + /// The name of the devops audit settings. This should always be Default. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string devOpsAuditingSettingsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(devOpsAuditingSettingsName, nameof(devOpsAuditingSettingsName)); + + using var scope = _sqlServerDevOpsAuditingSettingServerDevOpsAuditSettingsClientDiagnostics.CreateScope("SqlServerDevOpsAuditingSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerDevOpsAuditingSettingServerDevOpsAuditSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, devOpsAuditingSettingsName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerDevOpsAuditingSettingResource(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.Sql/servers/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName} + /// + /// + /// Operation Id + /// ServerDevOpsAuditSettings_Get + /// + /// + /// + /// The name of the devops audit settings. This should always be Default. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string devOpsAuditingSettingsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(devOpsAuditingSettingsName, nameof(devOpsAuditingSettingsName)); + + using var scope = _sqlServerDevOpsAuditingSettingServerDevOpsAuditSettingsClientDiagnostics.CreateScope("SqlServerDevOpsAuditingSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerDevOpsAuditingSettingServerDevOpsAuditSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, devOpsAuditingSettingsName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerDevOpsAuditingSettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDnsAliasCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDnsAliasCollection.cs index cd21f8fce780..8a605f1449b3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDnsAliasCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDnsAliasCollection.cs @@ -319,6 +319,80 @@ public virtual Response Exists(string dnsAliasName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName} + /// + /// + /// Operation Id + /// ServerDnsAliases_Get + /// + /// + /// + /// The name of the server dns alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _sqlServerDnsAliasServerDnsAliasesClientDiagnostics.CreateScope("SqlServerDnsAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerDnsAliasServerDnsAliasesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerDnsAliasResource(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.Sql/servers/{serverName}/dnsAliases/{dnsAliasName} + /// + /// + /// Operation Id + /// ServerDnsAliases_Get + /// + /// + /// + /// The name of the server dns alias. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _sqlServerDnsAliasServerDnsAliasesClientDiagnostics.CreateScope("SqlServerDnsAliasCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerDnsAliasServerDnsAliasesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentCollection.cs index 1287c0990ccb..4d243dfa181d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string jobAgentName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName} + /// + /// + /// Operation Id + /// JobAgents_Get + /// + /// + /// + /// The name of the job agent to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + + using var scope = _sqlServerJobAgentJobAgentsClientDiagnostics.CreateScope("SqlServerJobAgentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobAgentJobAgentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobAgentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobAgentResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName} + /// + /// + /// Operation Id + /// JobAgents_Get + /// + /// + /// + /// The name of the job agent to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + + using var scope = _sqlServerJobAgentJobAgentsClientDiagnostics.CreateScope("SqlServerJobAgentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobAgentJobAgentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobAgentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobAgentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCollection.cs index 848a80b5bab6..f93de75356b6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string jobName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The name of the job to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _sqlServerJobJobsClientDiagnostics.CreateScope("SqlServerJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, jobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The name of the job to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _sqlServerJobJobsClientDiagnostics.CreateScope("SqlServerJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, jobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCredentialCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCredentialCollection.cs index e581f9368289..1f77d480fdd3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCredentialCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCredentialCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string credentialName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName} + /// + /// + /// Operation Id + /// JobCredentials_Get + /// + /// + /// + /// The name of the credential. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string credentialName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(credentialName, nameof(credentialName)); + + using var scope = _sqlServerJobCredentialJobCredentialsClientDiagnostics.CreateScope("SqlServerJobCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobCredentialJobCredentialsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, credentialName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobCredentialResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName} + /// + /// + /// Operation Id + /// JobCredentials_Get + /// + /// + /// + /// The name of the credential. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string credentialName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(credentialName, nameof(credentialName)); + + using var scope = _sqlServerJobCredentialJobCredentialsClientDiagnostics.CreateScope("SqlServerJobCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobCredentialJobCredentialsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, credentialName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobCredentialResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionCollection.cs index 7faa4465a071..3ad825cd4245 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionCollection.cs @@ -359,6 +359,72 @@ public virtual Response Exists(Guid jobExecutionId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId} + /// + /// + /// Operation Id + /// JobExecutions_Get + /// + /// + /// + /// The id of the job execution. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid jobExecutionId, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerJobExecutionJobExecutionsClientDiagnostics.CreateScope("SqlServerJobExecutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobExecutionJobExecutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, jobExecutionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobExecutionResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId} + /// + /// + /// Operation Id + /// JobExecutions_Get + /// + /// + /// + /// The id of the job execution. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid jobExecutionId, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerJobExecutionJobExecutionsClientDiagnostics.CreateScope("SqlServerJobExecutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobExecutionJobExecutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, jobExecutionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobExecutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepCollection.cs index 277e46e8d19d..407e8821fe51 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepCollection.cs @@ -248,6 +248,80 @@ public virtual Response Exists(string stepName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName} + /// + /// + /// Operation Id + /// JobStepExecutions_Get + /// + /// + /// + /// The name of the step. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string stepName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stepName, nameof(stepName)); + + using var scope = _sqlServerJobExecutionStepJobStepExecutionsClientDiagnostics.CreateScope("SqlServerJobExecutionStepCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobExecutionStepJobStepExecutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Guid.Parse(Id.Name), stepName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobExecutionStepResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName} + /// + /// + /// Operation Id + /// JobStepExecutions_Get + /// + /// + /// + /// The name of the step. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string stepName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stepName, nameof(stepName)); + + using var scope = _sqlServerJobExecutionStepJobStepExecutionsClientDiagnostics.CreateScope("SqlServerJobExecutionStepCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobExecutionStepJobStepExecutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Guid.Parse(Id.Name), stepName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobExecutionStepResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepTargetCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepTargetCollection.cs index 6c7f1ca38291..f245ba6a91ce 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepTargetCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepTargetCollection.cs @@ -232,6 +232,72 @@ public virtual Response Exists(Guid targetId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets/{targetId} + /// + /// + /// Operation Id + /// JobTargetExecutions_Get + /// + /// + /// + /// The target id. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid targetId, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerJobExecutionStepTargetJobTargetExecutionsClientDiagnostics.CreateScope("SqlServerJobExecutionStepTargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobExecutionStepTargetJobTargetExecutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Guid.Parse(Id.Parent.Name), Id.Name, targetId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobExecutionStepTargetResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets/{targetId} + /// + /// + /// Operation Id + /// JobTargetExecutions_Get + /// + /// + /// + /// The target id. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid targetId, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerJobExecutionStepTargetJobTargetExecutionsClientDiagnostics.CreateScope("SqlServerJobExecutionStepTargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobExecutionStepTargetJobTargetExecutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Guid.Parse(Id.Parent.Name), Id.Name, targetId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobExecutionStepTargetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobStepCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobStepCollection.cs index d632f61d2951..4f3b4d3e903b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobStepCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobStepCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string stepName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName} + /// + /// + /// Operation Id + /// JobSteps_Get + /// + /// + /// + /// The name of the job step. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string stepName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stepName, nameof(stepName)); + + using var scope = _sqlServerJobStepJobStepsClientDiagnostics.CreateScope("SqlServerJobStepCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobStepJobStepsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, stepName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobStepResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName} + /// + /// + /// Operation Id + /// JobSteps_Get + /// + /// + /// + /// The name of the job step. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string stepName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stepName, nameof(stepName)); + + using var scope = _sqlServerJobStepJobStepsClientDiagnostics.CreateScope("SqlServerJobStepCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobStepJobStepsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, stepName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobStepResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobTargetGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobTargetGroupCollection.cs index 661d0098bea2..a63b85a3d50a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobTargetGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobTargetGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string targetGroupName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName} + /// + /// + /// Operation Id + /// JobTargetGroups_Get + /// + /// + /// + /// The name of the target group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string targetGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetGroupName, nameof(targetGroupName)); + + using var scope = _sqlServerJobTargetGroupJobTargetGroupsClientDiagnostics.CreateScope("SqlServerJobTargetGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobTargetGroupJobTargetGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, targetGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobTargetGroupResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName} + /// + /// + /// Operation Id + /// JobTargetGroups_Get + /// + /// + /// + /// The name of the target group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string targetGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetGroupName, nameof(targetGroupName)); + + using var scope = _sqlServerJobTargetGroupJobTargetGroupsClientDiagnostics.CreateScope("SqlServerJobTargetGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobTargetGroupJobTargetGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, targetGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobTargetGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionCollection.cs index c6c01a166756..f1bd2d1d6df5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionCollection.cs @@ -225,6 +225,72 @@ public virtual Response Exists(int jobVersion, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion} + /// + /// + /// Operation Id + /// JobVersions_Get + /// + /// + /// + /// The version of the job to get. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(int jobVersion, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerJobVersionJobVersionsClientDiagnostics.CreateScope("SqlServerJobVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobVersionJobVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, jobVersion, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobVersionResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion} + /// + /// + /// Operation Id + /// JobVersions_Get + /// + /// + /// + /// The version of the job to get. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(int jobVersion, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerJobVersionJobVersionsClientDiagnostics.CreateScope("SqlServerJobVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobVersionJobVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, jobVersion, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionStepCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionStepCollection.cs index c88723f459e9..d98eb82e0517 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionStepCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionStepCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string stepName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName} + /// + /// + /// Operation Id + /// JobSteps_GetByVersion + /// + /// + /// + /// The name of the job step. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string stepName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stepName, nameof(stepName)); + + using var scope = _sqlServerJobVersionStepJobStepsClientDiagnostics.CreateScope("SqlServerJobVersionStepCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerJobVersionStepJobStepsRestClient.GetByVersionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, int.Parse(Id.Name), stepName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobVersionStepResource(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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName} + /// + /// + /// Operation Id + /// JobSteps_GetByVersion + /// + /// + /// + /// The name of the job step. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string stepName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(stepName, nameof(stepName)); + + using var scope = _sqlServerJobVersionStepJobStepsClientDiagnostics.CreateScope("SqlServerJobVersionStepCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerJobVersionStepJobStepsRestClient.GetByVersion(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, int.Parse(Id.Name), stepName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerJobVersionStepResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerKeyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerKeyCollection.cs index 6193b4cb3592..4bffd5140a89 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerKeyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerKeyCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string keyName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName} + /// + /// + /// Operation Id + /// ServerKeys_Get + /// + /// + /// + /// The name of the server key to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _sqlServerKeyServerKeysClientDiagnostics.CreateScope("SqlServerKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerKeyServerKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerKeyResource(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.Sql/servers/{serverName}/keys/{keyName} + /// + /// + /// Operation Id + /// ServerKeys_Get + /// + /// + /// + /// The name of the server key to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string keyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyName, nameof(keyName)); + + using var scope = _sqlServerKeyServerKeysClientDiagnostics.CreateScope("SqlServerKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerKeyServerKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerKeyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSecurityAlertPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSecurityAlertPolicyCollection.cs index 12f60cefd3f4..bf610ef7d9c7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSecurityAlertPolicyCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSecurityAlertPolicyCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(SqlSecurityAlertPolicyName securityAlertPol } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ServerSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerSecurityAlertPolicyServerSecurityAlertPoliciesClientDiagnostics.CreateScope("SqlServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerSecurityAlertPolicyServerSecurityAlertPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSecurityAlertPolicyResource(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.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName} + /// + /// + /// Operation Id + /// ServerSecurityAlertPolicies_Get + /// + /// + /// + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlSecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerSecurityAlertPolicyServerSecurityAlertPoliciesClientDiagnostics.CreateScope("SqlServerSecurityAlertPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerSecurityAlertPolicyServerSecurityAlertPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, securityAlertPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSecurityAlertPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineCollection.cs index 896f18430715..92f75d025c09 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineCollection.cs @@ -309,6 +309,72 @@ public virtual Response Exists(SqlVulnerabilityAssessmentBaselineName base } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentBaseline_Get + /// + /// + /// + /// The SqlVulnerabilityAssessmentBaselineName to use. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SqlVulnerabilityAssessmentBaselineName baselineName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerSqlVulnerabilityAssessmentBaselineSqlVulnerabilityAssessmentBaselineClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerSqlVulnerabilityAssessmentBaselineSqlVulnerabilityAssessmentBaselineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, baselineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentBaselineResource(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.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentBaseline_Get + /// + /// + /// + /// The SqlVulnerabilityAssessmentBaselineName to use. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SqlVulnerabilityAssessmentBaselineName baselineName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerSqlVulnerabilityAssessmentBaselineSqlVulnerabilityAssessmentBaselineClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentBaselineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerSqlVulnerabilityAssessmentBaselineSqlVulnerabilityAssessmentBaselineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, baselineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentBaselineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.cs index a5727913ff87..b43ff95413b9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string ruleId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentRuleBaseline_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _sqlServerSqlVulnerabilityAssessmentBaselineRuleSqlVulnerabilityAssessmentRuleBaselineClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerSqlVulnerabilityAssessmentBaselineRuleSqlVulnerabilityAssessmentRuleBaselineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentBaselineRuleResource(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.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentRuleBaseline_Get + /// + /// + /// + /// The vulnerability assessment rule ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleId, nameof(ruleId)); + + using var scope = _sqlServerSqlVulnerabilityAssessmentBaselineRuleSqlVulnerabilityAssessmentRuleBaselineClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerSqlVulnerabilityAssessmentBaselineRuleSqlVulnerabilityAssessmentRuleBaselineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentBaselineRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentCollection.cs index 976af01be413..812a9e4d4bae 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(VulnerabilityAssessmentName vulnerabilityAs } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentsSettings_Get + /// + /// + /// + /// The name of the SQL Vulnerability Assessment. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerSqlVulnerabilityAssessmentSqlVulnerabilityAssessmentsSettingsClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerSqlVulnerabilityAssessmentSqlVulnerabilityAssessmentsSettingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentResource(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.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentsSettings_Get + /// + /// + /// + /// The name of the SQL Vulnerability Assessment. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerSqlVulnerabilityAssessmentSqlVulnerabilityAssessmentsSettingsClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerSqlVulnerabilityAssessmentSqlVulnerabilityAssessmentsSettingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanCollection.cs index 06b6e538af44..555254bc9b96 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string scanId, CancellationToken cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _sqlServerSqlVulnerabilityAssessmentScanSqlVulnerabilityAssessmentScansClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerSqlVulnerabilityAssessmentScanSqlVulnerabilityAssessmentScansRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentScanResource(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.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scanId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanId, nameof(scanId)); + + using var scope = _sqlServerSqlVulnerabilityAssessmentScanSqlVulnerabilityAssessmentScansClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentScanCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerSqlVulnerabilityAssessmentScanSqlVulnerabilityAssessmentScansRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scanId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentScanResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResultCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResultCollection.cs index 1b6947a7e0ac..fc4d4d158d2b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResultCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResultCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string scanResultId, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults/{scanResultId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScanResult_Get + /// + /// + /// + /// The scan result id of the specific result to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scanResultId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanResultId, nameof(scanResultId)); + + using var scope = _sqlServerSqlVulnerabilityAssessmentScanResultSqlVulnerabilityAssessmentScanResultClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentScanResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerSqlVulnerabilityAssessmentScanResultSqlVulnerabilityAssessmentScanResultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanResultId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentScanResultResource(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.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults/{scanResultId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScanResult_Get + /// + /// + /// + /// The scan result id of the specific result to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scanResultId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scanResultId, nameof(scanResultId)); + + using var scope = _sqlServerSqlVulnerabilityAssessmentScanResultSqlVulnerabilityAssessmentScanResultClientDiagnostics.CreateScope("SqlServerSqlVulnerabilityAssessmentScanResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerSqlVulnerabilityAssessmentScanResultSqlVulnerabilityAssessmentScanResultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, scanResultId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerSqlVulnerabilityAssessmentScanResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerTrustGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerTrustGroupCollection.cs index 3cac920a184d..a08e56d4e2ab 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerTrustGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerTrustGroupCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string serverTrustGroupName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} + /// + /// + /// Operation Id + /// ServerTrustGroups_Get + /// + /// + /// + /// The name of the server trust group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverTrustGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverTrustGroupName, nameof(serverTrustGroupName)); + + using var scope = _sqlServerTrustGroupServerTrustGroupsClientDiagnostics.CreateScope("SqlServerTrustGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerTrustGroupServerTrustGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_locationName), serverTrustGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerTrustGroupResource(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.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} + /// + /// + /// Operation Id + /// ServerTrustGroups_Get + /// + /// + /// + /// The name of the server trust group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverTrustGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverTrustGroupName, nameof(serverTrustGroupName)); + + using var scope = _sqlServerTrustGroupServerTrustGroupsClientDiagnostics.CreateScope("SqlServerTrustGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerTrustGroupServerTrustGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_locationName), serverTrustGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerTrustGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVirtualNetworkRuleCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVirtualNetworkRuleCollection.cs index 39edcf912ecb..c8cb094494a7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVirtualNetworkRuleCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVirtualNetworkRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string virtualNetworkRuleName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkRules_Get + /// + /// + /// + /// The name of the virtual network rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkRuleName, nameof(virtualNetworkRuleName)); + + using var scope = _sqlServerVirtualNetworkRuleVirtualNetworkRulesClientDiagnostics.CreateScope("SqlServerVirtualNetworkRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerVirtualNetworkRuleVirtualNetworkRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerVirtualNetworkRuleResource(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.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkRules_Get + /// + /// + /// + /// The name of the virtual network rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkRuleName, nameof(virtualNetworkRuleName)); + + using var scope = _sqlServerVirtualNetworkRuleVirtualNetworkRulesClientDiagnostics.CreateScope("SqlServerVirtualNetworkRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerVirtualNetworkRuleVirtualNetworkRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerVirtualNetworkRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVulnerabilityAssessmentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVulnerabilityAssessmentCollection.cs index c250fe134deb..d9b68549e17c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVulnerabilityAssessmentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVulnerabilityAssessmentCollection.cs @@ -304,6 +304,72 @@ public virtual Response Exists(VulnerabilityAssessmentName vulnerabilityAs } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// ServerVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerVulnerabilityAssessmentServerVulnerabilityAssessmentsClientDiagnostics.CreateScope("SqlServerVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlServerVulnerabilityAssessmentServerVulnerabilityAssessmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerVulnerabilityAssessmentResource(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.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName} + /// + /// + /// Operation Id + /// ServerVulnerabilityAssessments_Get + /// + /// + /// + /// The name of the vulnerability assessment. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + { + using var scope = _sqlServerVulnerabilityAssessmentServerVulnerabilityAssessmentsClientDiagnostics.CreateScope("SqlServerVulnerabilityAssessmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlServerVulnerabilityAssessmentServerVulnerabilityAssessmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vulnerabilityAssessmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlServerVulnerabilityAssessmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlTimeZoneCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlTimeZoneCollection.cs index 447e84941dd0..637109676d59 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlTimeZoneCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlTimeZoneCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string timeZoneId, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} + /// + /// + /// Operation Id + /// TimeZones_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string timeZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(timeZoneId, nameof(timeZoneId)); + + using var scope = _sqlTimeZoneTimeZonesClientDiagnostics.CreateScope("SqlTimeZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlTimeZoneTimeZonesRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_locationName), timeZoneId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlTimeZoneResource(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}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} + /// + /// + /// Operation Id + /// TimeZones_Get + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string timeZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(timeZoneId, nameof(timeZoneId)); + + using var scope = _sqlTimeZoneTimeZonesClientDiagnostics.CreateScope("SqlTimeZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlTimeZoneTimeZonesRestClient.Get(Id.SubscriptionId, new AzureLocation(_locationName), timeZoneId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlTimeZoneResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupCollection.cs index bdbfefac8f89..19a15d74aaff 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupCollection.cs @@ -258,6 +258,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionBackups_Get + /// + /// + /// + /// The backup name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _subscriptionLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionLongTermRetentionBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionLongTermRetentionBackupLongTermRetentionBackupsRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_locationName), _longTermRetentionServerName, _longTermRetentionDatabaseName, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionLongTermRetentionBackupResource(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}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionBackups_Get + /// + /// + /// + /// The backup name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _subscriptionLongTermRetentionBackupLongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionLongTermRetentionBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionLongTermRetentionBackupLongTermRetentionBackupsRestClient.Get(Id.SubscriptionId, new AzureLocation(_locationName), _longTermRetentionServerName, _longTermRetentionDatabaseName, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionLongTermRetentionBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionManagedInstanceBackupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionManagedInstanceBackupCollection.cs index 86a9dab33f20..fa413df78615 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionManagedInstanceBackupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionManagedInstanceBackupCollection.cs @@ -258,6 +258,80 @@ public virtual Response Exists(string backupName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_Get + /// + /// + /// + /// The backup name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _subscriptionLongTermRetentionManagedInstanceBackupLongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionLongTermRetentionManagedInstanceBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionLongTermRetentionManagedInstanceBackupLongTermRetentionManagedInstanceBackupsRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_locationName), _managedInstanceName, _databaseName, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionLongTermRetentionManagedInstanceBackupResource(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}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_Get + /// + /// + /// + /// The backup name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using var scope = _subscriptionLongTermRetentionManagedInstanceBackupLongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionLongTermRetentionManagedInstanceBackupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionLongTermRetentionManagedInstanceBackupLongTermRetentionManagedInstanceBackupsRestClient.Get(Id.SubscriptionId, new AzureLocation(_locationName), _managedInstanceName, _databaseName, backupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsageCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsageCollection.cs index db9bd843ef97..a0caa75da37a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsageCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsageCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string usageName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} + /// + /// + /// Operation Id + /// SubscriptionUsages_Get + /// + /// + /// + /// Name of usage metric to return. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string usageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(usageName, nameof(usageName)); + + using var scope = _subscriptionUsageClientDiagnostics.CreateScope("SubscriptionUsageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _subscriptionUsageRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_locationName), usageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionUsageResource(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}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} + /// + /// + /// Operation Id + /// SubscriptionUsages_Get + /// + /// + /// + /// Name of usage metric to return. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string usageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(usageName, nameof(usageName)); + + using var scope = _subscriptionUsageClientDiagnostics.CreateScope("SubscriptionUsageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _subscriptionUsageRestClient.Get(Id.SubscriptionId, new AzureLocation(_locationName), usageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SubscriptionUsageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentCollection.cs index 81db6c0d9437..4d50247acff4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string syncAgentName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName} + /// + /// + /// Operation Id + /// SyncAgents_Get + /// + /// + /// + /// The name of the sync agent. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string syncAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(syncAgentName, nameof(syncAgentName)); + + using var scope = _syncAgentClientDiagnostics.CreateScope("SyncAgentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _syncAgentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, syncAgentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SyncAgentResource(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.Sql/servers/{serverName}/syncAgents/{syncAgentName} + /// + /// + /// Operation Id + /// SyncAgents_Get + /// + /// + /// + /// The name of the sync agent. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string syncAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(syncAgentName, nameof(syncAgentName)); + + using var scope = _syncAgentClientDiagnostics.CreateScope("SyncAgentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _syncAgentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, syncAgentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SyncAgentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupCollection.cs index d513465d190d..80b37545e77e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string syncGroupName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName} + /// + /// + /// Operation Id + /// SyncGroups_Get + /// + /// + /// + /// The name of the sync group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string syncGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(syncGroupName, nameof(syncGroupName)); + + using var scope = _syncGroupClientDiagnostics.CreateScope("SyncGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _syncGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, syncGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SyncGroupResource(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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName} + /// + /// + /// Operation Id + /// SyncGroups_Get + /// + /// + /// + /// The name of the sync group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string syncGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(syncGroupName, nameof(syncGroupName)); + + using var scope = _syncGroupClientDiagnostics.CreateScope("SyncGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _syncGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, syncGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SyncGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMemberCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMemberCollection.cs index 8605319b7b0a..6dd22c4effd6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMemberCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMemberCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string syncMemberName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName} + /// + /// + /// Operation Id + /// SyncMembers_Get + /// + /// + /// + /// The name of the sync member. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string syncMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(syncMemberName, nameof(syncMemberName)); + + using var scope = _syncMemberClientDiagnostics.CreateScope("SyncMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _syncMemberRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, syncMemberName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SyncMemberResource(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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName} + /// + /// + /// Operation Id + /// SyncMembers_Get + /// + /// + /// + /// The name of the sync member. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string syncMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(syncMemberName, nameof(syncMemberName)); + + using var scope = _syncMemberClientDiagnostics.CreateScope("SyncMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = _syncMemberRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, syncMemberName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SyncMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClusterCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClusterCollection.cs index 5c49f3070886..7fb74406a018 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClusterCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClusterCollection.cs @@ -242,6 +242,80 @@ public virtual Response Exists(string virtualClusterName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} + /// + /// + /// Operation Id + /// VirtualClusters_Get + /// + /// + /// + /// The name of the virtual cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualClusterName, nameof(virtualClusterName)); + + using var scope = _virtualClusterClientDiagnostics.CreateScope("VirtualClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualClusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualClusterResource(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.Sql/virtualClusters/{virtualClusterName} + /// + /// + /// Operation Id + /// VirtualClusters_Get + /// + /// + /// + /// The name of the virtual cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualClusterName, nameof(virtualClusterName)); + + using var scope = _virtualClusterClientDiagnostics.CreateScope("VirtualClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualClusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifierCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifierCollection.cs index 04fed886b2e5..500a172e23a9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifierCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifierCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string workloadClassifierName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName} + /// + /// + /// Operation Id + /// WorkloadClassifiers_Get + /// + /// + /// + /// The name of the workload classifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workloadClassifierName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadClassifierName, nameof(workloadClassifierName)); + + using var scope = _workloadClassifierClientDiagnostics.CreateScope("WorkloadClassifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadClassifierRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, workloadClassifierName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadClassifierResource(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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName} + /// + /// + /// Operation Id + /// WorkloadClassifiers_Get + /// + /// + /// + /// The name of the workload classifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workloadClassifierName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadClassifierName, nameof(workloadClassifierName)); + + using var scope = _workloadClassifierClientDiagnostics.CreateScope("WorkloadClassifierCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadClassifierRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, workloadClassifierName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadClassifierResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupCollection.cs index a90558669525..9c4297daaa23 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string workloadGroupName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName} + /// + /// + /// Operation Id + /// WorkloadGroups_Get + /// + /// + /// + /// The name of the workload group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workloadGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadGroupName, nameof(workloadGroupName)); + + using var scope = _workloadGroupClientDiagnostics.CreateScope("WorkloadGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadGroupResource(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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName} + /// + /// + /// Operation Id + /// WorkloadGroups_Get + /// + /// + /// + /// The name of the workload group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workloadGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadGroupName, nameof(workloadGroupName)); + + using var scope = _workloadGroupClientDiagnostics.CreateScope("WorkloadGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_AvailabilityGroupListenerCollection.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_AvailabilityGroupListenerCollection.cs index 8c918e90b58c..be210b8a8570 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_AvailabilityGroupListenerCollection.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_AvailabilityGroupListenerCollection.cs @@ -85,6 +85,49 @@ public async Task Exists_GetsAnAvailabilityGroupListener() Console.WriteLine($"Succeeded: {result}"); } + // Gets an availability group listener. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAnAvailabilityGroupListener() + { + // Generated from example definition: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/stable/2022-02-01/examples/GetAvailabilityGroupListener.json + // this example is just showing the usage of "AvailabilityGroupListeners_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 SqlVmGroupResource created on azure + // for more information of creating SqlVmGroupResource, please refer to the document of SqlVmGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + string sqlVmGroupName = "testvmgroup"; + ResourceIdentifier sqlVmGroupResourceId = SqlVmGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, sqlVmGroupName); + SqlVmGroupResource sqlVmGroup = client.GetSqlVmGroupResource(sqlVmGroupResourceId); + + // get the collection of this AvailabilityGroupListenerResource + AvailabilityGroupListenerCollection collection = sqlVmGroup.GetAvailabilityGroupListeners(); + + // invoke the operation + string availabilityGroupListenerName = "agl-test"; + NullableResponse response = await collection.GetIfExistsAsync(availabilityGroupListenerName); + AvailabilityGroupListenerResource 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 + AvailabilityGroupListenerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates an availability group listener using load balancer. This is used for VMs present in single subnet. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_SqlVmCollection.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_SqlVmCollection.cs index 7021a42a53ba..b4142fac1efe 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_SqlVmCollection.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_SqlVmCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_GetsASQLVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + // Gets a SQL virtual machine. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsASQLVirtualMachine() + { + // Generated from example definition: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/stable/2022-02-01/examples/GetSqlVirtualMachine.json + // this example is just showing the usage of "SqlVirtualMachines_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SqlVmResource + SqlVmCollection collection = resourceGroupResource.GetSqlVms(); + + // invoke the operation + string sqlVmName = "testvm"; + NullableResponse response = await collection.GetIfExistsAsync(sqlVmName); + SqlVmResource 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 + SqlVmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a SQL virtual machine and joins it to a SQL virtual machine group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_SqlVmGroupCollection.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_SqlVmGroupCollection.cs index 1f4b93dde26f..5d92f15594dc 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_SqlVmGroupCollection.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/samples/Generated/Samples/Sample_SqlVmGroupCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_GetsASQLVirtualMachineGroup() Console.WriteLine($"Succeeded: {result}"); } + // Gets a SQL virtual machine group. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsASQLVirtualMachineGroup() + { + // Generated from example definition: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/stable/2022-02-01/examples/GetSqlVirtualMachineGroup.json + // this example is just showing the usage of "SqlVirtualMachineGroups_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SqlVmGroupResource + SqlVmGroupCollection collection = resourceGroupResource.GetSqlVmGroups(); + + // invoke the operation + string sqlVmGroupName = "testvmgroup"; + NullableResponse response = await collection.GetIfExistsAsync(sqlVmGroupName); + SqlVmGroupResource 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 + SqlVmGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Creates or updates a SQL virtual machine group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/AvailabilityGroupListenerCollection.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/AvailabilityGroupListenerCollection.cs index a2cc007597e7..b88b14df9e68 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/AvailabilityGroupListenerCollection.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/AvailabilityGroupListenerCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string availabilityGroupListenerName, strin } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners/{availabilityGroupListenerName} + /// + /// + /// Operation Id + /// AvailabilityGroupListeners_Get + /// + /// + /// + /// Name of the availability group listener. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string availabilityGroupListenerName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(availabilityGroupListenerName, nameof(availabilityGroupListenerName)); + + using var scope = _availabilityGroupListenerClientDiagnostics.CreateScope("AvailabilityGroupListenerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _availabilityGroupListenerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, availabilityGroupListenerName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvailabilityGroupListenerResource(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.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners/{availabilityGroupListenerName} + /// + /// + /// Operation Id + /// AvailabilityGroupListeners_Get + /// + /// + /// + /// Name of the availability group listener. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string availabilityGroupListenerName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(availabilityGroupListenerName, nameof(availabilityGroupListenerName)); + + using var scope = _availabilityGroupListenerClientDiagnostics.CreateScope("AvailabilityGroupListenerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _availabilityGroupListenerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, availabilityGroupListenerName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvailabilityGroupListenerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmCollection.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmCollection.cs index 93ff583dc64a..eb89e9ba7d49 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmCollection.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string sqlVmName, string expand = null, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName} + /// + /// + /// Operation Id + /// SqlVirtualMachines_Get + /// + /// + /// + /// Name of the SQL virtual machine. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sqlVmName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlVmName, nameof(sqlVmName)); + + using var scope = _sqlVmSqlVirtualMachinesClientDiagnostics.CreateScope("SqlVmCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlVmSqlVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, sqlVmName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlVmResource(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.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName} + /// + /// + /// Operation Id + /// SqlVirtualMachines_Get + /// + /// + /// + /// Name of the SQL virtual machine. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sqlVmName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlVmName, nameof(sqlVmName)); + + using var scope = _sqlVmSqlVirtualMachinesClientDiagnostics.CreateScope("SqlVmCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlVmSqlVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, sqlVmName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlVmResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupCollection.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupCollection.cs index dc6f78480c99..1c4c79b61400 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupCollection.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string sqlVmGroupName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName} + /// + /// + /// Operation Id + /// SqlVirtualMachineGroups_Get + /// + /// + /// + /// Name of the SQL virtual machine group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sqlVmGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlVmGroupName, nameof(sqlVmGroupName)); + + using var scope = _sqlVmGroupSqlVmGroupsClientDiagnostics.CreateScope("SqlVmGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlVmGroupSqlVmGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, sqlVmGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlVmGroupResource(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.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName} + /// + /// + /// Operation Id + /// SqlVirtualMachineGroups_Get + /// + /// + /// + /// Name of the SQL virtual machine group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sqlVmGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlVmGroupName, nameof(sqlVmGroupName)); + + using var scope = _sqlVmGroupSqlVmGroupsClientDiagnostics.CreateScope("SqlVmGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlVmGroupSqlVmGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, sqlVmGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlVmGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); From 882937d99431e8a526b4e2a9be6115b674ec2616 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 21 Sep 2023 09:06:41 +0000 Subject: [PATCH 8/8] Update SDK codes --- ...e_CommunicationDomainResourceCollection.cs | 43 ++++ ..._CommunicationServiceResourceCollection.cs | 42 +++ .../Sample_EmailServiceResourceCollection.cs | 42 +++ ...Sample_SenderUsernameResourceCollection.cs | 44 ++++ .../CommunicationDomainResourceCollection.cs | 74 ++++++ .../CommunicationServiceResourceCollection.cs | 74 ++++++ .../EmailServiceResourceCollection.cs | 74 ++++++ .../SenderUsernameResourceCollection.cs | 74 ++++++ .../Sample_AvailabilitySetCollection.cs | 84 ++++++ .../Sample_CapacityReservationCollection.cs | 44 ++++ ...mple_CapacityReservationGroupCollection.cs | 43 ++++ .../Samples/Sample_CloudServiceCollection.cs | 42 +++ .../Sample_CloudServiceOSFamilyCollection.cs | 43 ++++ .../Sample_CloudServiceOSVersionCollection.cs | 43 ++++ .../Sample_CloudServiceRoleCollection.cs | 44 ++++ ...mple_CloudServiceRoleInstanceCollection.cs | 44 ++++ .../Sample_CommunityGalleryCollection.cs | 43 ++++ .../Sample_CommunityGalleryImageCollection.cs | 44 ++++ ..._CommunityGalleryImageVersionCollection.cs | 45 ++++ ...putePrivateEndpointConnectionCollection.cs | 43 ++++ .../Samples/Sample_DedicatedHostCollection.cs | 44 ++++ .../Sample_DedicatedHostGroupCollection.cs | 84 ++++++ .../Samples/Sample_DiskAccessCollection.cs | 84 ++++++ .../Sample_DiskEncryptionSetCollection.cs | 84 ++++++ .../Samples/Sample_DiskImageCollection.cs | 42 +++ .../Sample_DiskRestorePointCollection.cs | 89 +++++++ .../Sample_GalleryApplicationCollection.cs | 43 ++++ ...ple_GalleryApplicationVersionCollection.cs | 89 +++++++ .../Samples/Sample_GalleryCollection.cs | 170 +++++++++++++ .../Samples/Sample_GalleryImageCollection.cs | 43 ++++ .../Sample_GalleryImageVersionCollection.cs | 177 +++++++++++++ .../Samples/Sample_ManagedDiskCollection.cs | 42 +++ ...ample_ProximityPlacementGroupCollection.cs | 42 +++ .../Samples/Sample_RestorePointCollection.cs | 86 +++++++ .../Sample_RestorePointGroupCollection.cs | 84 ++++++ .../Samples/Sample_SharedGalleryCollection.cs | 43 ++++ .../Sample_SharedGalleryImageCollection.cs | 44 ++++ ...ple_SharedGalleryImageVersionCollection.cs | 45 ++++ .../Samples/Sample_SnapshotCollection.cs | 84 ++++++ .../Samples/Sample_SshPublicKeyCollection.cs | 42 +++ .../Sample_VirtualMachineCollection.cs | 170 +++++++++++++ ...ample_VirtualMachineExtensionCollection.cs | 87 +++++++ ..._VirtualMachineExtensionImageCollection.cs | 89 +++++++ ...mple_VirtualMachineRunCommandCollection.cs | 43 ++++ ...Sample_VirtualMachineScaleSetCollection.cs | 170 +++++++++++++ ...rtualMachineScaleSetExtensionCollection.cs | 87 +++++++ ...mple_VirtualMachineScaleSetVmCollection.cs | 86 +++++++ ...ualMachineScaleSetVmExtensionCollection.cs | 44 ++++ ...alMachineScaleSetVmRunCommandCollection.cs | 44 ++++ .../Generated/AvailabilitySetCollection.cs | 74 ++++++ .../CapacityReservationCollection.cs | 76 ++++++ .../CapacityReservationGroupCollection.cs | 76 ++++++ .../src/Generated/CloudServiceCollection.cs | 74 ++++++ .../CloudServiceOSFamilyCollection.cs | 74 ++++++ .../CloudServiceOSVersionCollection.cs | 74 ++++++ .../Generated/CloudServiceRoleCollection.cs | 74 ++++++ .../CloudServiceRoleInstanceCollection.cs | 76 ++++++ .../Generated/CommunityGalleryCollection.cs | 78 ++++++ .../CommunityGalleryImageCollection.cs | 76 ++++++ .../CommunityGalleryImageVersionCollection.cs | 76 ++++++ ...putePrivateEndpointConnectionCollection.cs | 74 ++++++ .../src/Generated/DedicatedHostCollection.cs | 76 ++++++ .../Generated/DedicatedHostGroupCollection.cs | 76 ++++++ .../src/Generated/DiskAccessCollection.cs | 74 ++++++ .../Generated/DiskEncryptionSetCollection.cs | 74 ++++++ .../src/Generated/DiskImageCollection.cs | 76 ++++++ .../Generated/DiskRestorePointCollection.cs | 74 ++++++ .../Generated/GalleryApplicationCollection.cs | 74 ++++++ .../GalleryApplicationVersionCollection.cs | 76 ++++++ .../src/Generated/GalleryCollection.cs | 78 ++++++ .../src/Generated/GalleryImageCollection.cs | 74 ++++++ .../GalleryImageVersionCollection.cs | 76 ++++++ .../src/Generated/ManagedDiskCollection.cs | 74 ++++++ .../ProximityPlacementGroupCollection.cs | 76 ++++++ .../src/Generated/RestorePointCollection.cs | 76 ++++++ .../Generated/RestorePointGroupCollection.cs | 76 ++++++ .../src/Generated/SharedGalleryCollection.cs | 76 ++++++ .../Generated/SharedGalleryImageCollection.cs | 76 ++++++ .../SharedGalleryImageVersionCollection.cs | 76 ++++++ .../src/Generated/SnapshotCollection.cs | 74 ++++++ .../src/Generated/SshPublicKeyCollection.cs | 74 ++++++ .../src/Generated/VirtualMachineCollection.cs | 76 ++++++ .../VirtualMachineExtensionCollection.cs | 76 ++++++ .../VirtualMachineExtensionImageCollection.cs | 78 ++++++ .../VirtualMachineRunCommandCollection.cs | 76 ++++++ .../VirtualMachineScaleSetCollection.cs | 76 ++++++ ...rtualMachineScaleSetExtensionCollection.cs | 76 ++++++ .../VirtualMachineScaleSetVmCollection.cs | 76 ++++++ ...ualMachineScaleSetVmExtensionCollection.cs | 76 ++++++ ...alMachineScaleSetVmRunCommandCollection.cs | 76 ++++++ .../Sample_ConfidentialLedgerCollection.cs | 42 +++ .../Samples/Sample_ManagedCcfCollection.cs | 42 +++ .../Generated/ConfidentialLedgerCollection.cs | 74 ++++++ .../src/Generated/ManagedCcfCollection.cs | 74 ++++++ .../Sample_ConfluentOrganizationCollection.cs | 42 +++ .../ConfluentOrganizationCollection.cs | 74 ++++++ .../Samples/Sample_GuestAgentCollection.cs | 43 ++++ ...Sample_HybridIdentityMetadataCollection.cs | 43 ++++ .../Samples/Sample_InventoryItemCollection.cs | 43 ++++ .../Sample_MachineExtensionCollection.cs | 43 ++++ .../Samples/Sample_ResourcePoolCollection.cs | 42 +++ .../Samples/Sample_VCenterCollection.cs | 42 +++ .../Samples/Sample_VMwareClusterCollection.cs | 42 +++ .../Sample_VMwareDatastoreCollection.cs | 42 +++ .../Samples/Sample_VMwareHostCollection.cs | 42 +++ .../Sample_VirtualMachineCollection.cs | 42 +++ ...Sample_VirtualMachineTemplateCollection.cs | 42 +++ .../Sample_VirtualNetworkCollection.cs | 42 +++ .../src/Generated/GuestAgentCollection.cs | 74 ++++++ .../HybridIdentityMetadataCollection.cs | 74 ++++++ .../src/Generated/InventoryItemCollection.cs | 74 ++++++ .../Generated/MachineExtensionCollection.cs | 74 ++++++ .../src/Generated/ResourcePoolCollection.cs | 74 ++++++ .../src/Generated/VCenterCollection.cs | 74 ++++++ .../src/Generated/VMwareClusterCollection.cs | 74 ++++++ .../Generated/VMwareDatastoreCollection.cs | 74 ++++++ .../src/Generated/VMwareHostCollection.cs | 74 ++++++ .../src/Generated/VirtualMachineCollection.cs | 74 ++++++ .../VirtualMachineTemplateCollection.cs | 74 ++++++ .../src/Generated/VirtualNetworkCollection.cs | 74 ++++++ .../Sample_ConsumptionBudgetCollection.cs | 41 +++ .../Generated/ConsumptionBudgetCollection.cs | 74 ++++++ ...Sample_ContainerAppAuthConfigCollection.cs | 43 ++++ .../Samples/Sample_ContainerAppCollection.cs | 42 +++ ...nnectedEnvironmentCertificateCollection.cs | 43 ++++ ...tainerAppConnectedEnvironmentCollection.cs | 42 +++ ...ectedEnvironmentDaprComponentCollection.cs | 43 ++++ ...ppConnectedEnvironmentStorageCollection.cs | 43 ++++ .../Sample_ContainerAppDetectorCollection.cs | 44 ++++ ...erAppDetectorPropertyRevisionCollection.cs | 44 ++++ .../Sample_ContainerAppJobCollection.cs | 42 +++ ...mple_ContainerAppJobExecutionCollection.cs | 44 ++++ ...ontainerAppManagedCertificateCollection.cs | 43 ++++ ...ManagedEnvironmentCertificateCollection.cs | 43 ++++ ...ontainerAppManagedEnvironmentCollection.cs | 42 +++ ...nagedEnvironmentDaprComponentCollection.cs | 86 +++++++ ...AppManagedEnvironmentDetectorCollection.cs | 44 ++++ ...rAppManagedEnvironmentStorageCollection.cs | 43 ++++ .../Sample_ContainerAppReplicaCollection.cs | 45 ++++ .../Sample_ContainerAppRevisionCollection.cs | 44 ++++ ...ple_ContainerAppSourceControlCollection.cs | 43 ++++ .../ContainerAppAuthConfigCollection.cs | 74 ++++++ .../src/Generated/ContainerAppCollection.cs | 74 ++++++ ...nnectedEnvironmentCertificateCollection.cs | 74 ++++++ ...tainerAppConnectedEnvironmentCollection.cs | 74 ++++++ ...ectedEnvironmentDaprComponentCollection.cs | 74 ++++++ ...ppConnectedEnvironmentStorageCollection.cs | 74 ++++++ .../ContainerAppDetectorCollection.cs | 74 ++++++ ...erAppDetectorPropertyRevisionCollection.cs | 74 ++++++ .../Generated/ContainerAppJobCollection.cs | 74 ++++++ .../ContainerAppJobExecutionCollection.cs | 74 ++++++ ...ontainerAppManagedCertificateCollection.cs | 74 ++++++ ...ManagedEnvironmentCertificateCollection.cs | 74 ++++++ ...ontainerAppManagedEnvironmentCollection.cs | 74 ++++++ ...nagedEnvironmentDaprComponentCollection.cs | 74 ++++++ ...AppManagedEnvironmentDetectorCollection.cs | 74 ++++++ ...rAppManagedEnvironmentStorageCollection.cs | 74 ++++++ .../ContainerAppReplicaCollection.cs | 74 ++++++ .../ContainerAppRevisionCollection.cs | 74 ++++++ .../ContainerAppSourceControlCollection.cs | 74 ++++++ .../Sample_ContainerGroupCollection.cs | 126 +++++++++ .../src/Generated/ContainerGroupCollection.cs | 74 ++++++ ...le_ContainerRegistryAgentPoolCollection.cs | 43 ++++ .../Sample_ContainerRegistryCollection.cs | 42 +++ ...stryPrivateEndpointConnectionCollection.cs | 43 ++++ ...erRegistryPrivateLinkResourceCollection.cs | 44 ++++ ..._ContainerRegistryReplicationCollection.cs | 43 ++++ .../Sample_ContainerRegistryRunCollection.cs | 44 ++++ .../Sample_ContainerRegistryTaskCollection.cs | 43 ++++ ...mple_ContainerRegistryTaskRunCollection.cs | 43 ++++ ...Sample_ContainerRegistryTokenCollection.cs | 43 ++++ ...mple_ContainerRegistryWebhookCollection.cs | 43 ++++ .../Samples/Sample_ScopeMapCollection.cs | 43 ++++ .../ContainerRegistryAgentPoolCollection.cs | 74 ++++++ .../Generated/ContainerRegistryCollection.cs | 74 ++++++ ...stryPrivateEndpointConnectionCollection.cs | 74 ++++++ ...erRegistryPrivateLinkResourceCollection.cs | 74 ++++++ .../ContainerRegistryReplicationCollection.cs | 74 ++++++ .../ContainerRegistryRunCollection.cs | 74 ++++++ .../ContainerRegistryTaskCollection.cs | 74 ++++++ .../ContainerRegistryTaskRunCollection.cs | 74 ++++++ .../ContainerRegistryTokenCollection.cs | 74 ++++++ .../ContainerRegistryWebhookCollection.cs | 74 ++++++ .../src/Generated/ScopeMapCollection.cs | 74 ++++++ .../Generated/AgentPoolSnapshotCollection.cs | 74 ++++++ .../ContainerServiceAgentPoolCollection.cs | 74 ++++++ .../ContainerServiceFleetCollection.cs | 74 ++++++ .../ContainerServiceFleetMemberCollection.cs | 74 ++++++ ...rviceMaintenanceConfigurationCollection.cs | 74 ++++++ ...ontainerServiceManagedClusterCollection.cs | 74 ++++++ ...vicePrivateEndpointConnectionCollection.cs | 74 ++++++ ...rviceTrustedAccessRoleBindingCollection.cs | 74 ++++++ .../ManagedClusterSnapshotCollection.cs | 74 ++++++ ...assandraClusterBackupResourceCollection.cs | 74 ++++++ .../Generated/CassandraClusterCollection.cs | 74 ++++++ .../CassandraDataCenterCollection.cs | 74 ++++++ .../Generated/CassandraKeyspaceCollection.cs | 74 ++++++ .../src/Generated/CassandraTableCollection.cs | 74 ++++++ .../CassandraViewGetResultCollection.cs | 74 ++++++ .../Generated/CosmosDBAccountCollection.cs | 74 ++++++ .../CosmosDBFirewallRuleCollection.cs | 74 ++++++ .../Generated/CosmosDBLocationCollection.cs | 66 +++++ ...osDBPrivateEndpointConnectionCollection.cs | 74 ++++++ .../CosmosDBPrivateLinkResourceCollection.cs | 74 ++++++ .../Generated/CosmosDBServiceCollection.cs | 74 ++++++ ...osmosDBSqlClientEncryptionKeyCollection.cs | 74 ++++++ .../CosmosDBSqlContainerCollection.cs | 74 ++++++ .../CosmosDBSqlDatabaseCollection.cs | 74 ++++++ .../CosmosDBSqlRoleAssignmentCollection.cs | 74 ++++++ .../CosmosDBSqlRoleDefinitionCollection.cs | 74 ++++++ .../CosmosDBSqlStoredProcedureCollection.cs | 74 ++++++ .../Generated/CosmosDBSqlTriggerCollection.cs | 74 ++++++ ...osmosDBSqlUserDefinedFunctionCollection.cs | 74 ++++++ .../src/Generated/CosmosDBTableCollection.cs | 74 ++++++ .../DataTransferJobGetResultCollection.cs | 74 ++++++ .../GraphResourceGetResultCollection.cs | 74 ++++++ .../Generated/GremlinDatabaseCollection.cs | 74 ++++++ .../src/Generated/GremlinGraphCollection.cs | 74 ++++++ .../src/Generated/MongoClusterCollection.cs | 74 ++++++ .../Generated/MongoDBCollectionCollection.cs | 74 ++++++ .../Generated/MongoDBDatabaseCollection.cs | 74 ++++++ .../MongoDBRoleDefinitionCollection.cs | 74 ++++++ .../MongoDBUserDefinitionCollection.cs | 74 ++++++ .../RestorableCosmosDBAccountCollection.cs | 66 +++++ ..._CosmosDBForPostgreSqlClusterCollection.cs | 42 +++ ...sDBForPostgreSqlClusterServerCollection.cs | 44 ++++ ...sDBForPostgreSqlConfigurationCollection.cs | 44 ++++ ...reSqlCoordinatorConfigurationCollection.cs | 43 ++++ ...osDBForPostgreSqlFirewallRuleCollection.cs | 43 ++++ ...orPostgreSqlNodeConfigurationCollection.cs | 43 ++++ ...eSqlPrivateEndpointConnectionCollection.cs | 43 ++++ ...PostgreSqlPrivateLinkResourceCollection.cs | 44 ++++ ...ple_CosmosDBForPostgreSqlRoleCollection.cs | 43 ++++ .../CosmosDBForPostgreSqlClusterCollection.cs | 74 ++++++ ...sDBForPostgreSqlClusterServerCollection.cs | 74 ++++++ ...sDBForPostgreSqlConfigurationCollection.cs | 74 ++++++ ...reSqlCoordinatorConfigurationCollection.cs | 74 ++++++ ...osDBForPostgreSqlFirewallRuleCollection.cs | 74 ++++++ ...orPostgreSqlNodeConfigurationCollection.cs | 74 ++++++ ...eSqlPrivateEndpointConnectionCollection.cs | 74 ++++++ ...PostgreSqlPrivateLinkResourceCollection.cs | 74 ++++++ .../CosmosDBForPostgreSqlRoleCollection.cs | 74 ++++++ .../Sample_CostManagementAlertCollection.cs | 81 ++++++ .../Sample_CostManagementExportCollection.cs | 240 ++++++++++++++++++ .../Sample_CostManagementViewsCollection.cs | 40 +++ .../Sample_ScheduledActionCollection.cs | 40 +++ .../Sample_TenantScheduledActionCollection.cs | 39 +++ ...le_TenantsCostManagementViewsCollection.cs | 39 +++ .../CostManagementAlertCollection.cs | 72 ++++++ .../CostManagementExportCollection.cs | 76 ++++++ .../CostManagementViewsCollection.cs | 74 ++++++ .../Generated/ScheduledActionCollection.cs | 74 ++++++ .../TenantScheduledActionCollection.cs | 74 ++++++ .../TenantsCostManagementViewsCollection.cs | 74 ++++++ ...orizationPolicyResourceFormatCollection.cs | 43 ++++ ...onnectorMappingResourceFormatCollection.cs | 44 ++++ ...ample_ConnectorResourceFormatCollection.cs | 43 ++++ .../Generated/Samples/Sample_HubCollection.cs | 42 +++ ...ple_InteractionResourceFormatCollection.cs | 43 ++++ .../Sample_KpiResourceFormatCollection.cs | 43 ++++ .../Sample_LinkResourceFormatCollection.cs | 43 ++++ ...mple_PredictionResourceFormatCollection.cs | 43 ++++ .../Sample_ProfileResourceFormatCollection.cs | 43 ++++ ...elationshipLinkResourceFormatCollection.cs | 43 ++++ ...le_RelationshipResourceFormatCollection.cs | 43 ++++ ..._RoleAssignmentResourceFormatCollection.cs | 43 ++++ .../Sample_ViewResourceFormatCollection.cs | 44 ++++ ...mple_WidgetTypeResourceFormatCollection.cs | 44 ++++ ...orizationPolicyResourceFormatCollection.cs | 74 ++++++ ...onnectorMappingResourceFormatCollection.cs | 74 ++++++ .../ConnectorResourceFormatCollection.cs | 74 ++++++ .../src/Generated/HubCollection.cs | 74 ++++++ .../InteractionResourceFormatCollection.cs | 76 ++++++ .../Generated/KpiResourceFormatCollection.cs | 74 ++++++ .../Generated/LinkResourceFormatCollection.cs | 74 ++++++ .../PredictionResourceFormatCollection.cs | 74 ++++++ .../ProfileResourceFormatCollection.cs | 76 ++++++ ...elationshipLinkResourceFormatCollection.cs | 74 ++++++ .../RelationshipResourceFormatCollection.cs | 74 ++++++ .../RoleAssignmentResourceFormatCollection.cs | 74 ++++++ .../Generated/ViewResourceFormatCollection.cs | 78 ++++++ .../WidgetTypeResourceFormatCollection.cs | 74 ++++++ .../Samples/Sample_DataBoxJobCollection.cs | 215 ++++++++++++++++ .../src/Generated/DataBoxJobCollection.cs | 76 ++++++ .../Sample_BandwidthScheduleCollection.cs | 43 ++++ .../Sample_DataBoxEdgeAlertCollection.cs | 44 ++++ .../Sample_DataBoxEdgeDeviceCollection.cs | 84 ++++++ .../Sample_DataBoxEdgeJobCollection.cs | 44 ++++ .../Sample_DataBoxEdgeRoleAddonCollection.cs | 44 ++++ .../Sample_DataBoxEdgeRoleCollection.cs | 43 ++++ .../Sample_DataBoxEdgeShareCollection.cs | 43 ++++ ...ple_DataBoxEdgeStorageAccountCollection.cs | 43 ++++ ...xEdgeStorageAccountCredentialCollection.cs | 43 ++++ ...e_DataBoxEdgeStorageContainerCollection.cs | 44 ++++ .../Sample_DataBoxEdgeTriggerCollection.cs | 43 ++++ .../Sample_DataBoxEdgeUserCollection.cs | 43 ++++ .../Generated/BandwidthScheduleCollection.cs | 74 ++++++ .../Generated/DataBoxEdgeAlertCollection.cs | 74 ++++++ .../Generated/DataBoxEdgeDeviceCollection.cs | 74 ++++++ .../src/Generated/DataBoxEdgeJobCollection.cs | 74 ++++++ .../DataBoxEdgeRoleAddonCollection.cs | 74 ++++++ .../Generated/DataBoxEdgeRoleCollection.cs | 74 ++++++ .../Generated/DataBoxEdgeShareCollection.cs | 74 ++++++ .../DataBoxEdgeStorageAccountCollection.cs | 74 ++++++ ...xEdgeStorageAccountCredentialCollection.cs | 74 ++++++ .../DataBoxEdgeStorageContainerCollection.cs | 74 ++++++ .../Generated/DataBoxEdgeTriggerCollection.cs | 74 ++++++ .../Generated/DataBoxEdgeUserCollection.cs | 74 ++++++ ...Sample_DatadogMonitorResourceCollection.cs | 42 +++ ...e_DatadogSingleSignOnResourceCollection.cs | 43 ++++ .../Sample_MonitoringTagRuleCollection.cs | 43 ++++ .../DatadogMonitorResourceCollection.cs | 74 ++++++ .../DatadogSingleSignOnResourceCollection.cs | 74 ++++++ .../Generated/MonitoringTagRuleCollection.cs | 74 ++++++ ..._DataFactoryChangeDataCaptureCollection.cs | 44 ++++ .../Samples/Sample_DataFactoryCollection.cs | 42 +++ .../Sample_DataFactoryDataFlowCollection.cs | 43 ++++ .../Sample_DataFactoryDatasetCollection.cs | 43 ++++ ...le_DataFactoryGlobalParameterCollection.cs | 43 ++++ ...DataFactoryIntegrationRuntimeCollection.cs | 43 ++++ ...mple_DataFactoryLinkedServiceCollection.cs | 43 ++++ ...toryManagedIdentityCredentialCollection.cs | 43 ++++ ...aFactoryManagedVirtualNetworkCollection.cs | 43 ++++ .../Sample_DataFactoryPipelineCollection.cs | 43 ++++ ...le_DataFactoryPrivateEndpointCollection.cs | 44 ++++ ...toryPrivateEndpointConnectionCollection.cs | 43 ++++ .../Sample_DataFactoryTriggerCollection.cs | 43 ++++ .../DataFactoryChangeDataCaptureCollection.cs | 76 ++++++ .../src/Generated/DataFactoryCollection.cs | 76 ++++++ .../DataFactoryDataFlowCollection.cs | 76 ++++++ .../Generated/DataFactoryDatasetCollection.cs | 76 ++++++ .../DataFactoryGlobalParameterCollection.cs | 74 ++++++ ...DataFactoryIntegrationRuntimeCollection.cs | 76 ++++++ .../DataFactoryLinkedServiceCollection.cs | 76 ++++++ ...toryManagedIdentityCredentialCollection.cs | 76 ++++++ ...aFactoryManagedVirtualNetworkCollection.cs | 76 ++++++ .../DataFactoryPipelineCollection.cs | 76 ++++++ .../DataFactoryPrivateEndpointCollection.cs | 76 ++++++ ...toryPrivateEndpointConnectionCollection.cs | 76 ++++++ .../Generated/DataFactoryTriggerCollection.cs | 76 ++++++ ...mple_DataLakeAnalyticsAccountCollection.cs | 42 +++ ...ataLakeAnalyticsComputePolicyCollection.cs | 43 ++++ ...DataLakeAnalyticsFirewallRuleCollection.cs | 43 ++++ ...ticsStorageAccountInformationCollection.cs | 43 ++++ ...LakeAnalyticsStorageContainerCollection.cs | 45 ++++ ...taLakeStoreAccountInformationCollection.cs | 43 ++++ .../DataLakeAnalyticsAccountCollection.cs | 74 ++++++ ...ataLakeAnalyticsComputePolicyCollection.cs | 74 ++++++ ...DataLakeAnalyticsFirewallRuleCollection.cs | 74 ++++++ ...ticsStorageAccountInformationCollection.cs | 74 ++++++ ...LakeAnalyticsStorageContainerCollection.cs | 74 ++++++ ...taLakeStoreAccountInformationCollection.cs | 74 ++++++ .../DataLakeStoreAccountCollection.cs | 74 ++++++ .../DataLakeStoreFirewallRuleCollection.cs | 74 ++++++ ...ataLakeStoreTrustedIdProviderCollection.cs | 74 ++++++ ...taLakeStoreVirtualNetworkRuleCollection.cs | 74 ++++++ .../Sample_DataMigrationServiceCollection.cs | 42 +++ ...Sample_DatabaseMigrationSqlDBCollection.cs | 87 +++++++ ...Sample_DatabaseMigrationSqlMICollection.cs | 87 +++++++ ...Sample_DatabaseMigrationSqlVmCollection.cs | 87 +++++++ .../Samples/Sample_ProjectCollection.cs | 43 ++++ .../Samples/Sample_ProjectFileCollection.cs | 44 ++++ .../Sample_ServiceProjectTaskCollection.cs | 44 ++++ .../Sample_ServiceServiceTaskCollection.cs | 43 ++++ .../Sample_SqlMigrationServiceCollection.cs | 42 +++ .../DataMigrationServiceCollection.cs | 74 ++++++ .../DatabaseMigrationSqlDBCollection.cs | 82 ++++++ .../DatabaseMigrationSqlMICollection.cs | 82 ++++++ .../DatabaseMigrationSqlVmCollection.cs | 82 ++++++ .../src/Generated/ProjectCollection.cs | 74 ++++++ .../src/Generated/ProjectFileCollection.cs | 74 ++++++ .../Generated/ServiceProjectTaskCollection.cs | 76 ++++++ .../Generated/ServiceServiceTaskCollection.cs | 76 ++++++ .../SqlMigrationServiceCollection.cs | 74 ++++++ 374 files changed, 24438 insertions(+) diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs index 0d2e9969b2ed..9fa8a43f016b 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetDomainsResource() Console.WriteLine($"Succeeded: {result}"); } + // Get Domains resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDomainsResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json + // this example is just showing the usage of "Domains_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 EmailServiceResource created on azure + // for more information of creating EmailServiceResource, please refer to the document of EmailServiceResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "MyResourceGroup"; + string emailServiceName = "MyEmailServiceResource"; + ResourceIdentifier emailServiceResourceId = EmailServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName); + EmailServiceResource emailServiceResource = client.GetEmailServiceResource(emailServiceResourceId); + + // get the collection of this CommunicationDomainResource + CommunicationDomainResourceCollection collection = emailServiceResource.GetCommunicationDomainResources(); + + // invoke the operation + string domainName = "mydomain.com"; + NullableResponse response = await collection.GetIfExistsAsync(domainName); + CommunicationDomainResource 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 + CommunicationDomainResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update Domains resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs index 38503e5e4986..54ce0cee6cfd 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetResource() Console.WriteLine($"Succeeded: {result}"); } + // Get resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json + // this example is just showing the usage of "CommunicationServices_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 = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "MyResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CommunicationServiceResource + CommunicationServiceResourceCollection collection = resourceGroupResource.GetCommunicationServiceResources(); + + // invoke the operation + string communicationServiceName = "MyCommunicationResource"; + NullableResponse response = await collection.GetIfExistsAsync(communicationServiceName); + CommunicationServiceResource 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 + CommunicationServiceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs index c3b6f1fd9059..06351c2bf06f 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetEmailServiceResource() Console.WriteLine($"Succeeded: {result}"); } + // Get EmailService resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetEmailServiceResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json + // this example is just showing the usage of "EmailServices_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 = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "MyResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EmailServiceResource + EmailServiceResourceCollection collection = resourceGroupResource.GetEmailServiceResources(); + + // invoke the operation + string emailServiceName = "MyEmailServiceResource"; + NullableResponse response = await collection.GetIfExistsAsync(emailServiceName); + EmailServiceResource 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 + EmailServiceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update EmailService resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs index 646ceb10fb40..c3c5f0d281f8 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs @@ -123,6 +123,50 @@ public async Task Exists_GetSenderUsernamesResource() Console.WriteLine($"Succeeded: {result}"); } + // Get SenderUsernames resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSenderUsernamesResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json + // this example is just showing the usage of "SenderUsernames_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 CommunicationDomainResource created on azure + // for more information of creating CommunicationDomainResource, please refer to the document of CommunicationDomainResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + ResourceIdentifier communicationDomainResourceId = CommunicationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName); + CommunicationDomainResource communicationDomainResource = client.GetCommunicationDomainResource(communicationDomainResourceId); + + // get the collection of this SenderUsernameResource + SenderUsernameResourceCollection collection = communicationDomainResource.GetSenderUsernameResources(); + + // invoke the operation + string senderUsername = "contosoNewsAlerts"; + NullableResponse response = await collection.GetIfExistsAsync(senderUsername); + SenderUsernameResource 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 + SenderUsernameResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update SenderUsernames resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceCollection.cs index 1a09aeeebd1e..07df39f281bd 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string domainName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// The name of the Domains 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 domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _communicationDomainResourceDomainsClientDiagnostics.CreateScope("CommunicationDomainResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _communicationDomainResourceDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, domainName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CommunicationDomainResource(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.Communication/emailServices/{emailServiceName}/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// The name of the Domains resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var scope = _communicationDomainResourceDomainsClientDiagnostics.CreateScope("CommunicationDomainResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _communicationDomainResourceDomainsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, domainName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CommunicationDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceCollection.cs index 370944213d87..d67f78c2ff42 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string communicationServiceName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName} + /// + /// + /// Operation Id + /// CommunicationServices_Get + /// + /// + /// + /// The name of the CommunicationService 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 communicationServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(communicationServiceName, nameof(communicationServiceName)); + + using var scope = _communicationServiceResourceCommunicationServicesClientDiagnostics.CreateScope("CommunicationServiceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _communicationServiceResourceCommunicationServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, communicationServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CommunicationServiceResource(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.Communication/communicationServices/{communicationServiceName} + /// + /// + /// Operation Id + /// CommunicationServices_Get + /// + /// + /// + /// The name of the CommunicationService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string communicationServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(communicationServiceName, nameof(communicationServiceName)); + + using var scope = _communicationServiceResourceCommunicationServicesClientDiagnostics.CreateScope("CommunicationServiceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _communicationServiceResourceCommunicationServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, communicationServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CommunicationServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceCollection.cs index 61b8d2452680..bfb2afa98702 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string emailServiceName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName} + /// + /// + /// Operation Id + /// EmailServices_Get + /// + /// + /// + /// The name of the EmailService 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 emailServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + + using var scope = _emailServiceResourceEmailServicesClientDiagnostics.CreateScope("EmailServiceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _emailServiceResourceEmailServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, emailServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EmailServiceResource(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.Communication/emailServices/{emailServiceName} + /// + /// + /// Operation Id + /// EmailServices_Get + /// + /// + /// + /// The name of the EmailService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string emailServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + + using var scope = _emailServiceResourceEmailServicesClientDiagnostics.CreateScope("EmailServiceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _emailServiceResourceEmailServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, emailServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EmailServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceCollection.cs index b797c08a6c75..d49352c66326 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string senderUsername, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername} + /// + /// + /// Operation Id + /// SenderUsernames_Get + /// + /// + /// + /// The valid sender Username. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string senderUsername, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(senderUsername, nameof(senderUsername)); + + using var scope = _senderUsernameResourceSenderUsernamesClientDiagnostics.CreateScope("SenderUsernameResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _senderUsernameResourceSenderUsernamesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, senderUsername, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SenderUsernameResource(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.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername} + /// + /// + /// Operation Id + /// SenderUsernames_Get + /// + /// + /// + /// The valid sender Username. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string senderUsername, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(senderUsername, nameof(senderUsername)); + + using var scope = _senderUsernameResourceSenderUsernamesClientDiagnostics.CreateScope("SenderUsernameResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _senderUsernameResourceSenderUsernamesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, senderUsername, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SenderUsernameResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_AvailabilitySetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_AvailabilitySetCollection.cs index 0019e79b5a6e..5f13d5838f1f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_AvailabilitySetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_AvailabilitySetCollection.cs @@ -122,6 +122,48 @@ public async Task Exists_AvailabilitySetGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // AvailabilitySet_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AvailabilitySetGetMaximumSetGen() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AvailabilitySets_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 = "{subscription-id}"; + string resourceGroupName = "rgcompute"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AvailabilitySetResource + AvailabilitySetCollection collection = resourceGroupResource.GetAvailabilitySets(); + + // invoke the operation + string availabilitySetName = "aaaaaaaaaaaa"; + NullableResponse response = await collection.GetIfExistsAsync(availabilitySetName); + AvailabilitySetResource 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 + AvailabilitySetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AvailabilitySet_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -186,6 +228,48 @@ public async Task Exists_AvailabilitySetGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // AvailabilitySet_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AvailabilitySetGetMinimumSetGen() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json + // this example is just showing the usage of "AvailabilitySets_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 = "{subscription-id}"; + string resourceGroupName = "rgcompute"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AvailabilitySetResource + AvailabilitySetCollection collection = resourceGroupResource.GetAvailabilitySets(); + + // invoke the operation + string availabilitySetName = "aaaaaaaaaaaaaaaaaaaa"; + NullableResponse response = await collection.GetIfExistsAsync(availabilitySetName); + AvailabilitySetResource 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 + AvailabilitySetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AvailabilitySet_List_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CapacityReservationCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CapacityReservationCollection.cs index 7f8a7b7a5fae..c26e1c1f3bb5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CapacityReservationCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CapacityReservationCollection.cs @@ -137,6 +137,50 @@ public async Task Exists_GetACapacityReservation() Console.WriteLine($"Succeeded: {result}"); } + // Get a capacity reservation. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACapacityReservation() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservation_Get.json + // this example is just showing the usage of "CapacityReservations_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 CapacityReservationGroupResource created on azure + // for more information of creating CapacityReservationGroupResource, please refer to the document of CapacityReservationGroupResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + string capacityReservationGroupName = "myCapacityReservationGroup"; + ResourceIdentifier capacityReservationGroupResourceId = CapacityReservationGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, capacityReservationGroupName); + CapacityReservationGroupResource capacityReservationGroup = client.GetCapacityReservationGroupResource(capacityReservationGroupResourceId); + + // get the collection of this CapacityReservationResource + CapacityReservationCollection collection = capacityReservationGroup.GetCapacityReservations(); + + // invoke the operation + string capacityReservationName = "myCapacityReservation"; + CapacityReservationInstanceViewType? expand = CapacityReservationInstanceViewType.InstanceView; + NullableResponse response = await collection.GetIfExistsAsync(capacityReservationName, expand: expand); + CapacityReservationResource 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 + CapacityReservationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List capacity reservations in reservation group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CapacityReservationGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CapacityReservationGroupCollection.cs index f974e886e173..6166397b68d6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CapacityReservationGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CapacityReservationGroupCollection.cs @@ -131,6 +131,49 @@ public async Task Exists_GetACapacityReservationGroup() Console.WriteLine($"Succeeded: {result}"); } + // Get a capacity reservation Group. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACapacityReservationGroup() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservationGroup_Get.json + // this example is just showing the usage of "CapacityReservationGroups_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 = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CapacityReservationGroupResource + CapacityReservationGroupCollection collection = resourceGroupResource.GetCapacityReservationGroups(); + + // invoke the operation + string capacityReservationGroupName = "myCapacityReservationGroup"; + CapacityReservationGroupInstanceViewType? expand = CapacityReservationGroupInstanceViewType.InstanceView; + NullableResponse response = await collection.GetIfExistsAsync(capacityReservationGroupName, expand: expand); + CapacityReservationGroupResource 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 + CapacityReservationGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List capacity reservation groups in resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceCollection.cs index 91d2a258f8e3..e93a3745412e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceCollection.cs @@ -467,6 +467,48 @@ public async Task Exists_GetCloudServiceWithMultipleRolesAndRDPExtension() Console.WriteLine($"Succeeded: {result}"); } + // Get Cloud Service with Multiple Roles and RDP Extension + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCloudServiceWithMultipleRolesAndRDPExtension() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Get_WithMultiRoleAndRDP.json + // this example is just showing the usage of "CloudServices_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 = "{subscription-id}"; + string resourceGroupName = "ConstosoRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CloudServiceResource + CloudServiceCollection collection = resourceGroupResource.GetCloudServices(); + + // invoke the operation + string cloudServiceName = "{cs-name}"; + NullableResponse response = await collection.GetIfExistsAsync(cloudServiceName); + CloudServiceResource 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 + CloudServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Cloud Services in a Resource Group [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceOSFamilyCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceOSFamilyCollection.cs index 9633d94e2247..3b8844487833 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceOSFamilyCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceOSFamilyCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -81,6 +82,48 @@ public async Task Exists_GetCloudServiceOSFamily() Console.WriteLine($"Succeeded: {result}"); } + // Get Cloud Service OS Family + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCloudServiceOSFamily() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceOSFamily_Get.json + // this example is just showing the usage of "CloudServiceOperatingSystems_GetOSFamily" 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 = "{subscription-id}"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CloudServiceOSFamilyResource + AzureLocation location = new AzureLocation("westus2"); + CloudServiceOSFamilyCollection collection = subscriptionResource.GetCloudServiceOSFamilies(location); + + // invoke the operation + string osFamilyName = "3"; + NullableResponse response = await collection.GetIfExistsAsync(osFamilyName); + CloudServiceOSFamilyResource 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 + CloudServiceOSFamilyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Cloud Service OS Families in a subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceOSVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceOSVersionCollection.cs index d618727b9733..236d15d32ec8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceOSVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceOSVersionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -81,6 +82,48 @@ public async Task Exists_GetCloudServiceOSVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get Cloud Service OS Version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCloudServiceOSVersion() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceOSVersion_Get.json + // this example is just showing the usage of "CloudServiceOperatingSystems_GetOSVersion" 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 = "{subscription-id}"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CloudServiceOSVersionResource + AzureLocation location = new AzureLocation("westus2"); + CloudServiceOSVersionCollection collection = subscriptionResource.GetCloudServiceOSVersions(location); + + // invoke the operation + string osVersionName = "WA-GUEST-OS-3.90_202010-02"; + NullableResponse response = await collection.GetIfExistsAsync(osVersionName); + CloudServiceOSVersionResource 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 + CloudServiceOSVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Cloud Service OS Versions in a subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceRoleCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceRoleCollection.cs index fcf45199fd9c..6e0eb0e451c2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceRoleCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceRoleCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetCloudServiceRole() Console.WriteLine($"Succeeded: {result}"); } + // Get Cloud Service Role + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCloudServiceRole() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRole_Get.json + // this example is just showing the usage of "CloudServiceRoles_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 CloudServiceResource created on azure + // for more information of creating CloudServiceResource, please refer to the document of CloudServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "ConstosoRG"; + string cloudServiceName = "{cs-name}"; + ResourceIdentifier cloudServiceResourceId = CloudServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudServiceName); + CloudServiceResource cloudService = client.GetCloudServiceResource(cloudServiceResourceId); + + // get the collection of this CloudServiceRoleResource + CloudServiceRoleCollection collection = cloudService.GetCloudServiceRoles(); + + // invoke the operation + string roleName = "{role-name}"; + NullableResponse response = await collection.GetIfExistsAsync(roleName); + CloudServiceRoleResource 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 + CloudServiceRoleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Roles in a Cloud Service [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceRoleInstanceCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceRoleInstanceCollection.cs index c1ce3baa7694..64d303ea6e58 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceRoleInstanceCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CloudServiceRoleInstanceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetCloudServiceRoleInstance() Console.WriteLine($"Succeeded: {result}"); } + // Get Cloud Service Role Instance + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCloudServiceRoleInstance() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Get.json + // this example is just showing the usage of "CloudServiceRoleInstances_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 CloudServiceResource created on azure + // for more information of creating CloudServiceResource, please refer to the document of CloudServiceResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "ConstosoRG"; + string cloudServiceName = "{cs-name}"; + ResourceIdentifier cloudServiceResourceId = CloudServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudServiceName); + CloudServiceResource cloudService = client.GetCloudServiceResource(cloudServiceResourceId); + + // get the collection of this CloudServiceRoleInstanceResource + CloudServiceRoleInstanceCollection collection = cloudService.GetCloudServiceRoleInstances(); + + // invoke the operation + string roleInstanceName = "{roleInstance-name}"; + NullableResponse response = await collection.GetIfExistsAsync(roleInstanceName); + CloudServiceRoleInstanceResource 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 + CloudServiceRoleInstanceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Role Instances in a Cloud Service [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryCollection.cs index bd167ac1652d..e1d1110b9a65 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -80,5 +81,47 @@ public async Task Exists_GetACommunityGallery() Console.WriteLine($"Succeeded: {result}"); } + + // Get a community gallery. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACommunityGallery() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGallery_Get.json + // this example is just showing the usage of "CommunityGalleries_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "{subscription-id}"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CommunityGalleryResource + CommunityGalleryCollection collection = subscriptionResource.GetCommunityGalleries(); + + // invoke the operation + AzureLocation location = new AzureLocation("myLocation"); + string publicGalleryName = "publicGalleryName"; + NullableResponse response = await collection.GetIfExistsAsync(location, publicGalleryName); + CommunityGalleryResource 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 + CommunityGalleryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryImageCollection.cs index fe103aeedef8..bcf4ecb45ba8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryImageCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -82,6 +83,49 @@ public async Task Exists_GetACommunityGalleryImage() Console.WriteLine($"Succeeded: {result}"); } + // Get a community gallery image. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACommunityGalleryImage() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImage_Get.json + // this example is just showing the usage of "CommunityGalleryImages_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 CommunityGalleryResource created on azure + // for more information of creating CommunityGalleryResource, please refer to the document of CommunityGalleryResource + string subscriptionId = "{subscription-id}"; + AzureLocation location = new AzureLocation("myLocation"); + string publicGalleryName = "publicGalleryName"; + ResourceIdentifier communityGalleryResourceId = CommunityGalleryResource.CreateResourceIdentifier(subscriptionId, location, publicGalleryName); + CommunityGalleryResource communityGallery = client.GetCommunityGalleryResource(communityGalleryResourceId); + + // get the collection of this CommunityGalleryImageResource + CommunityGalleryImageCollection collection = communityGallery.GetCommunityGalleryImages(); + + // invoke the operation + string galleryImageName = "myGalleryImageName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageName); + CommunityGalleryImageResource 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 + CommunityGalleryImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List community gallery images. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryImageVersionCollection.cs index fa341e9b6552..6be4ce2a5240 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_CommunityGalleryImageVersionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_GetACommunityGalleryImageVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get a community gallery image version. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACommunityGalleryImageVersion() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_Get.json + // this example is just showing the usage of "CommunityGalleryImageVersions_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 CommunityGalleryImageResource created on azure + // for more information of creating CommunityGalleryImageResource, please refer to the document of CommunityGalleryImageResource + string subscriptionId = "{subscription-id}"; + AzureLocation location = new AzureLocation("myLocation"); + string publicGalleryName = "publicGalleryName"; + string galleryImageName = "myGalleryImageName"; + ResourceIdentifier communityGalleryImageResourceId = CommunityGalleryImageResource.CreateResourceIdentifier(subscriptionId, location, publicGalleryName, galleryImageName); + CommunityGalleryImageResource communityGalleryImage = client.GetCommunityGalleryImageResource(communityGalleryImageResourceId); + + // get the collection of this CommunityGalleryImageVersionResource + CommunityGalleryImageVersionCollection collection = communityGalleryImage.GetCommunityGalleryImageVersions(); + + // invoke the operation + string galleryImageVersionName = "myGalleryImageVersionName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageVersionName); + CommunityGalleryImageVersionResource 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 + CommunityGalleryImageVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List community gallery image versions. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ComputePrivateEndpointConnectionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ComputePrivateEndpointConnectionCollection.cs index 72dbed0be876..eac341731877 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ComputePrivateEndpointConnectionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ComputePrivateEndpointConnectionCollection.cs @@ -128,6 +128,49 @@ public async Task Exists_GetInformationAboutAPrivateEndpointConnectionUnderADisk Console.WriteLine($"Succeeded: {result}"); } + // Get information about a private endpoint connection under a disk access resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json + // this example is just showing the usage of "DiskAccesses_GetAPrivateEndpointConnection" 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 DiskAccessResource created on azure + // for more information of creating DiskAccessResource, please refer to the document of DiskAccessResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string diskAccessName = "myDiskAccess"; + ResourceIdentifier diskAccessResourceId = DiskAccessResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskAccessName); + DiskAccessResource diskAccess = client.GetDiskAccessResource(diskAccessResourceId); + + // get the collection of this ComputePrivateEndpointConnectionResource + ComputePrivateEndpointConnectionCollection collection = diskAccess.GetComputePrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myPrivateEndpointConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + ComputePrivateEndpointConnectionResource 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 + ComputePrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get information about a private endpoint connection under a disk access resource. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DedicatedHostCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DedicatedHostCollection.cs index f62cf9540f87..0c7c0528a233 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DedicatedHostCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DedicatedHostCollection.cs @@ -133,6 +133,50 @@ public async Task Exists_GetADedicatedHost() Console.WriteLine($"Succeeded: {result}"); } + // Get a dedicated host. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetADedicatedHost() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_Get.json + // this example is just showing the usage of "DedicatedHosts_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 DedicatedHostGroupResource created on azure + // for more information of creating DedicatedHostGroupResource, please refer to the document of DedicatedHostGroupResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + string hostGroupName = "myDedicatedHostGroup"; + ResourceIdentifier dedicatedHostGroupResourceId = DedicatedHostGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostGroupName); + DedicatedHostGroupResource dedicatedHostGroup = client.GetDedicatedHostGroupResource(dedicatedHostGroupResourceId); + + // get the collection of this DedicatedHostResource + DedicatedHostCollection collection = dedicatedHostGroup.GetDedicatedHosts(); + + // invoke the operation + string hostName = "myHost"; + InstanceViewType? expand = InstanceViewType.InstanceView; + NullableResponse response = await collection.GetIfExistsAsync(hostName, expand: expand); + DedicatedHostResource 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 + DedicatedHostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DedicatedHost_ListByHostGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DedicatedHostGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DedicatedHostGroupCollection.cs index 1fc8c7d8eabe..d8e274eef675 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DedicatedHostGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DedicatedHostGroupCollection.cs @@ -179,6 +179,48 @@ public async Task Exists_CreateADedicatedHostGroup() Console.WriteLine($"Succeeded: {result}"); } + // Create a dedicated host group. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CreateADedicatedHostGroup() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get.json + // this example is just showing the usage of "DedicatedHostGroups_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 = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DedicatedHostGroupResource + DedicatedHostGroupCollection collection = resourceGroupResource.GetDedicatedHostGroups(); + + // invoke the operation + string hostGroupName = "myDedicatedHostGroup"; + NullableResponse response = await collection.GetIfExistsAsync(hostGroupName); + DedicatedHostGroupResource 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 + DedicatedHostGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create an ultraSSDEnabled dedicated host group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -243,6 +285,48 @@ public async Task Exists_CreateAnUltraSSDEnabledDedicatedHostGroup() Console.WriteLine($"Succeeded: {result}"); } + // Create an ultraSSDEnabled dedicated host group. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CreateAnUltraSSDEnabledDedicatedHostGroup() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json + // this example is just showing the usage of "DedicatedHostGroups_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 = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DedicatedHostGroupResource + DedicatedHostGroupCollection collection = resourceGroupResource.GetDedicatedHostGroups(); + + // invoke the operation + string hostGroupName = "myDedicatedHostGroup"; + NullableResponse response = await collection.GetIfExistsAsync(hostGroupName); + DedicatedHostGroupResource 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 + DedicatedHostGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskAccessCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskAccessCollection.cs index d2b71b80b95a..78a1d8773487 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskAccessCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskAccessCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_GetInformationAboutADiskAccessResourceWithPrivateEndpoi Console.WriteLine($"Succeeded: {result}"); } + // Get information about a disk access resource with private endpoints. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutADiskAccessResourceWithPrivateEndpoints() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json + // this example is just showing the usage of "DiskAccesses_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DiskAccessResource + DiskAccessCollection collection = resourceGroupResource.GetDiskAccesses(); + + // invoke the operation + string diskAccessName = "myDiskAccess"; + NullableResponse response = await collection.GetIfExistsAsync(diskAccessName); + DiskAccessResource 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 + DiskAccessData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get information about a disk access resource. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -182,6 +224,48 @@ public async Task Exists_GetInformationAboutADiskAccessResource() Console.WriteLine($"Succeeded: {result}"); } + // Get information about a disk access resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutADiskAccessResource() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskAccessExamples/DiskAccess_Get.json + // this example is just showing the usage of "DiskAccesses_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DiskAccessResource + DiskAccessCollection collection = resourceGroupResource.GetDiskAccesses(); + + // invoke the operation + string diskAccessName = "myDiskAccess"; + NullableResponse response = await collection.GetIfExistsAsync(diskAccessName); + DiskAccessResource 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 + DiskAccessData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all disk access resources in a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskEncryptionSetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskEncryptionSetCollection.cs index 27ec52d4265d..e15072bf4796 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskEncryptionSetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskEncryptionSetCollection.cs @@ -217,6 +217,48 @@ public async Task Exists_GetInformationAboutADiskEncryptionSetWhenAutoKeyRotatio Console.WriteLine($"Succeeded: {result}"); } + // Get information about a disk encryption set when auto-key rotation failed. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json + // this example is just showing the usage of "DiskEncryptionSets_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DiskEncryptionSetResource + DiskEncryptionSetCollection collection = resourceGroupResource.GetDiskEncryptionSets(); + + // invoke the operation + string diskEncryptionSetName = "myDiskEncryptionSet"; + NullableResponse response = await collection.GetIfExistsAsync(diskEncryptionSetName); + DiskEncryptionSetResource 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 + DiskEncryptionSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get information about a disk encryption set. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -281,6 +323,48 @@ public async Task Exists_GetInformationAboutADiskEncryptionSet() Console.WriteLine($"Succeeded: {result}"); } + // Get information about a disk encryption set. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutADiskEncryptionSet() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get.json + // this example is just showing the usage of "DiskEncryptionSets_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DiskEncryptionSetResource + DiskEncryptionSetCollection collection = resourceGroupResource.GetDiskEncryptionSets(); + + // invoke the operation + string diskEncryptionSetName = "myDiskEncryptionSet"; + NullableResponse response = await collection.GetIfExistsAsync(diskEncryptionSetName); + DiskEncryptionSetResource 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 + DiskEncryptionSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all disk encryption sets in a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskImageCollection.cs index b46625b6593b..cfc41bc53fad 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskImageCollection.cs @@ -557,6 +557,48 @@ public async Task Exists_GetInformationAboutAVirtualMachineImage() Console.WriteLine($"Succeeded: {result}"); } + // Get information about a virtual machine image. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutAVirtualMachineImage() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/imageExamples/Image_Get.json + // this example is just showing the usage of "Images_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DiskImageResource + DiskImageCollection collection = resourceGroupResource.GetDiskImages(); + + // invoke the operation + string imageName = "myImage"; + NullableResponse response = await collection.GetIfExistsAsync(imageName); + DiskImageResource 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 + DiskImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all virtual machine images in a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskRestorePointCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskRestorePointCollection.cs index 45ecb271abf8..4cdb7472d612 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskRestorePointCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_DiskRestorePointCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_GetAnIncrementalDiskRestorePointResource() Console.WriteLine($"Succeeded: {result}"); } + // Get an incremental disk restorePoint resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnIncrementalDiskRestorePointResource() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskRestorePointExamples/DiskRestorePoint_Get.json + // this example is just showing the usage of "DiskRestorePoint_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 RestorePointResource created on azure + // for more information of creating RestorePointResource, please refer to the document of RestorePointResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string restorePointGroupName = "rpc"; + string vmRestorePointName = "vmrp"; + ResourceIdentifier restorePointResourceId = RestorePointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, restorePointGroupName, vmRestorePointName); + RestorePointResource restorePoint = client.GetRestorePointResource(restorePointResourceId); + + // get the collection of this DiskRestorePointResource + DiskRestorePointCollection collection = restorePoint.GetDiskRestorePoints(); + + // invoke the operation + string diskRestorePointName = "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"; + NullableResponse response = await collection.GetIfExistsAsync(diskRestorePointName); + DiskRestorePointResource 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 + DiskRestorePointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an incremental disk restorePoint when source resource is from a different region [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -152,6 +197,50 @@ public async Task Exists_GetAnIncrementalDiskRestorePointWhenSourceResourceIsFro Console.WriteLine($"Succeeded: {result}"); } + // Get an incremental disk restorePoint when source resource is from a different region + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json + // this example is just showing the usage of "DiskRestorePoint_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 RestorePointResource created on azure + // for more information of creating RestorePointResource, please refer to the document of RestorePointResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string restorePointGroupName = "rpc"; + string vmRestorePointName = "vmrp"; + ResourceIdentifier restorePointResourceId = RestorePointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, restorePointGroupName, vmRestorePointName); + RestorePointResource restorePoint = client.GetRestorePointResource(restorePointResourceId); + + // get the collection of this DiskRestorePointResource + DiskRestorePointCollection collection = restorePoint.GetDiskRestorePoints(); + + // invoke the operation + string diskRestorePointName = "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"; + NullableResponse response = await collection.GetIfExistsAsync(diskRestorePointName); + DiskRestorePointResource 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 + DiskRestorePointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get an incremental disk restorePoint resource. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryApplicationCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryApplicationCollection.cs index 185eff4437cb..405e2900ffca 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryApplicationCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryApplicationCollection.cs @@ -145,6 +145,49 @@ public async Task Exists_GetAGalleryApplication() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery Application. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryApplication() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Get.json + // this example is just showing the usage of "GalleryApplications_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 GalleryResource created on azure + // for more information of creating GalleryResource, please refer to the document of GalleryResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string galleryName = "myGalleryName"; + ResourceIdentifier galleryResourceId = GalleryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName); + GalleryResource gallery = client.GetGalleryResource(galleryResourceId); + + // get the collection of this GalleryApplicationResource + GalleryApplicationCollection collection = gallery.GetGalleryApplications(); + + // invoke the operation + string galleryApplicationName = "myGalleryApplicationName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryApplicationName); + GalleryApplicationResource 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 + GalleryApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List gallery Applications in a gallery. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryApplicationVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryApplicationVersionCollection.cs index a600b5740e78..65d01c029937 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryApplicationVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryApplicationVersionCollection.cs @@ -162,6 +162,51 @@ public async Task Exists_GetAGalleryApplicationVersionWithReplicationStatus() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery Application Version with replication status. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryApplicationVersionWithReplicationStatus() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json + // this example is just showing the usage of "GalleryApplicationVersions_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 GalleryApplicationResource created on azure + // for more information of creating GalleryApplicationResource, please refer to the document of GalleryApplicationResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string galleryName = "myGalleryName"; + string galleryApplicationName = "myGalleryApplicationName"; + ResourceIdentifier galleryApplicationResourceId = GalleryApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryApplicationName); + GalleryApplicationResource galleryApplication = client.GetGalleryApplicationResource(galleryApplicationResourceId); + + // get the collection of this GalleryApplicationVersionResource + GalleryApplicationVersionCollection collection = galleryApplication.GetGalleryApplicationVersions(); + + // invoke the operation + string galleryApplicationVersionName = "1.0.0"; + ReplicationStatusType? expand = ReplicationStatusType.ReplicationStatus; + NullableResponse response = await collection.GetIfExistsAsync(galleryApplicationVersionName, expand: expand); + GalleryApplicationVersionResource 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 + GalleryApplicationVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a gallery Application Version. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -230,6 +275,50 @@ public async Task Exists_GetAGalleryApplicationVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery Application Version. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryApplicationVersion() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Get.json + // this example is just showing the usage of "GalleryApplicationVersions_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 GalleryApplicationResource created on azure + // for more information of creating GalleryApplicationResource, please refer to the document of GalleryApplicationResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string galleryName = "myGalleryName"; + string galleryApplicationName = "myGalleryApplicationName"; + ResourceIdentifier galleryApplicationResourceId = GalleryApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryApplicationName); + GalleryApplicationResource galleryApplication = client.GetGalleryApplicationResource(galleryApplicationResourceId); + + // get the collection of this GalleryApplicationVersionResource + GalleryApplicationVersionCollection collection = galleryApplication.GetGalleryApplicationVersions(); + + // invoke the operation + string galleryApplicationVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(galleryApplicationVersionName); + GalleryApplicationVersionResource 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 + GalleryApplicationVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List gallery Application Versions in a gallery Application Definition. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryCollection.cs index ac8a9661bed3..8dd73d08a377 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryCollection.cs @@ -255,6 +255,48 @@ public async Task Exists_GetACommunityGallery() Console.WriteLine($"Succeeded: {result}"); } + // Get a community gallery. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetACommunityGallery() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/CommunityGallery_Get.json + // this example is just showing the usage of "Galleries_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GalleryResource + GalleryCollection collection = resourceGroupResource.GetGalleries(); + + // invoke the operation + string galleryName = "myGalleryName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryName); + GalleryResource 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 + GalleryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a gallery with expand sharingProfile groups. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -321,6 +363,49 @@ public async Task Exists_GetAGalleryWithExpandSharingProfileGroups() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery with expand sharingProfile groups. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryWithExpandSharingProfileGroups() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json + // this example is just showing the usage of "Galleries_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GalleryResource + GalleryCollection collection = resourceGroupResource.GetGalleries(); + + // invoke the operation + string galleryName = "myGalleryName"; + GalleryExpand? expand = GalleryExpand.SharingProfileGroups; + NullableResponse response = await collection.GetIfExistsAsync(galleryName, expand: expand); + GalleryResource 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 + GalleryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a gallery with select permissions. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -387,6 +472,49 @@ public async Task Exists_GetAGalleryWithSelectPermissions() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery with select permissions. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryWithSelectPermissions() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json + // this example is just showing the usage of "Galleries_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GalleryResource + GalleryCollection collection = resourceGroupResource.GetGalleries(); + + // invoke the operation + string galleryName = "myGalleryName"; + SelectPermission? select = SelectPermission.Permissions; + NullableResponse response = await collection.GetIfExistsAsync(galleryName, select: select); + GalleryResource 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 + GalleryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a gallery. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -451,6 +579,48 @@ public async Task Exists_GetAGallery() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGallery() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get.json + // this example is just showing the usage of "Galleries_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GalleryResource + GalleryCollection collection = resourceGroupResource.GetGalleries(); + + // invoke the operation + string galleryName = "myGalleryName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryName); + GalleryResource 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 + GalleryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List galleries in a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryImageCollection.cs index c650bd367c28..c3ae9b85c916 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryImageCollection.cs @@ -127,6 +127,49 @@ public async Task Exists_GetAGalleryImage() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery image. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryImage() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Get.json + // this example is just showing the usage of "GalleryImages_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 GalleryResource created on azure + // for more information of creating GalleryResource, please refer to the document of GalleryResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string galleryName = "myGalleryName"; + ResourceIdentifier galleryResourceId = GalleryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName); + GalleryResource gallery = client.GetGalleryResource(galleryResourceId); + + // get the collection of this GalleryImageResource + GalleryImageCollection collection = gallery.GetGalleryImages(); + + // invoke the operation + string galleryImageName = "myGalleryImageName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageName); + GalleryImageResource 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 + GalleryImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List gallery images in a gallery. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryImageVersionCollection.cs index 8575684cddbe..c170684a839a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_GalleryImageVersionCollection.cs @@ -974,6 +974,51 @@ public async Task Exists_GetAGalleryImageVersionWithReplicationStatus() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery image version with replication status. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryImageVersionWithReplicationStatus() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json + // this example is just showing the usage of "GalleryImageVersions_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 GalleryImageResource created on azure + // for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string galleryName = "myGalleryName"; + string galleryImageName = "myGalleryImageName"; + ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName); + GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId); + + // get the collection of this GalleryImageVersionResource + GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions(); + + // invoke the operation + string galleryImageVersionName = "1.0.0"; + ReplicationStatusType? expand = ReplicationStatusType.ReplicationStatus; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageVersionName, expand: expand); + GalleryImageVersionResource 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 + GalleryImageVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a gallery image version with snapshots as a source. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1042,6 +1087,50 @@ public async Task Exists_GetAGalleryImageVersionWithSnapshotsAsASource() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery image version with snapshots as a source. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryImageVersionWithSnapshotsAsASource() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json + // this example is just showing the usage of "GalleryImageVersions_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 GalleryImageResource created on azure + // for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string galleryName = "myGalleryName"; + string galleryImageName = "myGalleryImageName"; + ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName); + GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId); + + // get the collection of this GalleryImageVersionResource + GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions(); + + // invoke the operation + string galleryImageVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageVersionName); + GalleryImageVersionResource 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 + GalleryImageVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a gallery image version with vhd as a source. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1110,6 +1199,50 @@ public async Task Exists_GetAGalleryImageVersionWithVhdAsASource() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery image version with vhd as a source. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryImageVersionWithVhdAsASource() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json + // this example is just showing the usage of "GalleryImageVersions_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 GalleryImageResource created on azure + // for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string galleryName = "myGalleryName"; + string galleryImageName = "myGalleryImageName"; + ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName); + GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId); + + // get the collection of this GalleryImageVersionResource + GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions(); + + // invoke the operation + string galleryImageVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageVersionName); + GalleryImageVersionResource 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 + GalleryImageVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a gallery image version. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -1178,6 +1311,50 @@ public async Task Exists_GetAGalleryImageVersion() Console.WriteLine($"Succeeded: {result}"); } + // Get a gallery image version. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGalleryImageVersion() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get.json + // this example is just showing the usage of "GalleryImageVersions_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 GalleryImageResource created on azure + // for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string galleryName = "myGalleryName"; + string galleryImageName = "myGalleryImageName"; + ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName); + GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId); + + // get the collection of this GalleryImageVersionResource + GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions(); + + // invoke the operation + string galleryImageVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageVersionName); + GalleryImageVersionResource 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 + GalleryImageVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List gallery image versions in a gallery image definition. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ManagedDiskCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ManagedDiskCollection.cs index b8b9ecf6d827..9d12795b70a6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ManagedDiskCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ManagedDiskCollection.cs @@ -1202,6 +1202,48 @@ public async Task Exists_GetInformationAboutAManagedDisk() Console.WriteLine($"Succeeded: {result}"); } + // Get information about a managed disk. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutAManagedDisk() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskExamples/Disk_Get.json + // this example is just showing the usage of "Disks_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedDiskResource + ManagedDiskCollection collection = resourceGroupResource.GetManagedDisks(); + + // invoke the operation + string diskName = "myManagedDisk"; + NullableResponse response = await collection.GetIfExistsAsync(diskName); + ManagedDiskResource 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 + ManagedDiskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all managed disks in a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ProximityPlacementGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ProximityPlacementGroupCollection.cs index 24bb88bf3a0c..cddbf88b8a96 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ProximityPlacementGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_ProximityPlacementGroupCollection.cs @@ -130,6 +130,48 @@ public async Task Exists_GetProximityPlacementGroups() Console.WriteLine($"Succeeded: {result}"); } + // Get proximity placement groups. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetProximityPlacementGroups() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json + // this example is just showing the usage of "ProximityPlacementGroups_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ProximityPlacementGroupResource + ProximityPlacementGroupCollection collection = resourceGroupResource.GetProximityPlacementGroups(); + + // invoke the operation + string proximityPlacementGroupName = "myProximityPlacementGroup"; + NullableResponse response = await collection.GetIfExistsAsync(proximityPlacementGroupName); + ProximityPlacementGroupResource 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 + ProximityPlacementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List proximity placement group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_RestorePointCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_RestorePointCollection.cs index 47606b4b6e47..ab42362db599 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_RestorePointCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_RestorePointCollection.cs @@ -170,6 +170,49 @@ public async Task Exists_GetARestorePoint() Console.WriteLine($"Succeeded: {result}"); } + // Get a restore point + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARestorePoint() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePoint_Get.json + // this example is just showing the usage of "RestorePoints_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 RestorePointGroupResource created on azure + // for more information of creating RestorePointGroupResource, please refer to the document of RestorePointGroupResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string restorePointGroupName = "rpcName"; + ResourceIdentifier restorePointGroupResourceId = RestorePointGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, restorePointGroupName); + RestorePointGroupResource restorePointGroup = client.GetRestorePointGroupResource(restorePointGroupResourceId); + + // get the collection of this RestorePointResource + RestorePointCollection collection = restorePointGroup.GetRestorePoints(); + + // invoke the operation + string restorePointName = "rpName"; + NullableResponse response = await collection.GetIfExistsAsync(restorePointName); + RestorePointResource 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 + RestorePointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get restore point with instance view [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -235,5 +278,48 @@ public async Task Exists_GetRestorePointWithInstanceView() Console.WriteLine($"Succeeded: {result}"); } + + // Get restore point with instance view + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRestorePointWithInstanceView() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePoint_Get_WithInstanceView.json + // this example is just showing the usage of "RestorePoints_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 RestorePointGroupResource created on azure + // for more information of creating RestorePointGroupResource, please refer to the document of RestorePointGroupResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string restorePointGroupName = "rpcName"; + ResourceIdentifier restorePointGroupResourceId = RestorePointGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, restorePointGroupName); + RestorePointGroupResource restorePointGroup = client.GetRestorePointGroupResource(restorePointGroupResourceId); + + // get the collection of this RestorePointResource + RestorePointCollection collection = restorePointGroup.GetRestorePoints(); + + // invoke the operation + string restorePointName = "rpName"; + NullableResponse response = await collection.GetIfExistsAsync(restorePointName); + RestorePointResource 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 + RestorePointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_RestorePointGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_RestorePointGroupCollection.cs index 79174c56ac87..7faac93dc6a1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_RestorePointGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_RestorePointGroupCollection.cs @@ -175,6 +175,48 @@ public async Task Exists_GetARestorePointCollectionButNotTheRestorePointsContain Console.WriteLine($"Succeeded: {result}"); } + // Get a restore point collection (but not the restore points contained in the restore point collection) + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARestorePointCollectionButNotTheRestorePointsContainedInTheRestorePointCollection() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePointCollection_Get.json + // this example is just showing the usage of "RestorePointCollections_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RestorePointGroupResource + RestorePointGroupCollection collection = resourceGroupResource.GetRestorePointGroups(); + + // invoke the operation + string restorePointGroupName = "myRpc"; + NullableResponse response = await collection.GetIfExistsAsync(restorePointGroupName); + RestorePointGroupResource 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 + RestorePointGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a restore point collection, including the restore points contained in the restore point collection [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -239,6 +281,48 @@ public async Task Exists_GetARestorePointCollectionIncludingTheRestorePointsCont Console.WriteLine($"Succeeded: {result}"); } + // Get a restore point collection, including the restore points contained in the restore point collection + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARestorePointCollectionIncludingTheRestorePointsContainedInTheRestorePointCollection() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json + // this example is just showing the usage of "RestorePointCollections_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this RestorePointGroupResource + RestorePointGroupCollection collection = resourceGroupResource.GetRestorePointGroups(); + + // invoke the operation + string restorePointGroupName = "rpcName"; + NullableResponse response = await collection.GetIfExistsAsync(restorePointGroupName); + RestorePointGroupResource 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 + RestorePointGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Gets the list of restore point collections in a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryCollection.cs index 5ae6d02934f9..adc847b9069e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -116,5 +117,47 @@ public async Task Exists_GetASharedGallery() Console.WriteLine($"Succeeded: {result}"); } + + // Get a shared gallery. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASharedGallery() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGallery_Get.json + // this example is just showing the usage of "SharedGalleries_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "{subscription-id}"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SharedGalleryResource + AzureLocation location = new AzureLocation("myLocation"); + SharedGalleryCollection collection = subscriptionResource.GetSharedGalleries(location); + + // invoke the operation + string galleryUniqueName = "galleryUniqueName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryUniqueName); + SharedGalleryResource 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 + SharedGalleryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryImageCollection.cs index 8b61f40caf95..b6ddf8a19b11 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryImageCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetASharedGalleryImage() Console.WriteLine($"Succeeded: {result}"); } + + // Get a shared gallery image. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASharedGalleryImage() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImage_Get.json + // this example is just showing the usage of "SharedGalleryImages_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 SharedGalleryResource created on azure + // for more information of creating SharedGalleryResource, please refer to the document of SharedGalleryResource + string subscriptionId = "{subscription-id}"; + AzureLocation location = new AzureLocation("myLocation"); + string galleryUniqueName = "galleryUniqueName"; + ResourceIdentifier sharedGalleryResourceId = SharedGalleryResource.CreateResourceIdentifier(subscriptionId, location, galleryUniqueName); + SharedGalleryResource sharedGallery = client.GetSharedGalleryResource(sharedGalleryResourceId); + + // get the collection of this SharedGalleryImageResource + SharedGalleryImageCollection collection = sharedGallery.GetSharedGalleryImages(); + + // invoke the operation + string galleryImageName = "myGalleryImageName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageName); + SharedGalleryImageResource 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 + SharedGalleryImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryImageVersionCollection.cs index 0cde3bb16bb2..4a17e529b381 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SharedGalleryImageVersionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetASharedGalleryImageVersion() Console.WriteLine($"Succeeded: {result}"); } + + // Get a shared gallery image version. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASharedGalleryImageVersion() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersion_Get.json + // this example is just showing the usage of "SharedGalleryImageVersions_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 SharedGalleryImageResource created on azure + // for more information of creating SharedGalleryImageResource, please refer to the document of SharedGalleryImageResource + string subscriptionId = "{subscription-id}"; + AzureLocation location = new AzureLocation("myLocation"); + string galleryUniqueName = "galleryUniqueName"; + string galleryImageName = "myGalleryImageName"; + ResourceIdentifier sharedGalleryImageResourceId = SharedGalleryImageResource.CreateResourceIdentifier(subscriptionId, location, galleryUniqueName, galleryImageName); + SharedGalleryImageResource sharedGalleryImage = client.GetSharedGalleryImageResource(sharedGalleryImageResourceId); + + // get the collection of this SharedGalleryImageVersionResource + SharedGalleryImageVersionCollection collection = sharedGalleryImage.GetSharedGalleryImageVersions(); + + // invoke the operation + string galleryImageVersionName = "myGalleryImageVersionName"; + NullableResponse response = await collection.GetIfExistsAsync(galleryImageVersionName); + SharedGalleryImageVersionResource 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 + SharedGalleryImageVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SnapshotCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SnapshotCollection.cs index a04ff4113833..cff583e67a24 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SnapshotCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SnapshotCollection.cs @@ -294,6 +294,48 @@ public async Task Exists_GetInformationAboutASnapshot() Console.WriteLine($"Succeeded: {result}"); } + // Get information about a snapshot. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutASnapshot() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/snapshotExamples/Snapshot_Get.json + // this example is just showing the usage of "Snapshots_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = resourceGroupResource.GetSnapshots(); + + // invoke the operation + string snapshotName = "mySnapshot"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotName); + SnapshotResource 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 + SnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get information about an incremental snapshot. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -358,6 +400,48 @@ public async Task Exists_GetInformationAboutAnIncrementalSnapshot() Console.WriteLine($"Succeeded: {result}"); } + // Get information about an incremental snapshot. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInformationAboutAnIncrementalSnapshot() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/snapshotExamples/Snapshot_GetIncrementalSnapshot.json + // this example is just showing the usage of "Snapshots_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = resourceGroupResource.GetSnapshots(); + + // invoke the operation + string snapshotName = "myIncrementalSnapshot"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotName); + SnapshotResource 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 + SnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List all snapshots in a resource group. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SshPublicKeyCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SshPublicKeyCollection.cs index 19b4cb81d7b1..46c551691fdb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SshPublicKeyCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_SshPublicKeyCollection.cs @@ -192,5 +192,47 @@ public async Task Exists_GetAnSshPublicKey() Console.WriteLine($"Succeeded: {result}"); } + + // Get an ssh public key. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAnSshPublicKey() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_Get.json + // this example is just showing the usage of "SshPublicKeys_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 = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SshPublicKeyResource + SshPublicKeyCollection collection = resourceGroupResource.GetSshPublicKeys(); + + // invoke the operation + string sshPublicKeyName = "mySshPublicKeyName"; + NullableResponse response = await collection.GetIfExistsAsync(sshPublicKeyName); + SshPublicKeyResource 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 + SshPublicKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineCollection.cs index df3fad831a16..990536c13d87 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineCollection.cs @@ -3851,6 +3851,49 @@ public async Task Exists_GetAVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + // Get a Virtual Machine. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVirtualMachine() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Get.json + // this example is just showing the usage of "VirtualMachines_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = resourceGroupResource.GetVirtualMachines(); + + // invoke the operation + string vmName = "myVM"; + InstanceViewType? expand = InstanceViewType.UserData; + NullableResponse response = await collection.GetIfExistsAsync(vmName, expand: expand); + VirtualMachineResource 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 + VirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a virtual machine placed on a dedicated host group through automatic placement [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -3915,6 +3958,48 @@ public async Task Exists_GetAVirtualMachinePlacedOnADedicatedHostGroupThroughAut Console.WriteLine($"Succeeded: {result}"); } + // Get a virtual machine placed on a dedicated host group through automatic placement + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json + // this example is just showing the usage of "VirtualMachines_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = resourceGroupResource.GetVirtualMachines(); + + // invoke the operation + string vmName = "myVM"; + NullableResponse response = await collection.GetIfExistsAsync(vmName); + VirtualMachineResource 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 + VirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a virtual machine with Disk Controller Type Properties [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -3981,6 +4066,49 @@ public async Task Exists_GetAVirtualMachineWithDiskControllerTypeProperties() Console.WriteLine($"Succeeded: {result}"); } + // Get a virtual machine with Disk Controller Type Properties + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVirtualMachineWithDiskControllerTypeProperties() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json + // this example is just showing the usage of "VirtualMachines_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = resourceGroupResource.GetVirtualMachines(); + + // invoke the operation + string vmName = "myVM"; + InstanceViewType? expand = InstanceViewType.UserData; + NullableResponse response = await collection.GetIfExistsAsync(vmName, expand: expand); + VirtualMachineResource 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 + VirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a virtual machine with VM Size Properties [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -4045,6 +4173,48 @@ public async Task Exists_GetAVirtualMachineWithVMSizeProperties() Console.WriteLine($"Succeeded: {result}"); } + // Get a virtual machine with VM Size Properties + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVirtualMachineWithVMSizeProperties() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json + // this example is just showing the usage of "VirtualMachines_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = resourceGroupResource.GetVirtualMachines(); + + // invoke the operation + string vmName = "myVM"; + NullableResponse response = await collection.GetIfExistsAsync(vmName); + VirtualMachineResource 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 + VirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachine_List_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineExtensionCollection.cs index ef354f84df21..e35e314c3f88 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineExtensionCollection.cs @@ -208,6 +208,50 @@ public async Task Exists_VirtualMachineExtensionGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // VirtualMachineExtension_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualMachineExtensionGetMaximumSetGen() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VirtualMachineExtensions_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 VirtualMachineResource created on azure + // for more information of creating VirtualMachineResource, please refer to the document of VirtualMachineResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "rgcompute"; + string vmName = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + ResourceIdentifier virtualMachineResourceId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName); + VirtualMachineResource virtualMachine = client.GetVirtualMachineResource(virtualMachineResourceId); + + // get the collection of this VirtualMachineExtensionResource + VirtualMachineExtensionCollection collection = virtualMachine.GetVirtualMachineExtensions(); + + // invoke the operation + string vmExtensionName = "aaaaaaa"; + string expand = "aaaaaa"; + NullableResponse response = await collection.GetIfExistsAsync(vmExtensionName, expand: expand); + VirtualMachineExtensionResource 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 + VirtualMachineExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineExtension_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -274,6 +318,49 @@ public async Task Exists_VirtualMachineExtensionGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // VirtualMachineExtension_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualMachineExtensionGetMinimumSetGen() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VirtualMachineExtensions_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 VirtualMachineResource created on azure + // for more information of creating VirtualMachineResource, please refer to the document of VirtualMachineResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "rgcompute"; + string vmName = "myVM"; + ResourceIdentifier virtualMachineResourceId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName); + VirtualMachineResource virtualMachine = client.GetVirtualMachineResource(virtualMachineResourceId); + + // get the collection of this VirtualMachineExtensionResource + VirtualMachineExtensionCollection collection = virtualMachine.GetVirtualMachineExtensions(); + + // invoke the operation + string vmExtensionName = "myVMExtension"; + NullableResponse response = await collection.GetIfExistsAsync(vmExtensionName); + VirtualMachineExtensionResource 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 + VirtualMachineExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineExtension_List_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineExtensionImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineExtensionImageCollection.cs index a3f93ae6c299..ec2ca916b43d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineExtensionImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineExtensionImageCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -85,6 +86,50 @@ public async Task Exists_VirtualMachineExtensionImageGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // VirtualMachineExtensionImage_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualMachineExtensionImageGetMaximumSetGen() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VirtualMachineExtensionImages_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "{subscription-id}"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this VirtualMachineExtensionImageResource + AzureLocation location = new AzureLocation("aaaaaaaaaaaaa"); + string publisherName = "aaaaaaaaaaaaaaaaaaaa"; + VirtualMachineExtensionImageCollection collection = subscriptionResource.GetVirtualMachineExtensionImages(location, publisherName); + + // invoke the operation + string type = "aaaaaaaaaaaaaaaaaa"; + string version = "aaaaaaaaaaaaaa"; + NullableResponse response = await collection.GetIfExistsAsync(type, version); + VirtualMachineExtensionImageResource 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 + VirtualMachineExtensionImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineExtensionImage_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -153,6 +198,50 @@ public async Task Exists_VirtualMachineExtensionImageGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // VirtualMachineExtensionImage_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualMachineExtensionImageGetMinimumSetGen() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VirtualMachineExtensionImages_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "{subscription-id}"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this VirtualMachineExtensionImageResource + AzureLocation location = new AzureLocation("aaaaaaaaaaaaaa"); + string publisherName = "aaaaaaaaaaaaaaaaaaaaaaaaaa"; + VirtualMachineExtensionImageCollection collection = subscriptionResource.GetVirtualMachineExtensionImages(location, publisherName); + + // invoke the operation + string type = "aa"; + string version = "aaa"; + NullableResponse response = await collection.GetIfExistsAsync(type, version); + VirtualMachineExtensionImageResource 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 + VirtualMachineExtensionImageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineRunCommandCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineRunCommandCollection.cs index 707b8e5655ca..67a7aa59e7a0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineRunCommandCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineRunCommandCollection.cs @@ -142,6 +142,49 @@ public async Task Exists_GetARunCommand() Console.WriteLine($"Succeeded: {result}"); } + // Get a run command. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARunCommand() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/runCommandExamples/VirtualMachineRunCommand_Get.json + // this example is just showing the usage of "VirtualMachineRunCommands_GetByVirtualMachine" 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 VirtualMachineResource created on azure + // for more information of creating VirtualMachineResource, please refer to the document of VirtualMachineResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string vmName = "myVM"; + ResourceIdentifier virtualMachineResourceId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName); + VirtualMachineResource virtualMachine = client.GetVirtualMachineResource(virtualMachineResourceId); + + // get the collection of this VirtualMachineRunCommandResource + VirtualMachineRunCommandCollection collection = virtualMachine.GetVirtualMachineRunCommands(); + + // invoke the operation + string runCommandName = "myRunCommand"; + NullableResponse response = await collection.GetIfExistsAsync(runCommandName); + VirtualMachineRunCommandResource 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 + VirtualMachineRunCommandData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List run commands in a Virtual Machine. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetCollection.cs index a458d40be2e1..84a37ba18f87 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetCollection.cs @@ -4159,6 +4159,49 @@ public async Task Exists_GetVMScaleSetVMWithDiskControllerType() Console.WriteLine($"Succeeded: {result}"); } + // Get VM scale set VM with Disk Controller Type + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVMScaleSetVMWithDiskControllerType() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json + // this example is just showing the usage of "VirtualMachineScaleSets_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineScaleSetResource + VirtualMachineScaleSetCollection collection = resourceGroupResource.GetVirtualMachineScaleSets(); + + // invoke the operation + string virtualMachineScaleSetName = "myVirtualMachineScaleSet"; + VirtualMachineScaleSetGetExpand? expand = VirtualMachineScaleSetGetExpand.UserData; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineScaleSetName, expand: expand); + VirtualMachineScaleSetResource 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 + VirtualMachineScaleSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a virtual machine scale set [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -4223,6 +4266,48 @@ public async Task Exists_GetAVirtualMachineScaleSet() Console.WriteLine($"Succeeded: {result}"); } + // Get a virtual machine scale set + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVirtualMachineScaleSet() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json + // this example is just showing the usage of "VirtualMachineScaleSets_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineScaleSetResource + VirtualMachineScaleSetCollection collection = resourceGroupResource.GetVirtualMachineScaleSets(); + + // invoke the operation + string virtualMachineScaleSetName = "myVirtualMachineScaleSet"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineScaleSetName); + VirtualMachineScaleSetResource 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 + VirtualMachineScaleSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a virtual machine scale set placed on a dedicated host group through automatic placement. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -4287,6 +4372,48 @@ public async Task Exists_GetAVirtualMachineScaleSetPlacedOnADedicatedHostGroupTh Console.WriteLine($"Succeeded: {result}"); } + // Get a virtual machine scale set placed on a dedicated host group through automatic placement. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json + // this example is just showing the usage of "VirtualMachineScaleSets_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineScaleSetResource + VirtualMachineScaleSetCollection collection = resourceGroupResource.GetVirtualMachineScaleSets(); + + // invoke the operation + string virtualMachineScaleSetName = "myVirtualMachineScaleSet"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineScaleSetName); + VirtualMachineScaleSetResource 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 + VirtualMachineScaleSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get a virtual machine scale set with UserData [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -4353,6 +4480,49 @@ public async Task Exists_GetAVirtualMachineScaleSetWithUserData() Console.WriteLine($"Succeeded: {result}"); } + // Get a virtual machine scale set with UserData + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAVirtualMachineScaleSetWithUserData() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json + // this example is just showing the usage of "VirtualMachineScaleSets_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 = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineScaleSetResource + VirtualMachineScaleSetCollection collection = resourceGroupResource.GetVirtualMachineScaleSets(); + + // invoke the operation + string virtualMachineScaleSetName = "myVirtualMachineScaleSet"; + VirtualMachineScaleSetGetExpand? expand = VirtualMachineScaleSetGetExpand.UserData; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineScaleSetName, expand: expand); + VirtualMachineScaleSetResource 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 + VirtualMachineScaleSetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineScaleSet_List_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetExtensionCollection.cs index 65eaab17f25e..d40abc3a2b8c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetExtensionCollection.cs @@ -179,6 +179,50 @@ public async Task Exists_VirtualMachineScaleSetExtensionGetMaximumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // VirtualMachineScaleSetExtension_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualMachineScaleSetExtensionGetMaximumSetGen() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VirtualMachineScaleSetExtensions_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 VirtualMachineScaleSetResource created on azure + // for more information of creating VirtualMachineScaleSetResource, please refer to the document of VirtualMachineScaleSetResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "rgcompute"; + string virtualMachineScaleSetName = "aaaaaaaaaaaaaaaaaaaaaaaa"; + ResourceIdentifier virtualMachineScaleSetResourceId = VirtualMachineScaleSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineScaleSetName); + VirtualMachineScaleSetResource virtualMachineScaleSet = client.GetVirtualMachineScaleSetResource(virtualMachineScaleSetResourceId); + + // get the collection of this VirtualMachineScaleSetExtensionResource + VirtualMachineScaleSetExtensionCollection collection = virtualMachineScaleSet.GetVirtualMachineScaleSetExtensions(); + + // invoke the operation + string vmssExtensionName = "aaaaaaaaaaaaaaaaaaaa"; + string expand = "aaaaaaa"; + NullableResponse response = await collection.GetIfExistsAsync(vmssExtensionName, expand: expand); + VirtualMachineScaleSetExtensionResource 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 + VirtualMachineScaleSetExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineScaleSetExtension_Get_MinimumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -245,6 +289,49 @@ public async Task Exists_VirtualMachineScaleSetExtensionGetMinimumSetGen() Console.WriteLine($"Succeeded: {result}"); } + // VirtualMachineScaleSetExtension_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VirtualMachineScaleSetExtensionGetMinimumSetGen() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VirtualMachineScaleSetExtensions_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 VirtualMachineScaleSetResource created on azure + // for more information of creating VirtualMachineScaleSetResource, please refer to the document of VirtualMachineScaleSetResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "rgcompute"; + string virtualMachineScaleSetName = "a"; + ResourceIdentifier virtualMachineScaleSetResourceId = VirtualMachineScaleSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineScaleSetName); + VirtualMachineScaleSetResource virtualMachineScaleSet = client.GetVirtualMachineScaleSetResource(virtualMachineScaleSetResourceId); + + // get the collection of this VirtualMachineScaleSetExtensionResource + VirtualMachineScaleSetExtensionCollection collection = virtualMachineScaleSet.GetVirtualMachineScaleSetExtensions(); + + // invoke the operation + string vmssExtensionName = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + NullableResponse response = await collection.GetIfExistsAsync(vmssExtensionName); + VirtualMachineScaleSetExtensionResource 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 + VirtualMachineScaleSetExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineScaleSetExtension_List_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmCollection.cs index 1987b19b7a9b..2797a296b9af 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmCollection.cs @@ -490,6 +490,49 @@ public async Task Exists_GetVMScaleSetVMWithUserData() Console.WriteLine($"Succeeded: {result}"); } + // Get VM scale set VM with UserData + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVMScaleSetVMWithUserData() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json + // this example is just showing the usage of "VirtualMachineScaleSetVMs_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 VirtualMachineScaleSetResource created on azure + // for more information of creating VirtualMachineScaleSetResource, please refer to the document of VirtualMachineScaleSetResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string virtualMachineScaleSetName = "{vmss-name}"; + ResourceIdentifier virtualMachineScaleSetResourceId = VirtualMachineScaleSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineScaleSetName); + VirtualMachineScaleSetResource virtualMachineScaleSet = client.GetVirtualMachineScaleSetResource(virtualMachineScaleSetResourceId); + + // get the collection of this VirtualMachineScaleSetVmResource + VirtualMachineScaleSetVmCollection collection = virtualMachineScaleSet.GetVirtualMachineScaleSetVms(); + + // invoke the operation + string instanceId = "0"; + NullableResponse response = await collection.GetIfExistsAsync(instanceId); + VirtualMachineScaleSetVmResource 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 + VirtualMachineScaleSetVmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get VM scale set VM with VMSizeProperties [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -556,6 +599,49 @@ public async Task Exists_GetVMScaleSetVMWithVMSizeProperties() Console.WriteLine($"Succeeded: {result}"); } + // Get VM scale set VM with VMSizeProperties + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVMScaleSetVMWithVMSizeProperties() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json + // this example is just showing the usage of "VirtualMachineScaleSetVMs_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 VirtualMachineScaleSetResource created on azure + // for more information of creating VirtualMachineScaleSetResource, please refer to the document of VirtualMachineScaleSetResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string virtualMachineScaleSetName = "{vmss-name}"; + ResourceIdentifier virtualMachineScaleSetResourceId = VirtualMachineScaleSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineScaleSetName); + VirtualMachineScaleSetResource virtualMachineScaleSet = client.GetVirtualMachineScaleSetResource(virtualMachineScaleSetResourceId); + + // get the collection of this VirtualMachineScaleSetVmResource + VirtualMachineScaleSetVmCollection collection = virtualMachineScaleSet.GetVirtualMachineScaleSetVms(); + + // invoke the operation + string instanceId = "0"; + NullableResponse response = await collection.GetIfExistsAsync(instanceId); + VirtualMachineScaleSetVmResource 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 + VirtualMachineScaleSetVmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // VirtualMachineScaleSetVM_List_MaximumSet_Gen [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmExtensionCollection.cs index 946f9fe8fc2c..e4a864429537 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmExtensionCollection.cs @@ -134,6 +134,50 @@ public async Task Exists_GetVirtualMachineScaleSetVMExtension() Console.WriteLine($"Succeeded: {result}"); } + // Get VirtualMachineScaleSet VM extension. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachineScaleSetVMExtension() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.json + // this example is just showing the usage of "VirtualMachineScaleSetVMExtensions_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 VirtualMachineScaleSetVmResource created on azure + // for more information of creating VirtualMachineScaleSetVmResource, please refer to the document of VirtualMachineScaleSetVmResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string virtualMachineScaleSetName = "myvmScaleSet"; + string instanceId = "0"; + ResourceIdentifier virtualMachineScaleSetVmResourceId = VirtualMachineScaleSetVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineScaleSetName, instanceId); + VirtualMachineScaleSetVmResource virtualMachineScaleSetVm = client.GetVirtualMachineScaleSetVmResource(virtualMachineScaleSetVmResourceId); + + // get the collection of this VirtualMachineScaleSetVmExtensionResource + VirtualMachineScaleSetVmExtensionCollection collection = virtualMachineScaleSetVm.GetVirtualMachineScaleSetVmExtensions(); + + // invoke the operation + string vmExtensionName = "myVMExtension"; + NullableResponse response = await collection.GetIfExistsAsync(vmExtensionName); + VirtualMachineScaleSetVmExtensionResource 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 + VirtualMachineScaleSetVmExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List extensions in Vmss instance. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmRunCommandCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmRunCommandCollection.cs index 161f9f957582..81dcf4b08aa4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmRunCommandCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetVmRunCommandCollection.cs @@ -150,6 +150,50 @@ public async Task Exists_GetVirtualMachineScaleSetVMRunCommands() Console.WriteLine($"Succeeded: {result}"); } + // Get VirtualMachineScaleSet VM run commands. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachineScaleSetVMRunCommands() + { + // Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json + // this example is just showing the usage of "VirtualMachineScaleSetVMRunCommands_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 VirtualMachineScaleSetVmResource created on azure + // for more information of creating VirtualMachineScaleSetVmResource, please refer to the document of VirtualMachineScaleSetVmResource + string subscriptionId = "{subscription-id}"; + string resourceGroupName = "myResourceGroup"; + string virtualMachineScaleSetName = "myvmScaleSet"; + string instanceId = "0"; + ResourceIdentifier virtualMachineScaleSetVmResourceId = VirtualMachineScaleSetVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineScaleSetName, instanceId); + VirtualMachineScaleSetVmResource virtualMachineScaleSetVm = client.GetVirtualMachineScaleSetVmResource(virtualMachineScaleSetVmResourceId); + + // get the collection of this VirtualMachineScaleSetVmRunCommandResource + VirtualMachineScaleSetVmRunCommandCollection collection = virtualMachineScaleSetVm.GetVirtualMachineScaleSetVmRunCommands(); + + // invoke the operation + string runCommandName = "myRunCommand"; + NullableResponse response = await collection.GetIfExistsAsync(runCommandName); + VirtualMachineScaleSetVmRunCommandResource 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 + VirtualMachineRunCommandData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List run commands in Vmss instance. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetCollection.cs index 10613d9dc531..48a3ae881f74 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string availabilitySetName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName} + /// + /// + /// Operation Id + /// AvailabilitySets_Get + /// + /// + /// + /// The name of the availability set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string availabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(availabilitySetName, nameof(availabilitySetName)); + + using var scope = _availabilitySetClientDiagnostics.CreateScope("AvailabilitySetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _availabilitySetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, availabilitySetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvailabilitySetResource(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.Compute/availabilitySets/{availabilitySetName} + /// + /// + /// Operation Id + /// AvailabilitySets_Get + /// + /// + /// + /// The name of the availability set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string availabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(availabilitySetName, nameof(availabilitySetName)); + + using var scope = _availabilitySetClientDiagnostics.CreateScope("AvailabilitySetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _availabilitySetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, availabilitySetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AvailabilitySetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationCollection.cs index 43387b870a11..250aa75b37d3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string capacityReservationName, CapacityRes } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName} + /// + /// + /// Operation Id + /// CapacityReservations_Get + /// + /// + /// + /// The name of the capacity reservation. + /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string capacityReservationName, CapacityReservationInstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capacityReservationName, nameof(capacityReservationName)); + + using var scope = _capacityReservationClientDiagnostics.CreateScope("CapacityReservationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _capacityReservationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, capacityReservationName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapacityReservationResource(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.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName} + /// + /// + /// Operation Id + /// CapacityReservations_Get + /// + /// + /// + /// The name of the capacity reservation. + /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string capacityReservationName, CapacityReservationInstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capacityReservationName, nameof(capacityReservationName)); + + using var scope = _capacityReservationClientDiagnostics.CreateScope("CapacityReservationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _capacityReservationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, capacityReservationName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapacityReservationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupCollection.cs index 8a1d83c5082d..96a5102be369 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupCollection.cs @@ -331,6 +331,82 @@ public virtual Response Exists(string capacityReservationGroupName, Capaci } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName} + /// + /// + /// Operation Id + /// CapacityReservationGroups_Get + /// + /// + /// + /// The name of the capacity reservation group. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string capacityReservationGroupName, CapacityReservationGroupInstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capacityReservationGroupName, nameof(capacityReservationGroupName)); + + using var scope = _capacityReservationGroupClientDiagnostics.CreateScope("CapacityReservationGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _capacityReservationGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, capacityReservationGroupName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapacityReservationGroupResource(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.Compute/capacityReservationGroups/{capacityReservationGroupName} + /// + /// + /// Operation Id + /// CapacityReservationGroups_Get + /// + /// + /// + /// The name of the capacity reservation group. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string capacityReservationGroupName, CapacityReservationGroupInstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capacityReservationGroupName, nameof(capacityReservationGroupName)); + + using var scope = _capacityReservationGroupClientDiagnostics.CreateScope("CapacityReservationGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _capacityReservationGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, capacityReservationGroupName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CapacityReservationGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceCollection.cs index 8874b2fef025..3a83586a76fd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string cloudServiceName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName} + /// + /// + /// Operation Id + /// CloudServices_Get + /// + /// + /// + /// Name of the cloud service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string cloudServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudServiceName, nameof(cloudServiceName)); + + using var scope = _cloudServiceClientDiagnostics.CreateScope("CloudServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cloudServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, cloudServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceResource(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.Compute/cloudServices/{cloudServiceName} + /// + /// + /// Operation Id + /// CloudServices_Get + /// + /// + /// + /// Name of the cloud service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string cloudServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cloudServiceName, nameof(cloudServiceName)); + + using var scope = _cloudServiceClientDiagnostics.CreateScope("CloudServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cloudServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, cloudServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyCollection.cs index c55b08c4c299..41cfc698de83 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string osFamilyName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName} + /// + /// + /// Operation Id + /// CloudServiceOperatingSystems_GetOSFamily + /// + /// + /// + /// Name of the OS family. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string osFamilyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(osFamilyName, nameof(osFamilyName)); + + using var scope = _cloudServiceOSFamilyCloudServiceOperatingSystemsClientDiagnostics.CreateScope("CloudServiceOSFamilyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cloudServiceOSFamilyCloudServiceOperatingSystemsRestClient.GetOSFamilyAsync(Id.SubscriptionId, new AzureLocation(_location), osFamilyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceOSFamilyResource(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}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName} + /// + /// + /// Operation Id + /// CloudServiceOperatingSystems_GetOSFamily + /// + /// + /// + /// Name of the OS family. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string osFamilyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(osFamilyName, nameof(osFamilyName)); + + using var scope = _cloudServiceOSFamilyCloudServiceOperatingSystemsClientDiagnostics.CreateScope("CloudServiceOSFamilyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cloudServiceOSFamilyCloudServiceOperatingSystemsRestClient.GetOSFamily(Id.SubscriptionId, new AzureLocation(_location), osFamilyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceOSFamilyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionCollection.cs index a32a62152c1b..be8c64ccb4eb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string osVersionName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName} + /// + /// + /// Operation Id + /// CloudServiceOperatingSystems_GetOSVersion + /// + /// + /// + /// Name of the OS version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string osVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(osVersionName, nameof(osVersionName)); + + using var scope = _cloudServiceOSVersionCloudServiceOperatingSystemsClientDiagnostics.CreateScope("CloudServiceOSVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cloudServiceOSVersionCloudServiceOperatingSystemsRestClient.GetOSVersionAsync(Id.SubscriptionId, new AzureLocation(_location), osVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceOSVersionResource(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}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName} + /// + /// + /// Operation Id + /// CloudServiceOperatingSystems_GetOSVersion + /// + /// + /// + /// Name of the OS version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string osVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(osVersionName, nameof(osVersionName)); + + using var scope = _cloudServiceOSVersionCloudServiceOperatingSystemsClientDiagnostics.CreateScope("CloudServiceOSVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cloudServiceOSVersionCloudServiceOperatingSystemsRestClient.GetOSVersion(Id.SubscriptionId, new AzureLocation(_location), osVersionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceOSVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleCollection.cs index b6030e8ffde0..aa7590d8a87f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string roleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName} + /// + /// + /// Operation Id + /// CloudServiceRoles_Get + /// + /// + /// + /// Name of the role. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); + + using var scope = _cloudServiceRoleClientDiagnostics.CreateScope("CloudServiceRoleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cloudServiceRoleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceRoleResource(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.Compute/cloudServices/{cloudServiceName}/roles/{roleName} + /// + /// + /// Operation Id + /// CloudServiceRoles_Get + /// + /// + /// + /// Name of the role. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); + + using var scope = _cloudServiceRoleClientDiagnostics.CreateScope("CloudServiceRoleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cloudServiceRoleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceRoleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceCollection.cs index 02114cebbbe3..0269e2e12513 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceCollection.cs @@ -248,6 +248,82 @@ public virtual Response Exists(string roleInstanceName, InstanceViewType? } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName} + /// + /// + /// Operation Id + /// CloudServiceRoleInstances_Get + /// + /// + /// + /// Name of the role instance. + /// The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleInstanceName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleInstanceName, nameof(roleInstanceName)); + + using var scope = _cloudServiceRoleInstanceClientDiagnostics.CreateScope("CloudServiceRoleInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cloudServiceRoleInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleInstanceName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceRoleInstanceResource(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.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName} + /// + /// + /// Operation Id + /// CloudServiceRoleInstances_Get + /// + /// + /// + /// Name of the role instance. + /// The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleInstanceName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleInstanceName, nameof(roleInstanceName)); + + using var scope = _cloudServiceRoleInstanceClientDiagnostics.CreateScope("CloudServiceRoleInstanceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cloudServiceRoleInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleInstanceName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudServiceRoleInstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryCollection.cs index 57f1a2206122..24f86b0c8bbc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryCollection.cs @@ -200,5 +200,83 @@ public virtual Response Exists(AzureLocation location, string publicGaller throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName} + /// + /// + /// Operation Id + /// CommunityGalleries_Get + /// + /// + /// + /// Resource location. + /// The public name of the community gallery. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string publicGalleryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicGalleryName, nameof(publicGalleryName)); + + using var scope = _communityGalleryClientDiagnostics.CreateScope("CommunityGalleryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _communityGalleryRestClient.GetAsync(Id.SubscriptionId, location, publicGalleryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = CommunityGalleryResource.CreateResourceIdentifier(Id.SubscriptionId, location, publicGalleryName); + return Response.FromValue(new CommunityGalleryResource(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}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName} + /// + /// + /// Operation Id + /// CommunityGalleries_Get + /// + /// + /// + /// Resource location. + /// The public name of the community gallery. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(AzureLocation location, string publicGalleryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicGalleryName, nameof(publicGalleryName)); + + using var scope = _communityGalleryClientDiagnostics.CreateScope("CommunityGalleryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _communityGalleryRestClient.Get(Id.SubscriptionId, location, publicGalleryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = CommunityGalleryResource.CreateResourceIdentifier(Id.SubscriptionId, location, publicGalleryName); + return Response.FromValue(new CommunityGalleryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageCollection.cs index 2ae3eaa1ae55..61f7a90e4271 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageCollection.cs @@ -243,6 +243,82 @@ public virtual Response Exists(string galleryImageName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName} + /// + /// + /// Operation Id + /// CommunityGalleryImages_Get + /// + /// + /// + /// The name of the community gallery image definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryImageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageName, nameof(galleryImageName)); + + using var scope = _communityGalleryImageClientDiagnostics.CreateScope("CommunityGalleryImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _communityGalleryImageRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, galleryImageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = CommunityGalleryImageResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, galleryImageName); + return Response.FromValue(new CommunityGalleryImageResource(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}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName} + /// + /// + /// Operation Id + /// CommunityGalleryImages_Get + /// + /// + /// + /// The name of the community gallery image definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryImageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageName, nameof(galleryImageName)); + + using var scope = _communityGalleryImageClientDiagnostics.CreateScope("CommunityGalleryImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _communityGalleryImageRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, galleryImageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = CommunityGalleryImageResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, galleryImageName); + return Response.FromValue(new CommunityGalleryImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionCollection.cs index f1f8c9f04391..f3d101aa5cba 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionCollection.cs @@ -243,6 +243,82 @@ public virtual Response Exists(string galleryImageVersionName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName} + /// + /// + /// Operation Id + /// CommunityGalleryImageVersions_Get + /// + /// + /// + /// The name of the community gallery image version. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryImageVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageVersionName, nameof(galleryImageVersionName)); + + using var scope = _communityGalleryImageVersionClientDiagnostics.CreateScope("CommunityGalleryImageVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _communityGalleryImageVersionRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, galleryImageVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = CommunityGalleryImageVersionResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, galleryImageVersionName); + return Response.FromValue(new CommunityGalleryImageVersionResource(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}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName} + /// + /// + /// Operation Id + /// CommunityGalleryImageVersions_Get + /// + /// + /// + /// The name of the community gallery image version. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryImageVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageVersionName, nameof(galleryImageVersionName)); + + using var scope = _communityGalleryImageVersionClientDiagnostics.CreateScope("CommunityGalleryImageVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _communityGalleryImageVersionRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, galleryImageVersionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = CommunityGalleryImageVersionResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, galleryImageVersionName); + return Response.FromValue(new CommunityGalleryImageVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionCollection.cs index fc35fcbe7008..bf22a6b8e5a6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// DiskAccesses_GetAPrivateEndpointConnection + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _computePrivateEndpointConnectionDiskAccessesClientDiagnostics.CreateScope("ComputePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _computePrivateEndpointConnectionDiskAccessesRestClient.GetAPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComputePrivateEndpointConnectionResource(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.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// DiskAccesses_GetAPrivateEndpointConnection + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _computePrivateEndpointConnectionDiskAccessesClientDiagnostics.CreateScope("ComputePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _computePrivateEndpointConnectionDiskAccessesRestClient.GetAPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComputePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostCollection.cs index da720f00283a..ab269ddbee43 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string hostName, InstanceViewType? expand = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName} + /// + /// + /// Operation Id + /// DedicatedHosts_Get + /// + /// + /// + /// The name of the dedicated host. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated host. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hostName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostName, nameof(hostName)); + + using var scope = _dedicatedHostClientDiagnostics.CreateScope("DedicatedHostCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dedicatedHostRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hostName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DedicatedHostResource(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.Compute/hostGroups/{hostGroupName}/hosts/{hostName} + /// + /// + /// Operation Id + /// DedicatedHosts_Get + /// + /// + /// + /// The name of the dedicated host. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated host. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hostName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostName, nameof(hostName)); + + using var scope = _dedicatedHostClientDiagnostics.CreateScope("DedicatedHostCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dedicatedHostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hostName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DedicatedHostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupCollection.cs index 8b03b4bae58a..18ab16ce2bc1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string hostGroupName, InstanceViewType? exp } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName} + /// + /// + /// Operation Id + /// DedicatedHostGroups_Get + /// + /// + /// + /// The name of the dedicated host group. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hostGroupName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostGroupName, nameof(hostGroupName)); + + using var scope = _dedicatedHostGroupClientDiagnostics.CreateScope("DedicatedHostGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dedicatedHostGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, hostGroupName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DedicatedHostGroupResource(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.Compute/hostGroups/{hostGroupName} + /// + /// + /// Operation Id + /// DedicatedHostGroups_Get + /// + /// + /// + /// The name of the dedicated host group. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hostGroupName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostGroupName, nameof(hostGroupName)); + + using var scope = _dedicatedHostGroupClientDiagnostics.CreateScope("DedicatedHostGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dedicatedHostGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, hostGroupName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DedicatedHostGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessCollection.cs index b5fc9351df6b..4d6e95cc132d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string diskAccessName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName} + /// + /// + /// Operation Id + /// DiskAccesses_Get + /// + /// + /// + /// The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diskAccessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskAccessName, nameof(diskAccessName)); + + using var scope = _diskAccessClientDiagnostics.CreateScope("DiskAccessCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _diskAccessRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, diskAccessName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskAccessResource(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.Compute/diskAccesses/{diskAccessName} + /// + /// + /// Operation Id + /// DiskAccesses_Get + /// + /// + /// + /// The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diskAccessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskAccessName, nameof(diskAccessName)); + + using var scope = _diskAccessClientDiagnostics.CreateScope("DiskAccessCollection.GetIfExists"); + scope.Start(); + try + { + var response = _diskAccessRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, diskAccessName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskAccessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetCollection.cs index 22e7b030e0cf..d64a263acbe1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string diskEncryptionSetName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName} + /// + /// + /// Operation Id + /// DiskEncryptionSets_Get + /// + /// + /// + /// The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diskEncryptionSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskEncryptionSetName, nameof(diskEncryptionSetName)); + + using var scope = _diskEncryptionSetClientDiagnostics.CreateScope("DiskEncryptionSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _diskEncryptionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, diskEncryptionSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskEncryptionSetResource(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.Compute/diskEncryptionSets/{diskEncryptionSetName} + /// + /// + /// Operation Id + /// DiskEncryptionSets_Get + /// + /// + /// + /// The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diskEncryptionSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskEncryptionSetName, nameof(diskEncryptionSetName)); + + using var scope = _diskEncryptionSetClientDiagnostics.CreateScope("DiskEncryptionSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _diskEncryptionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, diskEncryptionSetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskEncryptionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageCollection.cs index bd0511cd1c3f..32d8af996517 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string imageName, string expand = null, Can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// The name of the image. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string imageName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + using var scope = _diskImageImagesClientDiagnostics.CreateScope("DiskImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _diskImageImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, imageName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskImageResource(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.Compute/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// The name of the image. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string imageName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + using var scope = _diskImageImagesClientDiagnostics.CreateScope("DiskImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _diskImageImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, imageName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointCollection.cs index dadf53ca3297..3d3727e34326 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string diskRestorePointName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName} + /// + /// + /// Operation Id + /// DiskRestorePoint_Get + /// + /// + /// + /// The name of the disk restore point created. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diskRestorePointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskRestorePointName, nameof(diskRestorePointName)); + + using var scope = _diskRestorePointClientDiagnostics.CreateScope("DiskRestorePointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _diskRestorePointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diskRestorePointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskRestorePointResource(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.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName} + /// + /// + /// Operation Id + /// DiskRestorePoint_Get + /// + /// + /// + /// The name of the disk restore point created. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diskRestorePointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskRestorePointName, nameof(diskRestorePointName)); + + using var scope = _diskRestorePointClientDiagnostics.CreateScope("DiskRestorePointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _diskRestorePointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diskRestorePointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DiskRestorePointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs index 449a98c298b3..1804a4cadb0f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string galleryApplicationName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName} + /// + /// + /// Operation Id + /// GalleryApplications_Get + /// + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryApplicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryApplicationName, nameof(galleryApplicationName)); + + using var scope = _galleryApplicationClientDiagnostics.CreateScope("GalleryApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _galleryApplicationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryApplicationResource(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.Compute/galleries/{galleryName}/applications/{galleryApplicationName} + /// + /// + /// Operation Id + /// GalleryApplications_Get + /// + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryApplicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryApplicationName, nameof(galleryApplicationName)); + + using var scope = _galleryApplicationClientDiagnostics.CreateScope("GalleryApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _galleryApplicationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionCollection.cs index 21722cf4d462..720477c2c29c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string galleryApplicationVersionName, Repli } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName} + /// + /// + /// Operation Id + /// GalleryApplicationVersions_Get + /// + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryApplicationVersionName, ReplicationStatusType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryApplicationVersionName, nameof(galleryApplicationVersionName)); + + using var scope = _galleryApplicationVersionClientDiagnostics.CreateScope("GalleryApplicationVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _galleryApplicationVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryApplicationVersionName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryApplicationVersionResource(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.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName} + /// + /// + /// Operation Id + /// GalleryApplicationVersions_Get + /// + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryApplicationVersionName, ReplicationStatusType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryApplicationVersionName, nameof(galleryApplicationVersionName)); + + using var scope = _galleryApplicationVersionClientDiagnostics.CreateScope("GalleryApplicationVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _galleryApplicationVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryApplicationVersionName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryApplicationVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryCollection.cs index 183a1d6e9ac2..5d82ad086527 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryCollection.cs @@ -333,6 +333,84 @@ public virtual Response Exists(string galleryName, SelectPermission? selec } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName} + /// + /// + /// Operation Id + /// Galleries_Get + /// + /// + /// + /// The name of the Shared Image Gallery. + /// The select expression to apply on the operation. + /// The expand query option to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryName, SelectPermission? select = null, GalleryExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryName, nameof(galleryName)); + + using var scope = _galleryClientDiagnostics.CreateScope("GalleryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _galleryRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, galleryName, select, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryResource(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.Compute/galleries/{galleryName} + /// + /// + /// Operation Id + /// Galleries_Get + /// + /// + /// + /// The name of the Shared Image Gallery. + /// The select expression to apply on the operation. + /// The expand query option to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryName, SelectPermission? select = null, GalleryExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryName, nameof(galleryName)); + + using var scope = _galleryClientDiagnostics.CreateScope("GalleryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _galleryRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, galleryName, select, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageCollection.cs index 52ddd23de450..688e3eb1fd2a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string galleryImageName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName} + /// + /// + /// Operation Id + /// GalleryImages_Get + /// + /// + /// + /// The name of the gallery image definition to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryImageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageName, nameof(galleryImageName)); + + using var scope = _galleryImageClientDiagnostics.CreateScope("GalleryImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _galleryImageRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryImageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryImageResource(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.Compute/galleries/{galleryName}/images/{galleryImageName} + /// + /// + /// Operation Id + /// GalleryImages_Get + /// + /// + /// + /// The name of the gallery image definition to be retrieved. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryImageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageName, nameof(galleryImageName)); + + using var scope = _galleryImageClientDiagnostics.CreateScope("GalleryImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _galleryImageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryImageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionCollection.cs index 8faf5344b6ad..a0b82766af47 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string galleryImageVersionName, Replication } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName} + /// + /// + /// Operation Id + /// GalleryImageVersions_Get + /// + /// + /// + /// The name of the gallery image version to be retrieved. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryImageVersionName, ReplicationStatusType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageVersionName, nameof(galleryImageVersionName)); + + using var scope = _galleryImageVersionClientDiagnostics.CreateScope("GalleryImageVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _galleryImageVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryImageVersionName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryImageVersionResource(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.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName} + /// + /// + /// Operation Id + /// GalleryImageVersions_Get + /// + /// + /// + /// The name of the gallery image version to be retrieved. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryImageVersionName, ReplicationStatusType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageVersionName, nameof(galleryImageVersionName)); + + using var scope = _galleryImageVersionClientDiagnostics.CreateScope("GalleryImageVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _galleryImageVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryImageVersionName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GalleryImageVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskCollection.cs index 7e5f6e5d54ca..7f2cee0625a4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string diskName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName} + /// + /// + /// Operation Id + /// Disks_Get + /// + /// + /// + /// The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string diskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskName, nameof(diskName)); + + using var scope = _managedDiskDisksClientDiagnostics.CreateScope("ManagedDiskCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, diskName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDiskResource(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.Compute/disks/{diskName} + /// + /// + /// Operation Id + /// Disks_Get + /// + /// + /// + /// The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string diskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(diskName, nameof(diskName)); + + using var scope = _managedDiskDisksClientDiagnostics.CreateScope("ManagedDiskCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, diskName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedDiskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupCollection.cs index ee02b74fd7c3..d19ea4633fa3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupCollection.cs @@ -328,6 +328,82 @@ public virtual Response Exists(string proximityPlacementGroupName, string } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName} + /// + /// + /// Operation Id + /// ProximityPlacementGroups_Get + /// + /// + /// + /// The name of the proximity placement group. + /// includeColocationStatus=true enables fetching the colocation status of all the resources in the proximity placement group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string proximityPlacementGroupName, string includeColocationStatus = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(proximityPlacementGroupName, nameof(proximityPlacementGroupName)); + + using var scope = _proximityPlacementGroupClientDiagnostics.CreateScope("ProximityPlacementGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _proximityPlacementGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, proximityPlacementGroupName, includeColocationStatus, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProximityPlacementGroupResource(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.Compute/proximityPlacementGroups/{proximityPlacementGroupName} + /// + /// + /// Operation Id + /// ProximityPlacementGroups_Get + /// + /// + /// + /// The name of the proximity placement group. + /// includeColocationStatus=true enables fetching the colocation status of all the resources in the proximity placement group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string proximityPlacementGroupName, string includeColocationStatus = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(proximityPlacementGroupName, nameof(proximityPlacementGroupName)); + + using var scope = _proximityPlacementGroupClientDiagnostics.CreateScope("ProximityPlacementGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _proximityPlacementGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, proximityPlacementGroupName, includeColocationStatus, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProximityPlacementGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointCollection.cs index 8cbae8e0bbe2..562120982b83 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointCollection.cs @@ -280,5 +280,81 @@ public virtual Response Exists(string restorePointName, RestorePointExpand throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName} + /// + /// + /// Operation Id + /// RestorePoints_Get + /// + /// + /// + /// The name of the restore point. + /// The expand expression to apply on the operation. 'InstanceView' retrieves information about the run-time state of a restore point. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string restorePointName, RestorePointExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorePointName, nameof(restorePointName)); + + using var scope = _restorePointClientDiagnostics.CreateScope("RestorePointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _restorePointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restorePointName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorePointResource(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.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName} + /// + /// + /// Operation Id + /// RestorePoints_Get + /// + /// + /// + /// The name of the restore point. + /// The expand expression to apply on the operation. 'InstanceView' retrieves information about the run-time state of a restore point. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string restorePointName, RestorePointExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorePointName, nameof(restorePointName)); + + using var scope = _restorePointClientDiagnostics.CreateScope("RestorePointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _restorePointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restorePointName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorePointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupCollection.cs index 904a8f46de44..84bb207fc275 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string restorePointGroupName, RestorePointG } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName} + /// + /// + /// Operation Id + /// RestorePointCollections_Get + /// + /// + /// + /// The name of the restore point collection. + /// The expand expression to apply on the operation. If expand=restorePoints, server will return all contained restore points in the restorePointCollection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string restorePointGroupName, RestorePointGroupExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorePointGroupName, nameof(restorePointGroupName)); + + using var scope = _restorePointGroupRestorePointCollectionsClientDiagnostics.CreateScope("RestorePointGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _restorePointGroupRestorePointCollectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, restorePointGroupName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorePointGroupResource(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.Compute/restorePointCollections/{restorePointCollectionName} + /// + /// + /// Operation Id + /// RestorePointCollections_Get + /// + /// + /// + /// The name of the restore point collection. + /// The expand expression to apply on the operation. If expand=restorePoints, server will return all contained restore points in the restorePointCollection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string restorePointGroupName, RestorePointGroupExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(restorePointGroupName, nameof(restorePointGroupName)); + + using var scope = _restorePointGroupRestorePointCollectionsClientDiagnostics.CreateScope("RestorePointGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _restorePointGroupRestorePointCollectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, restorePointGroupName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorePointGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryCollection.cs index 90d1cd836ef8..743bc33835f8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryCollection.cs @@ -250,6 +250,82 @@ public virtual Response Exists(string galleryUniqueName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName} + /// + /// + /// Operation Id + /// SharedGalleries_Get + /// + /// + /// + /// The unique name of the Shared Gallery. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryUniqueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryUniqueName, nameof(galleryUniqueName)); + + using var scope = _sharedGalleryClientDiagnostics.CreateScope("SharedGalleryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sharedGalleryRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), galleryUniqueName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = SharedGalleryResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(_location), galleryUniqueName); + return Response.FromValue(new SharedGalleryResource(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}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName} + /// + /// + /// Operation Id + /// SharedGalleries_Get + /// + /// + /// + /// The unique name of the Shared Gallery. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryUniqueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryUniqueName, nameof(galleryUniqueName)); + + using var scope = _sharedGalleryClientDiagnostics.CreateScope("SharedGalleryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sharedGalleryRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), galleryUniqueName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = SharedGalleryResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(_location), galleryUniqueName); + return Response.FromValue(new SharedGalleryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageCollection.cs index 22f3fe0af5b3..854c08398c3e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageCollection.cs @@ -246,6 +246,82 @@ public virtual Response Exists(string galleryImageName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName} + /// + /// + /// Operation Id + /// SharedGalleryImages_Get + /// + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryImageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageName, nameof(galleryImageName)); + + using var scope = _sharedGalleryImageClientDiagnostics.CreateScope("SharedGalleryImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sharedGalleryImageRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, galleryImageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = SharedGalleryImageResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, galleryImageName); + return Response.FromValue(new SharedGalleryImageResource(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}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName} + /// + /// + /// Operation Id + /// SharedGalleryImages_Get + /// + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryImageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageName, nameof(galleryImageName)); + + using var scope = _sharedGalleryImageClientDiagnostics.CreateScope("SharedGalleryImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sharedGalleryImageRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, galleryImageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = SharedGalleryImageResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, galleryImageName); + return Response.FromValue(new SharedGalleryImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionCollection.cs index 301ee2211140..695d9ac1496f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionCollection.cs @@ -246,6 +246,82 @@ public virtual Response Exists(string galleryImageVersionName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName} + /// + /// + /// Operation Id + /// SharedGalleryImageVersions_Get + /// + /// + /// + /// The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string galleryImageVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageVersionName, nameof(galleryImageVersionName)); + + using var scope = _sharedGalleryImageVersionClientDiagnostics.CreateScope("SharedGalleryImageVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sharedGalleryImageVersionRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, galleryImageVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = SharedGalleryImageVersionResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, galleryImageVersionName); + return Response.FromValue(new SharedGalleryImageVersionResource(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}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName} + /// + /// + /// Operation Id + /// SharedGalleryImageVersions_Get + /// + /// + /// + /// The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string galleryImageVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(galleryImageVersionName, nameof(galleryImageVersionName)); + + using var scope = _sharedGalleryImageVersionClientDiagnostics.CreateScope("SharedGalleryImageVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sharedGalleryImageVersionRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, galleryImageVersionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + response.Value.Id = SharedGalleryImageVersionResource.CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, galleryImageVersionName); + return Response.FromValue(new SharedGalleryImageVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotCollection.cs index 02611566556a..b7161f1de999 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string snapshotName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _snapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(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.Compute/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _snapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, snapshotName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyCollection.cs index a90b47e2bae5..e93983a10a63 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string sshPublicKeyName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName} + /// + /// + /// Operation Id + /// SshPublicKeys_Get + /// + /// + /// + /// The name of the SSH public key. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sshPublicKeyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sshPublicKeyName, nameof(sshPublicKeyName)); + + using var scope = _sshPublicKeyClientDiagnostics.CreateScope("SshPublicKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sshPublicKeyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, sshPublicKeyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SshPublicKeyResource(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.Compute/sshPublicKeys/{sshPublicKeyName} + /// + /// + /// Operation Id + /// SshPublicKeys_Get + /// + /// + /// + /// The name of the SSH public key. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sshPublicKeyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sshPublicKeyName, nameof(sshPublicKeyName)); + + using var scope = _sshPublicKeyClientDiagnostics.CreateScope("SshPublicKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sshPublicKeyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, sshPublicKeyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SshPublicKeyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineCollection.cs index f092e33ca4a7..e93714cf7391 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineCollection.cs @@ -333,6 +333,82 @@ public virtual Response Exists(string vmName, InstanceViewType? expand = n } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vmName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vmName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(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.Compute/virtualMachines/{vmName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vmName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vmName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionCollection.cs index 46408e00bf74..a5a9030352b2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string vmExtensionName, string expand = nul } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName} + /// + /// + /// Operation Id + /// VirtualMachineExtensions_Get + /// + /// + /// + /// The name of the virtual machine extension. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmExtensionName, nameof(vmExtensionName)); + + using var scope = _virtualMachineExtensionClientDiagnostics.CreateScope("VirtualMachineExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineExtensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmExtensionName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineExtensionResource(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.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName} + /// + /// + /// Operation Id + /// VirtualMachineExtensions_Get + /// + /// + /// + /// The name of the virtual machine extension. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmExtensionName, nameof(vmExtensionName)); + + using var scope = _virtualMachineExtensionClientDiagnostics.CreateScope("VirtualMachineExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmExtensionName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageCollection.cs index 073b32a79fc0..e16fc107571a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageCollection.cs @@ -314,6 +314,84 @@ public virtual Response Exists(string type, string version, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineExtensionImages_Get + /// + /// + /// + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string type, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(type, nameof(type)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _virtualMachineExtensionImageClientDiagnostics.CreateScope("VirtualMachineExtensionImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineExtensionImageRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), _publisherName, type, version, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineExtensionImageResource(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}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineExtensionImages_Get + /// + /// + /// + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string type, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(type, nameof(type)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = _virtualMachineExtensionImageClientDiagnostics.CreateScope("VirtualMachineExtensionImageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineExtensionImageRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), _publisherName, type, version, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineExtensionImageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandCollection.cs index f0385126d80e..09159a754d3b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string runCommandName, string expand = null } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName} + /// + /// + /// Operation Id + /// VirtualMachineRunCommands_GetByVirtualMachine + /// + /// + /// + /// The name of the virtual machine run command. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string runCommandName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runCommandName, nameof(runCommandName)); + + using var scope = _virtualMachineRunCommandClientDiagnostics.CreateScope("VirtualMachineRunCommandCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineRunCommandRestClient.GetByVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runCommandName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineRunCommandResource(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.Compute/virtualMachines/{vmName}/runCommands/{runCommandName} + /// + /// + /// Operation Id + /// VirtualMachineRunCommands_GetByVirtualMachine + /// + /// + /// + /// The name of the virtual machine run command. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string runCommandName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runCommandName, nameof(runCommandName)); + + using var scope = _virtualMachineRunCommandClientDiagnostics.CreateScope("VirtualMachineRunCommandCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineRunCommandRestClient.GetByVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runCommandName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineRunCommandResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetCollection.cs index a7f284973557..1a530835f348 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string virtualMachineScaleSetName, VirtualM } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSets_Get + /// + /// + /// + /// The name of the VM scale set. + /// The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set Create/Update operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualMachineScaleSetName, VirtualMachineScaleSetGetExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineScaleSetName, nameof(virtualMachineScaleSetName)); + + using var scope = _virtualMachineScaleSetClientDiagnostics.CreateScope("VirtualMachineScaleSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineScaleSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineScaleSetName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetResource(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.Compute/virtualMachineScaleSets/{vmScaleSetName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSets_Get + /// + /// + /// + /// The name of the VM scale set. + /// The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set Create/Update operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineScaleSetName, VirtualMachineScaleSetGetExpand? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineScaleSetName, nameof(virtualMachineScaleSetName)); + + using var scope = _virtualMachineScaleSetClientDiagnostics.CreateScope("VirtualMachineScaleSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineScaleSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineScaleSetName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionCollection.cs index dd9cdc3f88aa..c155a99f6ce4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string vmssExtensionName, string expand = n } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSetExtensions_Get + /// + /// + /// + /// The name of the VM scale set extension. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vmssExtensionName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmssExtensionName, nameof(vmssExtensionName)); + + using var scope = _virtualMachineScaleSetExtensionClientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineScaleSetExtensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmssExtensionName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetExtensionResource(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.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSetExtensions_Get + /// + /// + /// + /// The name of the VM scale set extension. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vmssExtensionName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmssExtensionName, nameof(vmssExtensionName)); + + using var scope = _virtualMachineScaleSetExtensionClientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineScaleSetExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmssExtensionName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmCollection.cs index cd77146ea202..ddc00b3d859a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmCollection.cs @@ -334,6 +334,82 @@ public virtual Response Exists(string instanceId, InstanceViewType? expand } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId} + /// + /// + /// Operation Id + /// VirtualMachineScaleSetVMs_Get + /// + /// + /// + /// The instance ID of the virtual machine. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string instanceId, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceId, nameof(instanceId)); + + using var scope = _virtualMachineScaleSetVmVirtualMachineScaleSetVmsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineScaleSetVmVirtualMachineScaleSetVmsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, instanceId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetVmResource(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.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId} + /// + /// + /// Operation Id + /// VirtualMachineScaleSetVMs_Get + /// + /// + /// + /// The instance ID of the virtual machine. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string instanceId, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceId, nameof(instanceId)); + + using var scope = _virtualMachineScaleSetVmVirtualMachineScaleSetVmsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineScaleSetVmVirtualMachineScaleSetVmsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, instanceId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetVmResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionCollection.cs index f822c5bfea62..579c3ad40d54 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionCollection.cs @@ -327,6 +327,82 @@ public virtual Response Exists(string vmExtensionName, string expand = nul } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSetVMExtensions_Get + /// + /// + /// + /// The name of the virtual machine extension. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmExtensionName, nameof(vmExtensionName)); + + using var scope = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vmExtensionName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetVmExtensionResource(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.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSetVMExtensions_Get + /// + /// + /// + /// The name of the virtual machine extension. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmExtensionName, nameof(vmExtensionName)); + + using var scope = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, vmExtensionName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetVmExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandCollection.cs index a26155befefe..8ac5d94cc95c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string runCommandName, string expand = null } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSetVMRunCommands_Get + /// + /// + /// + /// The name of the virtual machine run command. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string runCommandName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runCommandName, nameof(runCommandName)); + + using var scope = _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmRunCommandCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, runCommandName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetVmRunCommandResource(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.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSetVMRunCommands_Get + /// + /// + /// + /// The name of the virtual machine run command. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string runCommandName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runCommandName, nameof(runCommandName)); + + using var scope = _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmRunCommandCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, runCommandName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineScaleSetVmRunCommandResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/samples/Generated/Samples/Sample_ConfidentialLedgerCollection.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/samples/Generated/Samples/Sample_ConfidentialLedgerCollection.cs index c9ff200aca51..58acc1be28f7 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/samples/Generated/Samples/Sample_ConfidentialLedgerCollection.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/samples/Generated/Samples/Sample_ConfidentialLedgerCollection.cs @@ -83,6 +83,48 @@ public async Task Exists_ConfidentialLedgerGet() Console.WriteLine($"Succeeded: {result}"); } + // ConfidentialLedgerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConfidentialLedgerGet() + { + // Generated from example definition: specification/confidentialledger/resource-manager/Microsoft.ConfidentialLedger/preview/2023-01-26-preview/examples/ConfidentialLedger_Get.json + // this example is just showing the usage of "Ledger_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 = "0000000-0000-0000-0000-000000000001"; + string resourceGroupName = "DummyResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfidentialLedgerResource + ConfidentialLedgerCollection collection = resourceGroupResource.GetConfidentialLedgers(); + + // invoke the operation + string ledgerName = "DummyLedgerName"; + NullableResponse response = await collection.GetIfExistsAsync(ledgerName); + ConfidentialLedgerResource 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 + ConfidentialLedgerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConfidentialLedgerCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/samples/Generated/Samples/Sample_ManagedCcfCollection.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/samples/Generated/Samples/Sample_ManagedCcfCollection.cs index 0bff2ba41f08..78d06d1f1551 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/samples/Generated/Samples/Sample_ManagedCcfCollection.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/samples/Generated/Samples/Sample_ManagedCcfCollection.cs @@ -84,6 +84,48 @@ public async Task Exists_ManagedCCFGet() Console.WriteLine($"Succeeded: {result}"); } + // ManagedCCFGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagedCCFGet() + { + // Generated from example definition: specification/confidentialledger/resource-manager/Microsoft.ConfidentialLedger/preview/2023-01-26-preview/examples/ManagedCCF_Get.json + // this example is just showing the usage of "ManagedCCF_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 = "0000000-0000-0000-0000-000000000001"; + string resourceGroupName = "DummyResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedCcfResource + ManagedCcfCollection collection = resourceGroupResource.GetManagedCcfs(); + + // invoke the operation + string appName = "DummyMccfAppName"; + NullableResponse response = await collection.GetIfExistsAsync(appName); + ManagedCcfResource 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 + ManagedCcfData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ManagedCCFCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerCollection.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerCollection.cs index ecff56c897ee..b14c70904264 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerCollection.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string ledgerName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName} + /// + /// + /// Operation Id + /// Ledger_Get + /// + /// + /// + /// Name of the Confidential Ledger. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ledgerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ledgerName, nameof(ledgerName)); + + using var scope = _confidentialLedgerLedgerClientDiagnostics.CreateScope("ConfidentialLedgerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _confidentialLedgerLedgerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ledgerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfidentialLedgerResource(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.ConfidentialLedger/ledgers/{ledgerName} + /// + /// + /// Operation Id + /// Ledger_Get + /// + /// + /// + /// Name of the Confidential Ledger. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ledgerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ledgerName, nameof(ledgerName)); + + using var scope = _confidentialLedgerLedgerClientDiagnostics.CreateScope("ConfidentialLedgerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _confidentialLedgerLedgerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ledgerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfidentialLedgerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfCollection.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfCollection.cs index b6e6008c9cfc..52f4294424c7 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfCollection.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string appName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var scope = _managedCcfManagedCcfClientDiagnostics.CreateScope("ManagedCcfCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedCcfManagedCcfRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, appName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedCcfResource(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.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var scope = _managedCcfManagedCcfClientDiagnostics.CreateScope("ManagedCcfCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedCcfManagedCcfRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, appName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedCcfResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/samples/Generated/Samples/Sample_ConfluentOrganizationCollection.cs b/sdk/confluent/Azure.ResourceManager.Confluent/samples/Generated/Samples/Sample_ConfluentOrganizationCollection.cs index 56ec5c17bd58..aba884df9635 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/samples/Generated/Samples/Sample_ConfluentOrganizationCollection.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/samples/Generated/Samples/Sample_ConfluentOrganizationCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_OrganizationGet() Console.WriteLine($"Succeeded: {result}"); } + // Organization_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_OrganizationGet() + { + // Generated from example definition: specification/confluent/resource-manager/Microsoft.Confluent/stable/2021-12-01/examples/Organization_Get.json + // this example is just showing the usage of "Organization_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfluentOrganizationResource + ConfluentOrganizationCollection collection = resourceGroupResource.GetConfluentOrganizations(); + + // invoke the operation + string organizationName = "myOrganization"; + NullableResponse response = await collection.GetIfExistsAsync(organizationName); + ConfluentOrganizationResource 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 + ConfluentOrganizationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Organization_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationCollection.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationCollection.cs index e5d9a0f49857..7fe1466cce4a 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationCollection.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string organizationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName} + /// + /// + /// Operation Id + /// Organization_Get + /// + /// + /// + /// Organization resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var scope = _confluentOrganizationOrganizationClientDiagnostics.CreateScope("ConfluentOrganizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _confluentOrganizationOrganizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfluentOrganizationResource(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.Confluent/organizations/{organizationName} + /// + /// + /// Operation Id + /// Organization_Get + /// + /// + /// + /// Organization resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var scope = _confluentOrganizationOrganizationClientDiagnostics.CreateScope("ConfluentOrganizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _confluentOrganizationOrganizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfluentOrganizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_GuestAgentCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_GuestAgentCollection.cs index 27d3f7639554..ff8be305c6de 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_GuestAgentCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_GuestAgentCollection.cs @@ -130,6 +130,49 @@ public async Task Exists_GetGuestAgent() Console.WriteLine($"Succeeded: {result}"); } + // GetGuestAgent + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetGuestAgent() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetGuestAgent.json + // this example is just showing the usage of "GuestAgents_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 VirtualMachineResource created on azure + // for more information of creating VirtualMachineResource, please refer to the document of VirtualMachineResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + string virtualMachineName = "ContosoVm"; + ResourceIdentifier virtualMachineResourceId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineName); + VirtualMachineResource virtualMachine = client.GetVirtualMachineResource(virtualMachineResourceId); + + // get the collection of this GuestAgentResource + GuestAgentCollection collection = virtualMachine.GetGuestAgents(); + + // invoke the operation + string name = "default"; + NullableResponse response = await collection.GetIfExistsAsync(name); + GuestAgentResource 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 + GuestAgentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GuestAgentListByVm [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_HybridIdentityMetadataCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_HybridIdentityMetadataCollection.cs index 4677007a6d03..81809a8167d3 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_HybridIdentityMetadataCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_HybridIdentityMetadataCollection.cs @@ -124,6 +124,49 @@ public async Task Exists_GetHybridIdentityMetadata() Console.WriteLine($"Succeeded: {result}"); } + // GetHybridIdentityMetadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetHybridIdentityMetadata() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetHybridIdentityMetadata.json + // this example is just showing the usage of "HybridIdentityMetadata_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 VirtualMachineResource created on azure + // for more information of creating VirtualMachineResource, please refer to the document of VirtualMachineResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + string virtualMachineName = "ContosoVm"; + ResourceIdentifier virtualMachineResourceId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, virtualMachineName); + VirtualMachineResource virtualMachine = client.GetVirtualMachineResource(virtualMachineResourceId); + + // get the collection of this HybridIdentityMetadataResource + HybridIdentityMetadataCollection collection = virtualMachine.GetAllHybridIdentityMetadata(); + + // invoke the operation + string metadataName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(metadataName); + HybridIdentityMetadataResource 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 + HybridIdentityMetadataData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // HybridIdentityMetadataListByVm [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_InventoryItemCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_InventoryItemCollection.cs index ec825f21b11f..b238d0848e2e 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_InventoryItemCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_InventoryItemCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetInventoryItem() Console.WriteLine($"Succeeded: {result}"); } + // GetInventoryItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInventoryItem() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetInventoryItem.json + // this example is just showing the usage of "InventoryItems_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 VCenterResource created on azure + // for more information of creating VCenterResource, please refer to the document of VCenterResource + string subscriptionId = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + string vcenterName = "ContosoVCenter"; + ResourceIdentifier vCenterResourceId = VCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vcenterName); + VCenterResource vCenter = client.GetVCenterResource(vCenterResourceId); + + // get the collection of this InventoryItemResource + InventoryItemCollection collection = vCenter.GetInventoryItems(); + + // invoke the operation + string inventoryItemName = "testItem"; + NullableResponse response = await collection.GetIfExistsAsync(inventoryItemName); + InventoryItemResource 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 + InventoryItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // InventoryItemsListByVCenter [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_MachineExtensionCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_MachineExtensionCollection.cs index e836e33946a9..d63c34350c82 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_MachineExtensionCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_MachineExtensionCollection.cs @@ -130,6 +130,49 @@ public async Task Exists_GetMachineExtension() Console.WriteLine($"Succeeded: {result}"); } + // Get Machine Extension + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMachineExtension() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GETExtension.json + // this example is just showing the usage of "MachineExtensions_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 VirtualMachineResource created on azure + // for more information of creating VirtualMachineResource, please refer to the document of VirtualMachineResource + string subscriptionId = "{subscriptionId}"; + string resourceGroupName = "myResourceGroup"; + string name = "myMachine"; + ResourceIdentifier virtualMachineResourceId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + VirtualMachineResource virtualMachine = client.GetVirtualMachineResource(virtualMachineResourceId); + + // get the collection of this MachineExtensionResource + MachineExtensionCollection collection = virtualMachine.GetMachineExtensions(); + + // invoke the operation + string extensionName = "CustomScriptExtension"; + NullableResponse response = await collection.GetIfExistsAsync(extensionName); + MachineExtensionResource 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 + MachineExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get all Machine Extensions [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_ResourcePoolCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_ResourcePoolCollection.cs index d29c872aaa19..188596e2f3f2 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_ResourcePoolCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_ResourcePoolCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_GetResourcePool() Console.WriteLine($"Succeeded: {result}"); } + // GetResourcePool + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetResourcePool() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetResourcePool.json + // this example is just showing the usage of "ResourcePools_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ResourcePoolResource + ResourcePoolCollection collection = resourceGroupResource.GetResourcePools(); + + // invoke the operation + string resourcePoolName = "HRPool"; + NullableResponse response = await collection.GetIfExistsAsync(resourcePoolName); + ResourcePoolResource 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 + ResourcePoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListResourcePoolsByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VCenterCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VCenterCollection.cs index 351185047b55..4c714c03b610 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VCenterCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VCenterCollection.cs @@ -132,6 +132,48 @@ public async Task Exists_GetVCenter() Console.WriteLine($"Succeeded: {result}"); } + // GetVCenter + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVCenter() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVCenter.json + // this example is just showing the usage of "VCenters_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VCenterResource + VCenterCollection collection = resourceGroupResource.GetVCenters(); + + // invoke the operation + string vcenterName = "ContosoVCenter"; + NullableResponse response = await collection.GetIfExistsAsync(vcenterName); + VCenterResource 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 + VCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListVCentersByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareClusterCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareClusterCollection.cs index 8dc1c0ba860e..3c5c64c45903 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareClusterCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareClusterCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_GetCluster() Console.WriteLine($"Succeeded: {result}"); } + // GetCluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCluster() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetCluster.json + // this example is just showing the usage of "Clusters_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VMwareClusterResource + VMwareClusterCollection collection = resourceGroupResource.GetVMwareClusters(); + + // invoke the operation + string clusterName = "HRCluster"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + VMwareClusterResource 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 + VMwareClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListClustersByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareDatastoreCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareDatastoreCollection.cs index 137c5f36fdf2..5b0b89638008 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareDatastoreCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareDatastoreCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_GetDatastore() Console.WriteLine($"Succeeded: {result}"); } + // GetDatastore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDatastore() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetDatastore.json + // this example is just showing the usage of "Datastores_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VMwareDatastoreResource + VMwareDatastoreCollection collection = resourceGroupResource.GetVMwareDatastores(); + + // invoke the operation + string datastoreName = "HRDatastore"; + NullableResponse response = await collection.GetIfExistsAsync(datastoreName); + VMwareDatastoreResource 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 + VMwareDatastoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListDatastoresByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareHostCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareHostCollection.cs index 685f5c64d52f..fe266c8f7de2 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareHostCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VMwareHostCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_GetHost() Console.WriteLine($"Succeeded: {result}"); } + // GetHost + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetHost() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetHost.json + // this example is just showing the usage of "Hosts_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VMwareHostResource + VMwareHostCollection collection = resourceGroupResource.GetVMwareHosts(); + + // invoke the operation + string hostName = "HRHost"; + NullableResponse response = await collection.GetIfExistsAsync(hostName); + VMwareHostResource 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 + VMwareHostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListHostsByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualMachineCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualMachineCollection.cs index 2f348ef2aad0..db1d5d58a1f4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualMachineCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualMachineCollection.cs @@ -134,6 +134,48 @@ public async Task Exists_GetVirtualMachine() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualMachine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachine() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualMachine.json + // this example is just showing the usage of "VirtualMachines_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = resourceGroupResource.GetVirtualMachines(); + + // invoke the operation + string virtualMachineName = "DemoVM"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineName); + VirtualMachineResource 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 + VirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListVirtualMachinesByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualMachineTemplateCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualMachineTemplateCollection.cs index 4c7918127b1c..54f58c299261 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualMachineTemplateCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualMachineTemplateCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_GetVirtualMachineTemplate() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualMachineTemplate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualMachineTemplate() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualMachineTemplate.json + // this example is just showing the usage of "VirtualMachineTemplates_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualMachineTemplateResource + VirtualMachineTemplateCollection collection = resourceGroupResource.GetVirtualMachineTemplates(); + + // invoke the operation + string virtualMachineTemplateName = "WebFrontEndTemplate"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineTemplateName); + VirtualMachineTemplateResource 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 + VirtualMachineTemplateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListVirtualMachineTemplatesByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualNetworkCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualNetworkCollection.cs index a493d7648d15..3305a16c50dc 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualNetworkCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/samples/Generated/Samples/Sample_VirtualNetworkCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_GetVirtualNetwork() Console.WriteLine($"Succeeded: {result}"); } + // GetVirtualNetwork + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetwork() + { + // Generated from example definition: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualNetwork.json + // this example is just showing the usage of "VirtualNetworks_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 = "fd3c3665-1729-4b7b-9a38-238e83b0f98b"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this VirtualNetworkResource + VirtualNetworkCollection collection = resourceGroupResource.GetVirtualNetworks(); + + // invoke the operation + string virtualNetworkName = "ProdNetwork"; + NullableResponse response = await collection.GetIfExistsAsync(virtualNetworkName); + VirtualNetworkResource 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 + VirtualNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ListVirtualNetworksByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentCollection.cs index 604610eff0fb..b0629a9563e8 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name} + /// + /// + /// Operation Id + /// GuestAgents_Get + /// + /// + /// + /// Name of the GuestAgent. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _guestAgentClientDiagnostics.CreateScope("GuestAgentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _guestAgentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestAgentResource(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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name} + /// + /// + /// Operation Id + /// GuestAgents_Get + /// + /// + /// + /// Name of the GuestAgent. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _guestAgentClientDiagnostics.CreateScope("GuestAgentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _guestAgentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestAgentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataCollection.cs index 946576aec880..96f2f7eab7bd 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string metadataName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName} + /// + /// + /// Operation Id + /// HybridIdentityMetadata_Get + /// + /// + /// + /// Name of the HybridIdentityMetadata. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string metadataName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(metadataName, nameof(metadataName)); + + using var scope = _hybridIdentityMetadataHybridIdentityMetadataClientDiagnostics.CreateScope("HybridIdentityMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hybridIdentityMetadataHybridIdentityMetadataRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, metadataName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridIdentityMetadataResource(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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName} + /// + /// + /// Operation Id + /// HybridIdentityMetadata_Get + /// + /// + /// + /// Name of the HybridIdentityMetadata. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string metadataName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(metadataName, nameof(metadataName)); + + using var scope = _hybridIdentityMetadataHybridIdentityMetadataClientDiagnostics.CreateScope("HybridIdentityMetadataCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hybridIdentityMetadataHybridIdentityMetadataRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, metadataName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HybridIdentityMetadataResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemCollection.cs index 454e83bebc98..421bf95546c6 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string inventoryItemName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}/inventoryItems/{inventoryItemName} + /// + /// + /// Operation Id + /// InventoryItems_Get + /// + /// + /// + /// Name of the inventoryItem. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string inventoryItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryItemName, nameof(inventoryItemName)); + + using var scope = _inventoryItemClientDiagnostics.CreateScope("InventoryItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _inventoryItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inventoryItemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InventoryItemResource(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.ConnectedVMwarevSphere/vcenters/{vcenterName}/inventoryItems/{inventoryItemName} + /// + /// + /// Operation Id + /// InventoryItems_Get + /// + /// + /// + /// Name of the inventoryItem. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string inventoryItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryItemName, nameof(inventoryItemName)); + + using var scope = _inventoryItemClientDiagnostics.CreateScope("InventoryItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _inventoryItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inventoryItemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InventoryItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionCollection.cs index 3f163c0e1cf9..6a19c24c831f 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string extensionName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName} + /// + /// + /// Operation Id + /// MachineExtensions_Get + /// + /// + /// + /// The name of the machine extension. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string extensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + + using var scope = _machineExtensionClientDiagnostics.CreateScope("MachineExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _machineExtensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineExtensionResource(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.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName} + /// + /// + /// Operation Id + /// MachineExtensions_Get + /// + /// + /// + /// The name of the machine extension. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string extensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName)); + + using var scope = _machineExtensionClientDiagnostics.CreateScope("MachineExtensionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _machineExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MachineExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolCollection.cs index 1c828c4af08e..4c0a65be9753 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourcePoolName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName} + /// + /// + /// Operation Id + /// ResourcePools_Get + /// + /// + /// + /// Name of the resourcePool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourcePoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourcePoolName, nameof(resourcePoolName)); + + using var scope = _resourcePoolClientDiagnostics.CreateScope("ResourcePoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resourcePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourcePoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourcePoolResource(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.ConnectedVMwarevSphere/resourcePools/{resourcePoolName} + /// + /// + /// Operation Id + /// ResourcePools_Get + /// + /// + /// + /// Name of the resourcePool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourcePoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourcePoolName, nameof(resourcePoolName)); + + using var scope = _resourcePoolClientDiagnostics.CreateScope("ResourcePoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resourcePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourcePoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResourcePoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterCollection.cs index b62cc7848a64..cc8520915541 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string vcenterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName} + /// + /// + /// Operation Id + /// VCenters_Get + /// + /// + /// + /// Name of the vCenter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string vcenterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vcenterName, nameof(vcenterName)); + + using var scope = _vCenterClientDiagnostics.CreateScope("VCenterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vCenterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vcenterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VCenterResource(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.ConnectedVMwarevSphere/vcenters/{vcenterName} + /// + /// + /// Operation Id + /// VCenters_Get + /// + /// + /// + /// Name of the vCenter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string vcenterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vcenterName, nameof(vcenterName)); + + using var scope = _vCenterClientDiagnostics.CreateScope("VCenterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vCenterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vcenterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VCenterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterCollection.cs index 233c53f3cce0..f863aa05ff4f 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _vMwareClusterClustersClientDiagnostics.CreateScope("VMwareClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vMwareClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VMwareClusterResource(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.ConnectedVMwarevSphere/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _vMwareClusterClustersClientDiagnostics.CreateScope("VMwareClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vMwareClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VMwareClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreCollection.cs index fa1cec8c9734..0e07cd4066e8 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string datastoreName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName} + /// + /// + /// Operation Id + /// Datastores_Get + /// + /// + /// + /// Name of the datastore. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string datastoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); + + using var scope = _vMwareDatastoreDatastoresClientDiagnostics.CreateScope("VMwareDatastoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vMwareDatastoreDatastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VMwareDatastoreResource(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.ConnectedVMwarevSphere/datastores/{datastoreName} + /// + /// + /// Operation Id + /// Datastores_Get + /// + /// + /// + /// Name of the datastore. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string datastoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); + + using var scope = _vMwareDatastoreDatastoresClientDiagnostics.CreateScope("VMwareDatastoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vMwareDatastoreDatastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, datastoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VMwareDatastoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostCollection.cs index 0186116c29a1..ed68c66b38a4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string hostName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/hosts/{hostName} + /// + /// + /// Operation Id + /// Hosts_Get + /// + /// + /// + /// Name of the host. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostName, nameof(hostName)); + + using var scope = _vMwareHostHostsClientDiagnostics.CreateScope("VMwareHostCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _vMwareHostHostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, hostName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VMwareHostResource(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.ConnectedVMwarevSphere/hosts/{hostName} + /// + /// + /// Operation Id + /// Hosts_Get + /// + /// + /// + /// Name of the host. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostName, nameof(hostName)); + + using var scope = _vMwareHostHostsClientDiagnostics.CreateScope("VMwareHostCollection.GetIfExists"); + scope.Start(); + try + { + var response = _vMwareHostHostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, hostName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VMwareHostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineCollection.cs index d01f896fb970..a073702b57bc 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualMachineName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Name of the virtual machine 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 virtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); + + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(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.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Name of the virtual machine resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); + + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateCollection.cs index 67ca65fef900..a51d3df130b4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualMachineTemplateName, Cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName} + /// + /// + /// Operation Id + /// VirtualMachineTemplates_Get + /// + /// + /// + /// Name of the virtual machine template 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 virtualMachineTemplateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineTemplateName, nameof(virtualMachineTemplateName)); + + using var scope = _virtualMachineTemplateClientDiagnostics.CreateScope("VirtualMachineTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachineTemplateRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineTemplateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineTemplateResource(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.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName} + /// + /// + /// Operation Id + /// VirtualMachineTemplates_Get + /// + /// + /// + /// Name of the virtual machine template resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualMachineTemplateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualMachineTemplateName, nameof(virtualMachineTemplateName)); + + using var scope = _virtualMachineTemplateClientDiagnostics.CreateScope("VirtualMachineTemplateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachineTemplateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineTemplateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineTemplateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkCollection.cs index 7cf5533335be..cf51a3fdc861 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualNetworkName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// Name of the virtual network 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 virtualNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var scope = _virtualNetworkClientDiagnostics.CreateScope("VirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkResource(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.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// Name of the virtual network resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var scope = _virtualNetworkClientDiagnostics.CreateScope("VirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/samples/Generated/Samples/Sample_ConsumptionBudgetCollection.cs b/sdk/consumption/Azure.ResourceManager.Consumption/samples/Generated/Samples/Sample_ConsumptionBudgetCollection.cs index 95895a72c716..e558787206a7 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/samples/Generated/Samples/Sample_ConsumptionBudgetCollection.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/samples/Generated/Samples/Sample_ConsumptionBudgetCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -109,5 +110,45 @@ public async Task Exists_Budget() Console.WriteLine($"Succeeded: {result}"); } + + // Budget + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_Budget() + { + // Generated from example definition: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/Budget.json + // this example is just showing the usage of "Budgets_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ConsumptionBudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + ConsumptionBudgetCollection collection = client.GetConsumptionBudgets(scopeId); + + // invoke the operation + string budgetName = "TestBudget"; + NullableResponse response = await collection.GetIfExistsAsync(budgetName); + ConsumptionBudgetResource 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 + ConsumptionBudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetCollection.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetCollection.cs index 6654fa441e03..915ee1f5c5fd 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetCollection.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string budgetName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// + /// Budget Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var scope = _consumptionBudgetBudgetsClientDiagnostics.CreateScope("ConsumptionBudgetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _consumptionBudgetBudgetsRestClient.GetAsync(Id, budgetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConsumptionBudgetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// + /// Budget Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var scope = _consumptionBudgetBudgetsClientDiagnostics.CreateScope("ConsumptionBudgetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _consumptionBudgetBudgetsRestClient.Get(Id, budgetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConsumptionBudgetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppAuthConfigCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppAuthConfigCollection.cs index b9382c10ee18..03026576ae03 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppAuthConfigCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppAuthConfigCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetContainerAppSAuthConfig() Console.WriteLine($"Succeeded: {result}"); } + // Get Container App's AuthConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerAppSAuthConfig() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_Get.json + // this example is just showing the usage of "ContainerAppsAuthConfigs_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 ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + string resourceGroupName = "workerapps-rg-xj"; + string containerAppName = "testcanadacentral"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this ContainerAppAuthConfigResource + ContainerAppAuthConfigCollection collection = containerApp.GetContainerAppAuthConfigs(); + + // invoke the operation + string authConfigName = "current"; + NullableResponse response = await collection.GetIfExistsAsync(authConfigName); + ContainerAppAuthConfigResource 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 + ContainerAppAuthConfigData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Container App AuthConfig [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppCollection.cs index 2682d0bbdc69..284e1cc332d6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetContainerApp() Console.WriteLine($"Succeeded: {result}"); } + // Get Container App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerApp() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Get.json + // this example is just showing the usage of "ContainerApps_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppResource + ContainerAppCollection collection = resourceGroupResource.GetContainerApps(); + + // invoke the operation + string containerAppName = "testcontainerApp0"; + NullableResponse response = await collection.GetIfExistsAsync(containerAppName); + ContainerAppResource 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 + ContainerAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Container App [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentCertificateCollection.cs index 886d675c8f58..cab66b120b35 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentCertificateCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetCertificate() Console.WriteLine($"Succeeded: {result}"); } + // Get Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCertificate() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificate_Get.json + // this example is just showing the usage of "ConnectedEnvironmentsCertificates_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 ContainerAppConnectedEnvironmentResource created on azure + // for more information of creating ContainerAppConnectedEnvironmentResource, please refer to the document of ContainerAppConnectedEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "examplerg"; + string connectedEnvironmentName = "testcontainerenv"; + ResourceIdentifier containerAppConnectedEnvironmentResourceId = ContainerAppConnectedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, connectedEnvironmentName); + ContainerAppConnectedEnvironmentResource containerAppConnectedEnvironment = client.GetContainerAppConnectedEnvironmentResource(containerAppConnectedEnvironmentResourceId); + + // get the collection of this ContainerAppConnectedEnvironmentCertificateResource + ContainerAppConnectedEnvironmentCertificateCollection collection = containerAppConnectedEnvironment.GetContainerAppConnectedEnvironmentCertificates(); + + // invoke the operation + string certificateName = "certificate-firendly-name"; + NullableResponse response = await collection.GetIfExistsAsync(certificateName); + ContainerAppConnectedEnvironmentCertificateResource 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 + ContainerAppCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Certificate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentCollection.cs index efafbe23c2f6..540813af632b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetConnectedEnvironmentByConnectedEnvironmentName() Console.WriteLine($"Succeeded: {result}"); } + // Get connected environment by connectedEnvironmentName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConnectedEnvironmentByConnectedEnvironmentName() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_Get.json + // this example is just showing the usage of "ConnectedEnvironments_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppConnectedEnvironmentResource + ContainerAppConnectedEnvironmentCollection collection = resourceGroupResource.GetContainerAppConnectedEnvironments(); + + // invoke the operation + string connectedEnvironmentName = "examplekenv"; + NullableResponse response = await collection.GetIfExistsAsync(connectedEnvironmentName); + ContainerAppConnectedEnvironmentResource 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 + ContainerAppConnectedEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create kube environments [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentDaprComponentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentDaprComponentCollection.cs index 9d6ee8a55d0e..510eafa4fdf0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentDaprComponentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentDaprComponentCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetDaprComponent() Console.WriteLine($"Succeeded: {result}"); } + // Get Dapr Component + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDaprComponent() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_Get.json + // this example is just showing the usage of "ConnectedEnvironmentsDaprComponents_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 ContainerAppConnectedEnvironmentResource created on azure + // for more information of creating ContainerAppConnectedEnvironmentResource, please refer to the document of ContainerAppConnectedEnvironmentResource + string subscriptionId = "8efdecc5-919e-44eb-b179-915dca89ebf9"; + string resourceGroupName = "examplerg"; + string connectedEnvironmentName = "myenvironment"; + ResourceIdentifier containerAppConnectedEnvironmentResourceId = ContainerAppConnectedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, connectedEnvironmentName); + ContainerAppConnectedEnvironmentResource containerAppConnectedEnvironment = client.GetContainerAppConnectedEnvironmentResource(containerAppConnectedEnvironmentResourceId); + + // get the collection of this ContainerAppConnectedEnvironmentDaprComponentResource + ContainerAppConnectedEnvironmentDaprComponentCollection collection = containerAppConnectedEnvironment.GetContainerAppConnectedEnvironmentDaprComponents(); + + // invoke the operation + string componentName = "reddog"; + NullableResponse response = await collection.GetIfExistsAsync(componentName); + ContainerAppConnectedEnvironmentDaprComponentResource 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 + ContainerAppDaprComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update dapr component [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentStorageCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentStorageCollection.cs index 3cf28a5db5d6..c2fd7bc1bdd1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentStorageCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppConnectedEnvironmentStorageCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAEnvironmentsStoragePropertiesBySubscription() Console.WriteLine($"Succeeded: {result}"); } + // get a environments storage properties by subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAEnvironmentsStoragePropertiesBySubscription() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_Get.json + // this example is just showing the usage of "ConnectedEnvironmentsStorages_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 ContainerAppConnectedEnvironmentResource created on azure + // for more information of creating ContainerAppConnectedEnvironmentResource, please refer to the document of ContainerAppConnectedEnvironmentResource + string subscriptionId = "8efdecc5-919e-44eb-b179-915dca89ebf9"; + string resourceGroupName = "examplerg"; + string connectedEnvironmentName = "env"; + ResourceIdentifier containerAppConnectedEnvironmentResourceId = ContainerAppConnectedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, connectedEnvironmentName); + ContainerAppConnectedEnvironmentResource containerAppConnectedEnvironment = client.GetContainerAppConnectedEnvironmentResource(containerAppConnectedEnvironmentResourceId); + + // get the collection of this ContainerAppConnectedEnvironmentStorageResource + ContainerAppConnectedEnvironmentStorageCollection collection = containerAppConnectedEnvironment.GetContainerAppConnectedEnvironmentStorages(); + + // invoke the operation + string storageName = "jlaw-demo1"; + NullableResponse response = await collection.GetIfExistsAsync(storageName); + ContainerAppConnectedEnvironmentStorageResource 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 + ContainerAppConnectedEnvironmentStorageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update environments storage [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppDetectorCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppDetectorCollection.cs index de09c39be0da..4bc1b7591b94 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppDetectorCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppDetectorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetContainerAppSDiagnosticsInfo() Console.WriteLine($"Succeeded: {result}"); } + + // Get Container App's diagnostics info + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerAppSDiagnosticsInfo() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerAppsDiagnostics_Get.json + // this example is just showing the usage of "ContainerAppsDiagnostics_GetDetector" 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 ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + string resourceGroupName = "mikono-workerapp-test-rg"; + string containerAppName = "mikono-capp-stage1"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this ContainerAppDetectorResource + ContainerAppDetectorCollection collection = containerApp.GetContainerAppDetectors(); + + // invoke the operation + string detectorName = "cappcontainerappnetworkIO"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + ContainerAppDetectorResource 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 + ContainerAppDiagnosticData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppDetectorPropertyRevisionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppDetectorPropertyRevisionCollection.cs index 75cdd2c94195..4997c30b482e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppDetectorPropertyRevisionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppDetectorPropertyRevisionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetContainerAppSRevision() Console.WriteLine($"Succeeded: {result}"); } + + // Get Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerAppSRevision() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Get.json + // this example is just showing the usage of "ContainerAppsDiagnostics_GetRevision" 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 ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this ContainerAppDetectorPropertyRevisionResource + ContainerAppDetectorPropertyRevisionCollection collection = containerApp.GetContainerAppDetectorPropertyRevisions(); + + // invoke the operation + string revisionName = "testcontainerApp0-pjxhsye"; + NullableResponse response = await collection.GetIfExistsAsync(revisionName); + ContainerAppDetectorPropertyRevisionResource 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 + ContainerAppRevisionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppJobCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppJobCollection.cs index 6dff7acf5942..5777c2d87863 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppJobCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppJobCollection.cs @@ -120,6 +120,48 @@ public async Task Exists_GetContainerAppsJob() Console.WriteLine($"Succeeded: {result}"); } + // Get Container Apps Job + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerAppsJob() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Get.json + // this example is just showing the usage of "Jobs_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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppJobResource + ContainerAppJobCollection collection = resourceGroupResource.GetContainerAppJobs(); + + // invoke the operation + string jobName = "testcontainerAppsJob0"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + ContainerAppJobResource 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 + ContainerAppJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Container Apps Job [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppJobExecutionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppJobExecutionCollection.cs index be9747748fbf..260d8c6408d3 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppJobExecutionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppJobExecutionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetASingleJobExecution() Console.WriteLine($"Succeeded: {result}"); } + + // Get a single Job Execution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASingleJobExecution() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Execution_Get.json + // this example is just showing the usage of "JobExecution" 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 ContainerAppJobResource created on azure + // for more information of creating ContainerAppJobResource, please refer to the document of ContainerAppJobResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string jobName = "testcontainerAppsJob0"; + ResourceIdentifier containerAppJobResourceId = ContainerAppJobResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, jobName); + ContainerAppJobResource containerAppJob = client.GetContainerAppJobResource(containerAppJobResourceId); + + // get the collection of this ContainerAppJobExecutionResource + ContainerAppJobExecutionCollection collection = containerAppJob.GetContainerAppJobExecutions(); + + // invoke the operation + string jobExecutionName = "jobExecution1"; + NullableResponse response = await collection.GetIfExistsAsync(jobExecutionName); + ContainerAppJobExecutionResource 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 + ContainerAppJobExecutionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedCertificateCollection.cs index 1adc45fda96a..5578fe020452 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedCertificateCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_GetCertificate() Console.WriteLine($"Succeeded: {result}"); } + // Get Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCertificate() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificate_Get.json + // this example is just showing the usage of "ManagedCertificates_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 ContainerAppManagedEnvironmentResource created on azure + // for more information of creating ContainerAppManagedEnvironmentResource, please refer to the document of ContainerAppManagedEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "examplerg"; + string environmentName = "testcontainerenv"; + ResourceIdentifier containerAppManagedEnvironmentResourceId = ContainerAppManagedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, environmentName); + ContainerAppManagedEnvironmentResource containerAppManagedEnvironment = client.GetContainerAppManagedEnvironmentResource(containerAppManagedEnvironmentResourceId); + + // get the collection of this ContainerAppManagedCertificateResource + ContainerAppManagedCertificateCollection collection = containerAppManagedEnvironment.GetContainerAppManagedCertificates(); + + // invoke the operation + string managedCertificateName = "certificate-firendly-name"; + NullableResponse response = await collection.GetIfExistsAsync(managedCertificateName); + ContainerAppManagedCertificateResource 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 + ContainerAppManagedCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Certificate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentCertificateCollection.cs index 89d20ae6b30a..38fedc226e77 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentCertificateCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetCertificate() Console.WriteLine($"Succeeded: {result}"); } + // Get Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetCertificate() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificate_Get.json + // this example is just showing the usage of "Certificates_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 ContainerAppManagedEnvironmentResource created on azure + // for more information of creating ContainerAppManagedEnvironmentResource, please refer to the document of ContainerAppManagedEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "examplerg"; + string environmentName = "testcontainerenv"; + ResourceIdentifier containerAppManagedEnvironmentResourceId = ContainerAppManagedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, environmentName); + ContainerAppManagedEnvironmentResource containerAppManagedEnvironment = client.GetContainerAppManagedEnvironmentResource(containerAppManagedEnvironmentResourceId); + + // get the collection of this ContainerAppManagedEnvironmentCertificateResource + ContainerAppManagedEnvironmentCertificateCollection collection = containerAppManagedEnvironment.GetContainerAppManagedEnvironmentCertificates(); + + // invoke the operation + string certificateName = "certificate-firendly-name"; + NullableResponse response = await collection.GetIfExistsAsync(certificateName); + ContainerAppManagedEnvironmentCertificateResource 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 + ContainerAppCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Certificate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentCollection.cs index 3016c6a594e7..dbc54443a6b9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_GetEnvironmentsByName() Console.WriteLine($"Succeeded: {result}"); } + // Get environments by name + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetEnvironmentsByName() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_Get.json + // this example is just showing the usage of "ManagedEnvironments_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 = "8efdecc5-919e-44eb-b179-915dca89ebf9"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppManagedEnvironmentResource + ContainerAppManagedEnvironmentCollection collection = resourceGroupResource.GetContainerAppManagedEnvironments(); + + // invoke the operation + string environmentName = "jlaw-demo1"; + NullableResponse response = await collection.GetIfExistsAsync(environmentName); + ContainerAppManagedEnvironmentResource 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 + ContainerAppManagedEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create environment with custom infrastructureResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentDaprComponentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentDaprComponentCollection.cs index 0ab0e5f02854..425351032b0b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentDaprComponentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentDaprComponentCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetDaprComponentWithSecretStoreComponent() Console.WriteLine($"Succeeded: {result}"); } + // Get Dapr Component with secret store component + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDaprComponentWithSecretStoreComponent() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_Get_SecretStoreComponent.json + // this example is just showing the usage of "DaprComponents_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 ContainerAppManagedEnvironmentResource created on azure + // for more information of creating ContainerAppManagedEnvironmentResource, please refer to the document of ContainerAppManagedEnvironmentResource + string subscriptionId = "8efdecc5-919e-44eb-b179-915dca89ebf9"; + string resourceGroupName = "examplerg"; + string environmentName = "myenvironment"; + ResourceIdentifier containerAppManagedEnvironmentResourceId = ContainerAppManagedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, environmentName); + ContainerAppManagedEnvironmentResource containerAppManagedEnvironment = client.GetContainerAppManagedEnvironmentResource(containerAppManagedEnvironmentResourceId); + + // get the collection of this ContainerAppManagedEnvironmentDaprComponentResource + ContainerAppManagedEnvironmentDaprComponentCollection collection = containerAppManagedEnvironment.GetContainerAppManagedEnvironmentDaprComponents(); + + // invoke the operation + string componentName = "reddog"; + NullableResponse response = await collection.GetIfExistsAsync(componentName); + ContainerAppManagedEnvironmentDaprComponentResource 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 + ContainerAppDaprComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Dapr Component with secrets [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -187,6 +230,49 @@ public async Task Exists_GetDaprComponentWithSecrets() Console.WriteLine($"Succeeded: {result}"); } + // Get Dapr Component with secrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDaprComponentWithSecrets() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_Get_Secrets.json + // this example is just showing the usage of "DaprComponents_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 ContainerAppManagedEnvironmentResource created on azure + // for more information of creating ContainerAppManagedEnvironmentResource, please refer to the document of ContainerAppManagedEnvironmentResource + string subscriptionId = "8efdecc5-919e-44eb-b179-915dca89ebf9"; + string resourceGroupName = "examplerg"; + string environmentName = "myenvironment"; + ResourceIdentifier containerAppManagedEnvironmentResourceId = ContainerAppManagedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, environmentName); + ContainerAppManagedEnvironmentResource containerAppManagedEnvironment = client.GetContainerAppManagedEnvironmentResource(containerAppManagedEnvironmentResourceId); + + // get the collection of this ContainerAppManagedEnvironmentDaprComponentResource + ContainerAppManagedEnvironmentDaprComponentCollection collection = containerAppManagedEnvironment.GetContainerAppManagedEnvironmentDaprComponents(); + + // invoke the operation + string componentName = "reddog"; + NullableResponse response = await collection.GetIfExistsAsync(componentName); + ContainerAppManagedEnvironmentDaprComponentResource 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 + ContainerAppDaprComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update dapr component with secret store component [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentDetectorCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentDetectorCollection.cs index c73bb72a7ca1..fab30ec50664 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentDetectorCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentDetectorCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetDiagnosticDataForAManagedEnvironments() Console.WriteLine($"Succeeded: {result}"); } + + // Get diagnostic data for a managed environments + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDiagnosticDataForAManagedEnvironments() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentDiagnostics_Get.json + // this example is just showing the usage of "ManagedEnvironmentDiagnostics_GetDetector" 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 ContainerAppManagedEnvironmentResource created on azure + // for more information of creating ContainerAppManagedEnvironmentResource, please refer to the document of ContainerAppManagedEnvironmentResource + string subscriptionId = "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + string resourceGroupName = "mikono-workerapp-test-rg"; + string environmentName = "mikonokubeenv"; + ResourceIdentifier containerAppManagedEnvironmentResourceId = ContainerAppManagedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, environmentName); + ContainerAppManagedEnvironmentResource containerAppManagedEnvironment = client.GetContainerAppManagedEnvironmentResource(containerAppManagedEnvironmentResourceId); + + // get the collection of this ContainerAppManagedEnvironmentDetectorResource + ContainerAppManagedEnvironmentDetectorCollection collection = containerAppManagedEnvironment.GetContainerAppManagedEnvironmentDetectors(); + + // invoke the operation + string detectorName = "ManagedEnvAvailabilityMetrics"; + NullableResponse response = await collection.GetIfExistsAsync(detectorName); + ContainerAppManagedEnvironmentDetectorResource 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 + ContainerAppDiagnosticData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentStorageCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentStorageCollection.cs index 870e91a0245e..036cd86a7d4f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentStorageCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppManagedEnvironmentStorageCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetAEnvironmentsStoragePropertiesBySubscription() Console.WriteLine($"Succeeded: {result}"); } + // get a environments storage properties by subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAEnvironmentsStoragePropertiesBySubscription() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_Get.json + // this example is just showing the usage of "ManagedEnvironmentsStorages_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 ContainerAppManagedEnvironmentResource created on azure + // for more information of creating ContainerAppManagedEnvironmentResource, please refer to the document of ContainerAppManagedEnvironmentResource + string subscriptionId = "8efdecc5-919e-44eb-b179-915dca89ebf9"; + string resourceGroupName = "examplerg"; + string environmentName = "managedEnv"; + ResourceIdentifier containerAppManagedEnvironmentResourceId = ContainerAppManagedEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, environmentName); + ContainerAppManagedEnvironmentResource containerAppManagedEnvironment = client.GetContainerAppManagedEnvironmentResource(containerAppManagedEnvironmentResourceId); + + // get the collection of this ContainerAppManagedEnvironmentStorageResource + ContainerAppManagedEnvironmentStorageCollection collection = containerAppManagedEnvironment.GetContainerAppManagedEnvironmentStorages(); + + // invoke the operation + string storageName = "jlaw-demo1"; + NullableResponse response = await collection.GetIfExistsAsync(storageName); + ContainerAppManagedEnvironmentStorageResource 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 + ContainerAppManagedEnvironmentStorageData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or update environments storage [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppReplicaCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppReplicaCollection.cs index c7738b8846da..5afd374132f1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppReplicaCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppReplicaCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -84,6 +85,50 @@ public async Task Exists_GetContainerAppSRevisionReplica() Console.WriteLine($"Succeeded: {result}"); } + // Get Container App's revision replica + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerAppSRevisionReplica() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Replicas_Get.json + // this example is just showing the usage of "ContainerAppsRevisionReplicas_GetReplica" 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 ContainerAppRevisionResource created on azure + // for more information of creating ContainerAppRevisionResource, please refer to the document of ContainerAppRevisionResource + string subscriptionId = "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + string resourceGroupName = "workerapps-rg-xj"; + string containerAppName = "myapp"; + string revisionName = "myapp--0wlqy09"; + ResourceIdentifier containerAppRevisionResourceId = ContainerAppRevisionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName, revisionName); + ContainerAppRevisionResource containerAppRevision = client.GetContainerAppRevisionResource(containerAppRevisionResourceId); + + // get the collection of this ContainerAppReplicaResource + ContainerAppReplicaCollection collection = containerAppRevision.GetContainerAppReplicas(); + + // invoke the operation + string replicaName = "myapp--0wlqy09-5d9774cff-5wnd8"; + NullableResponse response = await collection.GetIfExistsAsync(replicaName); + ContainerAppReplicaResource 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 + ContainerAppReplicaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List Container App's replicas [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppRevisionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppRevisionCollection.cs index bef303bada46..6382cdd92712 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppRevisionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppRevisionCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetContainerAppSRevision() Console.WriteLine($"Succeeded: {result}"); } + + // Get Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerAppSRevision() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Get.json + // this example is just showing the usage of "ContainerAppsRevisions_GetRevision" 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 ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this ContainerAppRevisionResource + ContainerAppRevisionCollection collection = containerApp.GetContainerAppRevisions(); + + // invoke the operation + string revisionName = "testcontainerApp0-pjxhsye"; + NullableResponse response = await collection.GetIfExistsAsync(revisionName); + ContainerAppRevisionResource 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 + ContainerAppRevisionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppSourceControlCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppSourceControlCollection.cs index 9a245e062d16..2ccc38bd3f56 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppSourceControlCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/samples/Generated/Samples/Sample_ContainerAppSourceControlCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetContainerAppSSourceControl() Console.WriteLine($"Succeeded: {result}"); } + // Get Container App's SourceControl + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerAppSSourceControl() + { + // Generated from example definition: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_Get.json + // this example is just showing the usage of "ContainerAppsSourceControls_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 ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + string resourceGroupName = "workerapps-rg-xj"; + string containerAppName = "testcanadacentral"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this ContainerAppSourceControlResource + ContainerAppSourceControlCollection collection = containerApp.GetContainerAppSourceControls(); + + // invoke the operation + string sourceControlName = "current"; + NullableResponse response = await collection.GetIfExistsAsync(sourceControlName); + ContainerAppSourceControlResource 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 + ContainerAppSourceControlData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Container App SourceControl [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigCollection.cs index 5f7b61113226..3d169dc3c76b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authConfigName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName} + /// + /// + /// Operation Id + /// ContainerAppsAuthConfigs_Get + /// + /// + /// + /// Name of the Container App AuthConfig. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authConfigName, nameof(authConfigName)); + + using var scope = _containerAppAuthConfigContainerAppsAuthConfigsClientDiagnostics.CreateScope("ContainerAppAuthConfigCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppAuthConfigContainerAppsAuthConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authConfigName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppAuthConfigResource(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.App/containerApps/{containerAppName}/authConfigs/{authConfigName} + /// + /// + /// Operation Id + /// ContainerAppsAuthConfigs_Get + /// + /// + /// + /// Name of the Container App AuthConfig. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authConfigName, nameof(authConfigName)); + + using var scope = _containerAppAuthConfigContainerAppsAuthConfigsClientDiagnostics.CreateScope("ContainerAppAuthConfigCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppAuthConfigContainerAppsAuthConfigsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authConfigName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppAuthConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCollection.cs index c208350140ff..609dc83a1ee8 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string containerAppName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string containerAppName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerAppName, nameof(containerAppName)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, containerAppName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppResource(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.App/containerApps/{containerAppName} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string containerAppName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerAppName, nameof(containerAppName)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, containerAppName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateCollection.cs index 0a314916b288..4eddb686efca 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// ConnectedEnvironmentsCertificates_Get + /// + /// + /// + /// Name of the Certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesClientDiagnostics.CreateScope("ContainerAppConnectedEnvironmentCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppConnectedEnvironmentCertificateResource(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.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// ConnectedEnvironmentsCertificates_Get + /// + /// + /// + /// Name of the Certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesClientDiagnostics.CreateScope("ContainerAppConnectedEnvironmentCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppConnectedEnvironmentCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCollection.cs index 6541be59ccf6..f4c9c11e978b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string connectedEnvironmentName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName} + /// + /// + /// Operation Id + /// ConnectedEnvironments_Get + /// + /// + /// + /// Name of the connectedEnvironment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectedEnvironmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectedEnvironmentName, nameof(connectedEnvironmentName)); + + using var scope = _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics.CreateScope("ContainerAppConnectedEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, connectedEnvironmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppConnectedEnvironmentResource(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.App/connectedEnvironments/{connectedEnvironmentName} + /// + /// + /// Operation Id + /// ConnectedEnvironments_Get + /// + /// + /// + /// Name of the connectedEnvironment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectedEnvironmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectedEnvironmentName, nameof(connectedEnvironmentName)); + + using var scope = _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics.CreateScope("ContainerAppConnectedEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, connectedEnvironmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppConnectedEnvironmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentCollection.cs index bc0a20a3e25f..55c29c3ac3ce 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string componentName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName} + /// + /// + /// Operation Id + /// ConnectedEnvironmentsDaprComponents_Get + /// + /// + /// + /// Name of the Dapr Component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsClientDiagnostics.CreateScope("ContainerAppConnectedEnvironmentDaprComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppConnectedEnvironmentDaprComponentResource(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.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName} + /// + /// + /// Operation Id + /// ConnectedEnvironmentsDaprComponents_Get + /// + /// + /// + /// Name of the Dapr Component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsClientDiagnostics.CreateScope("ContainerAppConnectedEnvironmentDaprComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppConnectedEnvironmentDaprComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageCollection.cs index 7bad16892817..29778435e7fe 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string storageName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName} + /// + /// + /// Operation Id + /// ConnectedEnvironmentsStorages_Get + /// + /// + /// + /// Name of the storage. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageName, nameof(storageName)); + + using var scope = _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesClientDiagnostics.CreateScope("ContainerAppConnectedEnvironmentStorageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppConnectedEnvironmentStorageResource(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.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName} + /// + /// + /// Operation Id + /// ConnectedEnvironmentsStorages_Get + /// + /// + /// + /// Name of the storage. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageName, nameof(storageName)); + + using var scope = _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesClientDiagnostics.CreateScope("ContainerAppConnectedEnvironmentStorageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppConnectedEnvironmentStorageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorCollection.cs index 885aed111a13..5cbad728f533 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string detectorName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName} + /// + /// + /// Operation Id + /// ContainerAppsDiagnostics_GetDetector + /// + /// + /// + /// Name of the Container App Detector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _containerAppDetectorContainerAppsDiagnosticsClientDiagnostics.CreateScope("ContainerAppDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppDetectorContainerAppsDiagnosticsRestClient.GetDetectorAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppDetectorResource(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.App/containerApps/{containerAppName}/detectors/{detectorName} + /// + /// + /// Operation Id + /// ContainerAppsDiagnostics_GetDetector + /// + /// + /// + /// Name of the Container App Detector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _containerAppDetectorContainerAppsDiagnosticsClientDiagnostics.CreateScope("ContainerAppDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppDetectorContainerAppsDiagnosticsRestClient.GetDetector(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionCollection.cs index 1d280002260d..26ac22f8565a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string revisionName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName} + /// + /// + /// Operation Id + /// ContainerAppsDiagnostics_GetRevision + /// + /// + /// + /// Name of the Container App Revision. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string revisionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(revisionName, nameof(revisionName)); + + using var scope = _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsClientDiagnostics.CreateScope("ContainerAppDetectorPropertyRevisionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsRestClient.GetRevisionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, revisionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppDetectorPropertyRevisionResource(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.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName} + /// + /// + /// Operation Id + /// ContainerAppsDiagnostics_GetRevision + /// + /// + /// + /// Name of the Container App Revision. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string revisionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(revisionName, nameof(revisionName)); + + using var scope = _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsClientDiagnostics.CreateScope("ContainerAppDetectorPropertyRevisionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsRestClient.GetRevision(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, revisionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppDetectorPropertyRevisionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobCollection.cs index 854523d5f69e..da203a6fb6f3 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string jobName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// Job Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _containerAppJobJobsClientDiagnostics.CreateScope("ContainerAppJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppJobJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, jobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppJobResource(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.App/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// Job Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _containerAppJobJobsClientDiagnostics.CreateScope("ContainerAppJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppJobJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, jobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionCollection.cs index fc8654dc85cb..8340607dbf91 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionCollection.cs @@ -248,6 +248,80 @@ public virtual Response Exists(string jobExecutionName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName} + /// + /// + /// Operation Id + /// JobExecution + /// + /// + /// + /// Job execution name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobExecutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobExecutionName, nameof(jobExecutionName)); + + using var scope = _containerAppJobExecutionClientDiagnostics.CreateScope("ContainerAppJobExecutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppJobExecutionRestClient.JobExecutionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppJobExecutionResource(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.App/jobs/{jobName}/executions/{jobExecutionName} + /// + /// + /// Operation Id + /// JobExecution + /// + /// + /// + /// Job execution name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobExecutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobExecutionName, nameof(jobExecutionName)); + + using var scope = _containerAppJobExecutionClientDiagnostics.CreateScope("ContainerAppJobExecutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppJobExecutionRestClient.JobExecution(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobExecutionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppJobExecutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateCollection.cs index bbbcae3ff0cd..e6c0e25ef073 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string managedCertificateName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName} + /// + /// + /// Operation Id + /// ManagedCertificates_Get + /// + /// + /// + /// Name of the Managed Certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedCertificateName, nameof(managedCertificateName)); + + using var scope = _containerAppManagedCertificateManagedCertificatesClientDiagnostics.CreateScope("ContainerAppManagedCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppManagedCertificateManagedCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedCertificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedCertificateResource(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.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName} + /// + /// + /// Operation Id + /// ManagedCertificates_Get + /// + /// + /// + /// Name of the Managed Certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedCertificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedCertificateName, nameof(managedCertificateName)); + + using var scope = _containerAppManagedCertificateManagedCertificatesClientDiagnostics.CreateScope("ContainerAppManagedCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppManagedCertificateManagedCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedCertificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateCollection.cs index 0d616e7927ee..db74325ff64e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string certificateName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// Name of the Certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _containerAppManagedEnvironmentCertificateCertificatesClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppManagedEnvironmentCertificateCertificatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentCertificateResource(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.App/managedEnvironments/{environmentName}/certificates/{certificateName} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// Name of the Certificate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string certificateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); + + using var scope = _containerAppManagedEnvironmentCertificateCertificatesClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentCertificateCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppManagedEnvironmentCertificateCertificatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentCertificateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCollection.cs index 51e77ed38be9..415c4c507776 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string environmentName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName} + /// + /// + /// Operation Id + /// ManagedEnvironments_Get + /// + /// + /// + /// Name of the Environment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string environmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); + + using var scope = _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppManagedEnvironmentManagedEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, environmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentResource(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.App/managedEnvironments/{environmentName} + /// + /// + /// Operation Id + /// ManagedEnvironments_Get + /// + /// + /// + /// Name of the Environment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string environmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); + + using var scope = _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppManagedEnvironmentManagedEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, environmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentCollection.cs index 09887cc336f8..5c49f1e4caf6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string componentName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName} + /// + /// + /// Operation Id + /// DaprComponents_Get + /// + /// + /// + /// Name of the Dapr Component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _containerAppManagedEnvironmentDaprComponentDaprComponentsClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentDaprComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppManagedEnvironmentDaprComponentDaprComponentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentDaprComponentResource(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.App/managedEnvironments/{environmentName}/daprComponents/{componentName} + /// + /// + /// Operation Id + /// DaprComponents_Get + /// + /// + /// + /// Name of the Dapr Component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _containerAppManagedEnvironmentDaprComponentDaprComponentsClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentDaprComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppManagedEnvironmentDaprComponentDaprComponentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentDaprComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorCollection.cs index a1bc5cd345ae..e216a2b919e6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string detectorName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName} + /// + /// + /// Operation Id + /// ManagedEnvironmentDiagnostics_GetDetector + /// + /// + /// + /// Name of the Managed Environment detector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string detectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsRestClient.GetDetectorAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentDetectorResource(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.App/managedEnvironments/{environmentName}/detectors/{detectorName} + /// + /// + /// Operation Id + /// ManagedEnvironmentDiagnostics_GetDetector + /// + /// + /// + /// Name of the Managed Environment detector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string detectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(detectorName, nameof(detectorName)); + + using var scope = _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentDetectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsRestClient.GetDetector(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, detectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentDetectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageCollection.cs index 73e80e002973..525598215887 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string storageName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName} + /// + /// + /// Operation Id + /// ManagedEnvironmentsStorages_Get + /// + /// + /// + /// Name of the storage. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageName, nameof(storageName)); + + using var scope = _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentStorageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentStorageResource(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.App/managedEnvironments/{environmentName}/storages/{storageName} + /// + /// + /// Operation Id + /// ManagedEnvironmentsStorages_Get + /// + /// + /// + /// Name of the storage. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageName, nameof(storageName)); + + using var scope = _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesClientDiagnostics.CreateScope("ContainerAppManagedEnvironmentStorageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppManagedEnvironmentStorageResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaCollection.cs index 3fec0954cccb..8b571f55c1de 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string replicaName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName} + /// + /// + /// Operation Id + /// ContainerAppsRevisionReplicas_GetReplica + /// + /// + /// + /// Name of the Container App Revision Replica. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string replicaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicaName, nameof(replicaName)); + + using var scope = _containerAppReplicaContainerAppsRevisionReplicasClientDiagnostics.CreateScope("ContainerAppReplicaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppReplicaContainerAppsRevisionReplicasRestClient.GetReplicaAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppReplicaResource(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.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName} + /// + /// + /// Operation Id + /// ContainerAppsRevisionReplicas_GetReplica + /// + /// + /// + /// Name of the Container App Revision Replica. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string replicaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicaName, nameof(replicaName)); + + using var scope = _containerAppReplicaContainerAppsRevisionReplicasClientDiagnostics.CreateScope("ContainerAppReplicaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppReplicaContainerAppsRevisionReplicasRestClient.GetReplica(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, replicaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppReplicaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionCollection.cs index 8607ee3e46ec..c77acc05f30e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionCollection.cs @@ -243,6 +243,80 @@ public virtual Response Exists(string revisionName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName} + /// + /// + /// Operation Id + /// ContainerAppsRevisions_GetRevision + /// + /// + /// + /// Name of the Container App Revision. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string revisionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(revisionName, nameof(revisionName)); + + using var scope = _containerAppRevisionContainerAppsRevisionsClientDiagnostics.CreateScope("ContainerAppRevisionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppRevisionContainerAppsRevisionsRestClient.GetRevisionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, revisionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppRevisionResource(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.App/containerApps/{containerAppName}/revisions/{revisionName} + /// + /// + /// Operation Id + /// ContainerAppsRevisions_GetRevision + /// + /// + /// + /// Name of the Container App Revision. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string revisionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(revisionName, nameof(revisionName)); + + using var scope = _containerAppRevisionContainerAppsRevisionsClientDiagnostics.CreateScope("ContainerAppRevisionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppRevisionContainerAppsRevisionsRestClient.GetRevision(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, revisionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppRevisionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlCollection.cs index 079292385cda..ce41905d58cd 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string sourceControlName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName} + /// + /// + /// Operation Id + /// ContainerAppsSourceControls_Get + /// + /// + /// + /// Name of the Container App SourceControl. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sourceControlName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceControlName, nameof(sourceControlName)); + + using var scope = _containerAppSourceControlContainerAppsSourceControlsClientDiagnostics.CreateScope("ContainerAppSourceControlCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppSourceControlContainerAppsSourceControlsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceControlName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppSourceControlResource(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.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName} + /// + /// + /// Operation Id + /// ContainerAppsSourceControls_Get + /// + /// + /// + /// Name of the Container App SourceControl. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sourceControlName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sourceControlName, nameof(sourceControlName)); + + using var scope = _containerAppSourceControlContainerAppsSourceControlsClientDiagnostics.CreateScope("ContainerAppSourceControlCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppSourceControlContainerAppsSourceControlsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sourceControlName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppSourceControlResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/samples/Generated/Samples/Sample_ContainerGroupCollection.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/samples/Generated/Samples/Sample_ContainerGroupCollection.cs index 8e8bb8845633..34bfb7c1574c 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/samples/Generated/Samples/Sample_ContainerGroupCollection.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/samples/Generated/Samples/Sample_ContainerGroupCollection.cs @@ -121,6 +121,48 @@ public async Task Exists_ContainerGroupsGetWithPriority() Console.WriteLine($"Succeeded: {result}"); } + // ContainerGroupsGetWithPriority + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ContainerGroupsGetWithPriority() + { + // Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGetPriority.json + // this example is just showing the usage of "ContainerGroups_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 = "subid"; + string resourceGroupName = "demo"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerGroupResource + ContainerGroupCollection collection = resourceGroupResource.GetContainerGroups(); + + // invoke the operation + string containerGroupName = "demo1"; + NullableResponse response = await collection.GetIfExistsAsync(containerGroupName); + ContainerGroupResource 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 + ContainerGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ContainerGroupsGet_Failed [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -185,6 +227,48 @@ public async Task Exists_ContainerGroupsGetFailed() Console.WriteLine($"Succeeded: {result}"); } + // ContainerGroupsGet_Failed + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ContainerGroupsGetFailed() + { + // Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGet_Failed.json + // this example is just showing the usage of "ContainerGroups_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 = "subid"; + string resourceGroupName = "demo"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerGroupResource + ContainerGroupCollection collection = resourceGroupResource.GetContainerGroups(); + + // invoke the operation + string containerGroupName = "demo1"; + NullableResponse response = await collection.GetIfExistsAsync(containerGroupName); + ContainerGroupResource 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 + ContainerGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ContainerGroupsGet_Succeeded [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -249,6 +333,48 @@ public async Task Exists_ContainerGroupsGetSucceeded() Console.WriteLine($"Succeeded: {result}"); } + // ContainerGroupsGet_Succeeded + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ContainerGroupsGetSucceeded() + { + // Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGet_Succeeded.json + // this example is just showing the usage of "ContainerGroups_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 = "subid"; + string resourceGroupName = "demo"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerGroupResource + ContainerGroupCollection collection = resourceGroupResource.GetContainerGroups(); + + // invoke the operation + string containerGroupName = "demo1"; + NullableResponse response = await collection.GetIfExistsAsync(containerGroupName); + ContainerGroupResource 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 + ContainerGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConfidentialContainerGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupCollection.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupCollection.cs index b5139c08041f..e88877b665e2 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupCollection.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string containerGroupName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName} + /// + /// + /// Operation Id + /// ContainerGroups_Get + /// + /// + /// + /// The name of the container group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string containerGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerGroupName, nameof(containerGroupName)); + + using var scope = _containerGroupClientDiagnostics.CreateScope("ContainerGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, containerGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerGroupResource(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.ContainerInstance/containerGroups/{containerGroupName} + /// + /// + /// Operation Id + /// ContainerGroups_Get + /// + /// + /// + /// The name of the container group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string containerGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerGroupName, nameof(containerGroupName)); + + using var scope = _containerGroupClientDiagnostics.CreateScope("ContainerGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, containerGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryAgentPoolCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryAgentPoolCollection.cs index 3ad1f36c67f7..f0d108029573 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryAgentPoolCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryAgentPoolCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_AgentPoolsGet() Console.WriteLine($"Succeeded: {result}"); } + // AgentPools_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AgentPoolsGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGet.json + // this example is just showing the usage of "AgentPools_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryAgentPoolResource + ContainerRegistryAgentPoolCollection collection = containerRegistry.GetContainerRegistryAgentPools(); + + // invoke the operation + string agentPoolName = "myAgentPool"; + NullableResponse response = await collection.GetIfExistsAsync(agentPoolName); + ContainerRegistryAgentPoolResource 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 + ContainerRegistryAgentPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AgentPools_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryCollection.cs index bdb570bf9f9d..4fbb9ec2eca3 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_RegistryGet() Console.WriteLine($"Succeeded: {result}"); } + // RegistryGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RegistryGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2022-12-01/examples/RegistryGet.json + // this example is just showing the usage of "Registries_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerRegistryResource + ContainerRegistryCollection collection = resourceGroupResource.GetContainerRegistries(); + + // invoke the operation + string registryName = "myRegistry"; + NullableResponse response = await collection.GetIfExistsAsync(registryName); + ContainerRegistryResource 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 + ContainerRegistryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RegistryCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryPrivateEndpointConnectionCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryPrivateEndpointConnectionCollection.cs index 0c6307160f69..c4e8841a74f8 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryPrivateEndpointConnectionCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_PrivateEndpointConnectionGet() Console.WriteLine($"Succeeded: {result}"); } + // PrivateEndpointConnectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateEndpointConnectionGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2022-12-01/examples/PrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryPrivateEndpointConnectionResource + ContainerRegistryPrivateEndpointConnectionCollection collection = containerRegistry.GetContainerRegistryPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + ContainerRegistryPrivateEndpointConnectionResource 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 + ContainerRegistryPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PrivateEndpointConnectionCreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryPrivateLinkResourceCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryPrivateLinkResourceCollection.cs index 2ce7cb566d0c..fafefb656ab1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryPrivateLinkResourceCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_RegistryGetPrivateLinkResource() Console.WriteLine($"Succeeded: {result}"); } + + // RegistryGetPrivateLinkResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RegistryGetPrivateLinkResource() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2022-12-01/examples/RegistryGetPrivateLinkResource.json + // this example is just showing the usage of "Registries_GetPrivateLinkResource" 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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryPrivateLinkResource + ContainerRegistryPrivateLinkResourceCollection collection = containerRegistry.GetContainerRegistryPrivateLinkResources(); + + // invoke the operation + string groupName = "registry"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + ContainerRegistryPrivateLinkResource 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 + ContainerRegistryPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryReplicationCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryReplicationCollection.cs index 906e4a534283..563851292ee5 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryReplicationCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryReplicationCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ReplicationGet() Console.WriteLine($"Succeeded: {result}"); } + // ReplicationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ReplicationGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2022-12-01/examples/ReplicationGet.json + // this example is just showing the usage of "Replications_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryReplicationResource + ContainerRegistryReplicationCollection collection = containerRegistry.GetContainerRegistryReplications(); + + // invoke the operation + string replicationName = "myReplication"; + NullableResponse response = await collection.GetIfExistsAsync(replicationName); + ContainerRegistryReplicationResource 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 + ContainerRegistryReplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ReplicationCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryRunCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryRunCollection.cs index a4f397d9cc66..00a715e4d52f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryRunCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryRunCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -120,5 +121,48 @@ public async Task Exists_RunsGet() Console.WriteLine($"Succeeded: {result}"); } + + // Runs_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RunsGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsGet.json + // this example is just showing the usage of "Runs_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryRunResource + ContainerRegistryRunCollection collection = containerRegistry.GetContainerRegistryRuns(); + + // invoke the operation + string runId = "0accec26-d6de-4757-8e74-d080f38eaaab"; + NullableResponse response = await collection.GetIfExistsAsync(runId); + ContainerRegistryRunResource 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 + ContainerRegistryRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTaskCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTaskCollection.cs index 95e21df77e49..eaa2cfa8e21b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTaskCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTaskCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_TasksGet() Console.WriteLine($"Succeeded: {result}"); } + // Tasks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TasksGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGet.json + // this example is just showing the usage of "Tasks_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryTaskResource + ContainerRegistryTaskCollection collection = containerRegistry.GetContainerRegistryTasks(); + + // invoke the operation + string taskName = "myTask"; + NullableResponse response = await collection.GetIfExistsAsync(taskName); + ContainerRegistryTaskResource 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 + ContainerRegistryTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Tasks_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTaskRunCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTaskRunCollection.cs index b1a6ea2018b2..b505b936047c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTaskRunCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTaskRunCollection.cs @@ -84,6 +84,49 @@ public async Task Exists_TaskRunsGet() Console.WriteLine($"Succeeded: {result}"); } + // TaskRuns_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TaskRunsGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGet.json + // this example is just showing the usage of "TaskRuns_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryTaskRunResource + ContainerRegistryTaskRunCollection collection = containerRegistry.GetContainerRegistryTaskRuns(); + + // invoke the operation + string taskRunName = "myRun"; + NullableResponse response = await collection.GetIfExistsAsync(taskRunName); + ContainerRegistryTaskRunResource 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 + ContainerRegistryTaskRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TaskRuns_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTokenCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTokenCollection.cs index 455349eb2306..8015c8401ce0 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTokenCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryTokenCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_TokenGet() Console.WriteLine($"Succeeded: {result}"); } + // TokenGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TokenGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2022-12-01/examples/TokenGet.json + // this example is just showing the usage of "Tokens_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryTokenResource + ContainerRegistryTokenCollection collection = containerRegistry.GetContainerRegistryTokens(); + + // invoke the operation + string tokenName = "myToken"; + NullableResponse response = await collection.GetIfExistsAsync(tokenName); + ContainerRegistryTokenResource 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 + ContainerRegistryTokenData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TokenCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryWebhookCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryWebhookCollection.cs index 43bbc244d19b..f7260fe5f12b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryWebhookCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ContainerRegistryWebhookCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_WebhookGet() Console.WriteLine($"Succeeded: {result}"); } + // WebhookGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WebhookGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2022-12-01/examples/WebhookGet.json + // this example is just showing the usage of "Webhooks_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ContainerRegistryWebhookResource + ContainerRegistryWebhookCollection collection = containerRegistry.GetContainerRegistryWebhooks(); + + // invoke the operation + string webhookName = "myWebhook"; + NullableResponse response = await collection.GetIfExistsAsync(webhookName); + ContainerRegistryWebhookResource 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 + ContainerRegistryWebhookData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // WebhookCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ScopeMapCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ScopeMapCollection.cs index 647f9e0e7e65..b3cdac8c5d84 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ScopeMapCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/samples/Generated/Samples/Sample_ScopeMapCollection.cs @@ -120,6 +120,49 @@ public async Task Exists_ScopeMapGet() Console.WriteLine($"Succeeded: {result}"); } + // ScopeMapGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ScopeMapGet() + { + // Generated from example definition: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2022-12-01/examples/ScopeMapGet.json + // this example is just showing the usage of "ScopeMaps_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 ContainerRegistryResource created on azure + // for more information of creating ContainerRegistryResource, please refer to the document of ContainerRegistryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string registryName = "myRegistry"; + ResourceIdentifier containerRegistryResourceId = ContainerRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName); + ContainerRegistryResource containerRegistry = client.GetContainerRegistryResource(containerRegistryResourceId); + + // get the collection of this ScopeMapResource + ScopeMapCollection collection = containerRegistry.GetScopeMaps(); + + // invoke the operation + string scopeMapName = "myScopeMap"; + NullableResponse response = await collection.GetIfExistsAsync(scopeMapName); + ScopeMapResource 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 + ScopeMapData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ScopeMapCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolCollection.cs index 165345a49522..72389a7d81da 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string agentPoolName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// AgentPools_Get + /// + /// + /// + /// The name of the agent pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _containerRegistryAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerRegistryAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryAgentPoolResource(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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// AgentPools_Get + /// + /// + /// + /// The name of the agent pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _containerRegistryAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerRegistryAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryAgentPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryCollection.cs index 2e4b2eaf324a..f76172521f65 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string registryName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName} + /// + /// + /// Operation Id + /// Registries_Get + /// + /// + /// + /// The name of the container registry. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string registryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registryName, nameof(registryName)); + + using var scope = _containerRegistryRegistriesClientDiagnostics.CreateScope("ContainerRegistryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryRegistriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, registryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryResource(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.ContainerRegistry/registries/{registryName} + /// + /// + /// Operation Id + /// Registries_Get + /// + /// + /// + /// The name of the container registry. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string registryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(registryName, nameof(registryName)); + + using var scope = _containerRegistryRegistriesClientDiagnostics.CreateScope("ContainerRegistryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryRegistriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, registryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionCollection.cs index 212a66e5c67a..9fa3d04cb3d3 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerRegistryPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryPrivateEndpointConnectionResource(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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerRegistryPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceCollection.cs index 2341c87b7fea..a83e14af996a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// Registries_GetPrivateLinkResource + /// + /// + /// + /// The name of the private link 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 groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _containerRegistryPrivateLinkResourceRegistriesClientDiagnostics.CreateScope("ContainerRegistryPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryPrivateLinkResourceRegistriesRestClient.GetPrivateLinkResourceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryPrivateLinkResource(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.ContainerRegistry/registries/{registryName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// Registries_GetPrivateLinkResource + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _containerRegistryPrivateLinkResourceRegistriesClientDiagnostics.CreateScope("ContainerRegistryPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryPrivateLinkResourceRegistriesRestClient.GetPrivateLinkResource(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationCollection.cs index 036a81a0c474..9dc2d2ea4c1a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string replicationName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName} + /// + /// + /// Operation Id + /// Replications_Get + /// + /// + /// + /// The name of the replication. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string replicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationName, nameof(replicationName)); + + using var scope = _containerRegistryReplicationReplicationsClientDiagnostics.CreateScope("ContainerRegistryReplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryReplicationReplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryReplicationResource(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.ContainerRegistry/registries/{registryName}/replications/{replicationName} + /// + /// + /// Operation Id + /// Replications_Get + /// + /// + /// + /// The name of the replication. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string replicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationName, nameof(replicationName)); + + using var scope = _containerRegistryReplicationReplicationsClientDiagnostics.CreateScope("ContainerRegistryReplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryReplicationReplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryReplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunCollection.cs index caac8d960c3b..f2a8ed7d827c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunCollection.cs @@ -245,6 +245,80 @@ public virtual Response Exists(string runId, CancellationToken cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId} + /// + /// + /// Operation Id + /// Runs_Get + /// + /// + /// + /// The run ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string runId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + using var scope = _containerRegistryRunRunsClientDiagnostics.CreateScope("ContainerRegistryRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryRunRunsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryRunResource(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.ContainerRegistry/registries/{registryName}/runs/{runId} + /// + /// + /// Operation Id + /// Runs_Get + /// + /// + /// + /// The run ID. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string runId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runId, nameof(runId)); + + using var scope = _containerRegistryRunRunsClientDiagnostics.CreateScope("ContainerRegistryRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryRunRunsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskCollection.cs index 8573f89a160d..2c04e1df59c4 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string taskName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_Get + /// + /// + /// + /// The name of the container registry task. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string taskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _containerRegistryTaskTasksClientDiagnostics.CreateScope("ContainerRegistryTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryTaskTasksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryTaskResource(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.ContainerRegistry/registries/{registryName}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_Get + /// + /// + /// + /// The name of the container registry task. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string taskName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _containerRegistryTaskTasksClientDiagnostics.CreateScope("ContainerRegistryTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryTaskTasksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunCollection.cs index 8be4f842350e..a5208c2aac86 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string taskRunName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName} + /// + /// + /// Operation Id + /// TaskRuns_Get + /// + /// + /// + /// The name of the task run. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string taskRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskRunName, nameof(taskRunName)); + + using var scope = _containerRegistryTaskRunTaskRunsClientDiagnostics.CreateScope("ContainerRegistryTaskRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryTaskRunTaskRunsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskRunName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryTaskRunResource(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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName} + /// + /// + /// Operation Id + /// TaskRuns_Get + /// + /// + /// + /// The name of the task run. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string taskRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskRunName, nameof(taskRunName)); + + using var scope = _containerRegistryTaskRunTaskRunsClientDiagnostics.CreateScope("ContainerRegistryTaskRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryTaskRunTaskRunsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskRunName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryTaskRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenCollection.cs index 90f07020fe4f..52f147077439 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string tokenName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName} + /// + /// + /// Operation Id + /// Tokens_Get + /// + /// + /// + /// The name of the token. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tokenName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tokenName, nameof(tokenName)); + + using var scope = _containerRegistryTokenTokensClientDiagnostics.CreateScope("ContainerRegistryTokenCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryTokenTokensRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tokenName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryTokenResource(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.ContainerRegistry/registries/{registryName}/tokens/{tokenName} + /// + /// + /// Operation Id + /// Tokens_Get + /// + /// + /// + /// The name of the token. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tokenName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tokenName, nameof(tokenName)); + + using var scope = _containerRegistryTokenTokensClientDiagnostics.CreateScope("ContainerRegistryTokenCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryTokenTokensRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tokenName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryTokenResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookCollection.cs index de1d4741862f..cff29e8a2705 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string webhookName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName} + /// + /// + /// Operation Id + /// Webhooks_Get + /// + /// + /// + /// The name of the webhook. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string webhookName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webhookName, nameof(webhookName)); + + using var scope = _containerRegistryWebhookWebhooksClientDiagnostics.CreateScope("ContainerRegistryWebhookCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerRegistryWebhookWebhooksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webhookName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryWebhookResource(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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName} + /// + /// + /// Operation Id + /// Webhooks_Get + /// + /// + /// + /// The name of the webhook. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string webhookName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(webhookName, nameof(webhookName)); + + using var scope = _containerRegistryWebhookWebhooksClientDiagnostics.CreateScope("ContainerRegistryWebhookCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerRegistryWebhookWebhooksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webhookName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerRegistryWebhookResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapCollection.cs index bda7463a9574..12348c98b234 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string scopeMapName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName} + /// + /// + /// Operation Id + /// ScopeMaps_Get + /// + /// + /// + /// The name of the scope map. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string scopeMapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeMapName, nameof(scopeMapName)); + + using var scope = _scopeMapClientDiagnostics.CreateScope("ScopeMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scopeMapRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scopeMapName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScopeMapResource(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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName} + /// + /// + /// Operation Id + /// ScopeMaps_Get + /// + /// + /// + /// The name of the scope map. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string scopeMapName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scopeMapName, nameof(scopeMapName)); + + using var scope = _scopeMapClientDiagnostics.CreateScope("ScopeMapCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scopeMapRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scopeMapName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScopeMapResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs index 229c4ac39e58..30a4903713e0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the managed cluster 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _agentPoolSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgentPoolSnapshotResource(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.ContainerService/snapshots/{resourceName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _agentPoolSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgentPoolSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs index 06102300c6a7..ddab84603b4d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string agentPoolName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// AgentPools_Get + /// + /// + /// + /// The name of the agent pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerServiceAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceAgentPoolResource(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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} + /// + /// + /// Operation Id + /// AgentPools_Get + /// + /// + /// + /// The name of the agent pool. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agentPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + + using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerServiceAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceAgentPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetCollection.cs index c93001cc1ddd..0c944ecf3c22 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetCollection.cs @@ -328,6 +328,80 @@ public virtual Response Exists(string fleetName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _containerServiceFleetFleetsClientDiagnostics.CreateScope("ContainerServiceFleetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerServiceFleetFleetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceFleetResource(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.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _containerServiceFleetFleetsClientDiagnostics.CreateScope("ContainerServiceFleetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerServiceFleetFleetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceFleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberCollection.cs index 745fa57ee43b..f96e063cb809 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberCollection.cs @@ -327,6 +327,80 @@ public virtual Response Exists(string fleetMemberName, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member 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 fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _containerServiceFleetMemberFleetMembersClientDiagnostics.CreateScope("ContainerServiceFleetMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerServiceFleetMemberFleetMembersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceFleetMemberResource(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.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _containerServiceFleetMemberFleetMembersClientDiagnostics.CreateScope("ContainerServiceFleetMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerServiceFleetMemberFleetMembersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceFleetMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs index b69cdcf47a9d..bab5b229a821 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string configName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} + /// + /// + /// Operation Id + /// MaintenanceConfigurations_Get + /// + /// + /// + /// The name of the maintenance configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configName, nameof(configName)); + + using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(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.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} + /// + /// + /// Operation Id + /// MaintenanceConfigurations_Get + /// + /// + /// + /// The name of the maintenance configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configName, nameof(configName)); + + using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs index d685cfb39125..4045c960214c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusters_Get + /// + /// + /// + /// The name of the managed cluster 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerServiceManagedClusterManagedClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceManagedClusterResource(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.ContainerService/managedClusters/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusters_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerServiceManagedClusterManagedClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceManagedClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs index 2fb292478c40..a399cbf41f12 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(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.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs index 44e6acf6bf03..96243389f596 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string trustedAccessRoleBindingName, Cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} + /// + /// + /// Operation Id + /// TrustedAccessRoleBindings_Get + /// + /// + /// + /// The name of trusted access role binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); + + using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceTrustedAccessRoleBindingResource(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.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} + /// + /// + /// Operation Id + /// TrustedAccessRoleBindings_Get + /// + /// + /// + /// The name of trusted access role binding. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); + + using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerServiceTrustedAccessRoleBindingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs index ee672f36a36f..353bbb69ec6b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string resourceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// + /// The name of the managed cluster 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedClusterSnapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedClusterSnapshotResource(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.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _managedClusterSnapshotClientDiagnostics.CreateScope("ManagedClusterSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedClusterSnapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedClusterSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs index 99f029301ad8..0cfe82b9ba77 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string backupId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} + /// + /// + /// Operation Id + /// CassandraClusters_GetBackup + /// + /// + /// + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraClusterBackupResource(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.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} + /// + /// + /// Operation Id + /// CassandraClusters_GetBackup + /// + /// + /// + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterCollection.cs index 07bfd735e5ef..8c3de5be5e68 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName} + /// + /// + /// Operation Id + /// CassandraClusters_Get + /// + /// + /// + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cassandraClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraClusterResource(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.DocumentDB/cassandraClusters/{clusterName} + /// + /// + /// Operation Id + /// CassandraClusters_Get + /// + /// + /// + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cassandraClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterCollection.cs index 1d49ceb75de4..7f42f6b888cd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string dataCenterName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName} + /// + /// + /// Operation Id + /// CassandraDataCenters_Get + /// + /// + /// + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataCenterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataCenterName, nameof(dataCenterName)); + + using var scope = _cassandraDataCenterClientDiagnostics.CreateScope("CassandraDataCenterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cassandraDataCenterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataCenterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraDataCenterResource(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.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName} + /// + /// + /// Operation Id + /// CassandraDataCenters_Get + /// + /// + /// + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataCenterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataCenterName, nameof(dataCenterName)); + + using var scope = _cassandraDataCenterClientDiagnostics.CreateScope("CassandraDataCenterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cassandraDataCenterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataCenterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraDataCenterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceCollection.cs index 606df35e623b..8ab9cf975f53 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string keyspaceName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName} + /// + /// + /// Operation Id + /// CassandraResources_GetCassandraKeyspace + /// + /// + /// + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string keyspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyspaceName, nameof(keyspaceName)); + + using var scope = _cassandraKeyspaceCassandraResourcesClientDiagnostics.CreateScope("CassandraKeyspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cassandraKeyspaceCassandraResourcesRestClient.GetCassandraKeyspaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraKeyspaceResource(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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName} + /// + /// + /// Operation Id + /// CassandraResources_GetCassandraKeyspace + /// + /// + /// + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string keyspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyspaceName, nameof(keyspaceName)); + + using var scope = _cassandraKeyspaceCassandraResourcesClientDiagnostics.CreateScope("CassandraKeyspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cassandraKeyspaceCassandraResourcesRestClient.GetCassandraKeyspace(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraKeyspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableCollection.cs index e94ad29b9c3c..3d36aec101e3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string tableName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName} + /// + /// + /// Operation Id + /// CassandraResources_GetCassandraTable + /// + /// + /// + /// Cosmos DB table name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _cassandraTableCassandraResourcesClientDiagnostics.CreateScope("CassandraTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cassandraTableCassandraResourcesRestClient.GetCassandraTableAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraTableResource(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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName} + /// + /// + /// Operation Id + /// CassandraResources_GetCassandraTable + /// + /// + /// + /// Cosmos DB table name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _cassandraTableCassandraResourcesClientDiagnostics.CreateScope("CassandraTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cassandraTableCassandraResourcesRestClient.GetCassandraTable(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraTableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultCollection.cs index db36607c7573..930d982f14c3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string viewName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName} + /// + /// + /// Operation Id + /// CassandraResources_GetCassandraView + /// + /// + /// + /// Cosmos DB view name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string viewName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); + + using var scope = _cassandraViewGetResultCassandraResourcesClientDiagnostics.CreateScope("CassandraViewGetResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cassandraViewGetResultCassandraResourcesRestClient.GetCassandraViewAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, viewName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraViewGetResultResource(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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName} + /// + /// + /// Operation Id + /// CassandraResources_GetCassandraView + /// + /// + /// + /// Cosmos DB view name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string viewName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); + + using var scope = _cassandraViewGetResultCassandraResourcesClientDiagnostics.CreateScope("CassandraViewGetResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cassandraViewGetResultCassandraResourcesRestClient.GetCassandraView(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, viewName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CassandraViewGetResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountCollection.cs index 507873a0ba4f..01d4b51d63ae 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName} + /// + /// + /// Operation Id + /// DatabaseAccounts_Get + /// + /// + /// + /// Cosmos DB database account name. + /// The cancellation token to use. + /// 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(accountName, nameof(accountName)); + + using var scope = _cosmosDBAccountDatabaseAccountsClientDiagnostics.CreateScope("CosmosDBAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBAccountDatabaseAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBAccountResource(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.DocumentDB/databaseAccounts/{accountName} + /// + /// + /// Operation Id + /// DatabaseAccounts_Get + /// + /// + /// + /// Cosmos DB database account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _cosmosDBAccountDatabaseAccountsClientDiagnostics.CreateScope("CosmosDBAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBAccountDatabaseAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleCollection.cs index 6a2e87370c3e..4a4039d75be8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// MongoClusters_GetFirewallRule + /// + /// + /// + /// The name of the mongo cluster firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _cosmosDBFirewallRuleMongoClustersClientDiagnostics.CreateScope("CosmosDBFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBFirewallRuleMongoClustersRestClient.GetFirewallRuleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBFirewallRuleResource(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.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// MongoClusters_GetFirewallRule + /// + /// + /// + /// The name of the mongo cluster firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _cosmosDBFirewallRuleMongoClustersClientDiagnostics.CreateScope("CosmosDBFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBFirewallRuleMongoClustersRestClient.GetFirewallRule(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationCollection.cs index fe5ba1916c02..1345beaa5edb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationCollection.cs @@ -224,6 +224,72 @@ public virtual Response Exists(AzureLocation location, CancellationToken c } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location} + /// + /// + /// Operation Id + /// Locations_Get + /// + /// + /// + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _cosmosDBLocationLocationsClientDiagnostics.CreateScope("CosmosDBLocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBLocationLocationsRestClient.GetAsync(Id.SubscriptionId, location, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBLocationResource(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}/providers/Microsoft.DocumentDB/locations/{location} + /// + /// + /// Operation Id + /// Locations_Get + /// + /// + /// + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = _cosmosDBLocationLocationsClientDiagnostics.CreateScope("CosmosDBLocationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBLocationLocationsRestClient.Get(Id.SubscriptionId, location, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBLocationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionCollection.cs index 9c763ce5b796..e4f61cf3cb30 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("CosmosDBPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBPrivateEndpointConnectionResource(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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("CosmosDBPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceCollection.cs index 32b256d509fb..b7dee3412e73 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string groupName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _cosmosDBPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("CosmosDBPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBPrivateLinkResource(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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = _cosmosDBPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("CosmosDBPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceCollection.cs index 3e2f6afe299e..0a0537e03768 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName} + /// + /// + /// Operation Id + /// Service_Get + /// + /// + /// + /// Cosmos DB service name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _cosmosDBServiceServiceClientDiagnostics.CreateScope("CosmosDBServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBServiceServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBServiceResource(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.DocumentDB/databaseAccounts/{accountName}/services/{serviceName} + /// + /// + /// Operation Id + /// Service_Get + /// + /// + /// + /// Cosmos DB service name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _cosmosDBServiceServiceClientDiagnostics.CreateScope("CosmosDBServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBServiceServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyCollection.cs index af35744fb387..ec2db1f4e829 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string clientEncryptionKeyName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName} + /// + /// + /// Operation Id + /// SqlResources_GetClientEncryptionKey + /// + /// + /// + /// Cosmos DB ClientEncryptionKey name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clientEncryptionKeyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientEncryptionKeyName, nameof(clientEncryptionKeyName)); + + using var scope = _cosmosDBSqlClientEncryptionKeySqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlClientEncryptionKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBSqlClientEncryptionKeySqlResourcesRestClient.GetClientEncryptionKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, clientEncryptionKeyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlClientEncryptionKeyResource(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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName} + /// + /// + /// Operation Id + /// SqlResources_GetClientEncryptionKey + /// + /// + /// + /// Cosmos DB ClientEncryptionKey name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clientEncryptionKeyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clientEncryptionKeyName, nameof(clientEncryptionKeyName)); + + using var scope = _cosmosDBSqlClientEncryptionKeySqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlClientEncryptionKeyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBSqlClientEncryptionKeySqlResourcesRestClient.GetClientEncryptionKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, clientEncryptionKeyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlClientEncryptionKeyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerCollection.cs index 2296dfaf6fad..8f507a037a7f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string containerName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlContainer + /// + /// + /// + /// Cosmos DB container name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _cosmosDBSqlContainerSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBSqlContainerSqlResourcesRestClient.GetSqlContainerAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlContainerResource(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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlContainer + /// + /// + /// + /// Cosmos DB container name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _cosmosDBSqlContainerSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBSqlContainerSqlResourcesRestClient.GetSqlContainer(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseCollection.cs index 6c9437fb5a88..2905606ef8ea 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlDatabase + /// + /// + /// + /// Cosmos DB database name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _cosmosDBSqlDatabaseSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBSqlDatabaseSqlResourcesRestClient.GetSqlDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlDatabaseResource(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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlDatabase + /// + /// + /// + /// Cosmos DB database name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _cosmosDBSqlDatabaseSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBSqlDatabaseSqlResourcesRestClient.GetSqlDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentCollection.cs index 086d10b5e2a0..b3da223d473a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string roleAssignmentId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId} + /// + /// + /// Operation Id + /// SqlResources_GetSqlRoleAssignment + /// + /// + /// + /// The GUID for the Role Assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleAssignmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleAssignmentId, nameof(roleAssignmentId)); + + using var scope = _cosmosDBSqlRoleAssignmentSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlRoleAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBSqlRoleAssignmentSqlResourcesRestClient.GetSqlRoleAssignmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleAssignmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlRoleAssignmentResource(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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId} + /// + /// + /// Operation Id + /// SqlResources_GetSqlRoleAssignment + /// + /// + /// + /// The GUID for the Role Assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleAssignmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleAssignmentId, nameof(roleAssignmentId)); + + using var scope = _cosmosDBSqlRoleAssignmentSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlRoleAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBSqlRoleAssignmentSqlResourcesRestClient.GetSqlRoleAssignment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleAssignmentId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlRoleAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionCollection.cs index fefc21f2a882..8ebfd5d28b8c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string roleDefinitionId, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// SqlResources_GetSqlRoleDefinition + /// + /// + /// + /// The GUID for the Role Definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleDefinitionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleDefinitionId, nameof(roleDefinitionId)); + + using var scope = _cosmosDBSqlRoleDefinitionSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlRoleDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBSqlRoleDefinitionSqlResourcesRestClient.GetSqlRoleDefinitionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleDefinitionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlRoleDefinitionResource(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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// SqlResources_GetSqlRoleDefinition + /// + /// + /// + /// The GUID for the Role Definition. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleDefinitionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleDefinitionId, nameof(roleDefinitionId)); + + using var scope = _cosmosDBSqlRoleDefinitionSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlRoleDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBSqlRoleDefinitionSqlResourcesRestClient.GetSqlRoleDefinition(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleDefinitionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureCollection.cs index 53d232faf646..87e68e3f5ede 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string storedProcedureName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlStoredProcedure + /// + /// + /// + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storedProcedureName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storedProcedureName, nameof(storedProcedureName)); + + using var scope = _cosmosDBSqlStoredProcedureSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlStoredProcedureCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBSqlStoredProcedureSqlResourcesRestClient.GetSqlStoredProcedureAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, storedProcedureName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlStoredProcedureResource(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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlStoredProcedure + /// + /// + /// + /// Cosmos DB storedProcedure name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storedProcedureName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storedProcedureName, nameof(storedProcedureName)); + + using var scope = _cosmosDBSqlStoredProcedureSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlStoredProcedureCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBSqlStoredProcedureSqlResourcesRestClient.GetSqlStoredProcedure(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, storedProcedureName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlStoredProcedureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerCollection.cs index 77c775a25d0e..a60f83293e13 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string triggerName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlTrigger + /// + /// + /// + /// Cosmos DB trigger name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string triggerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); + + using var scope = _cosmosDBSqlTriggerSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBSqlTriggerSqlResourcesRestClient.GetSqlTriggerAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, triggerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlTriggerResource(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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlTrigger + /// + /// + /// + /// Cosmos DB trigger name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string triggerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); + + using var scope = _cosmosDBSqlTriggerSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBSqlTriggerSqlResourcesRestClient.GetSqlTrigger(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, triggerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlTriggerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionCollection.cs index 66eaad42801b..0b56f6fef2a1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string userDefinedFunctionName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlUserDefinedFunction + /// + /// + /// + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userDefinedFunctionName, nameof(userDefinedFunctionName)); + + using var scope = _cosmosDBSqlUserDefinedFunctionSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlUserDefinedFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBSqlUserDefinedFunctionSqlResourcesRestClient.GetSqlUserDefinedFunctionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userDefinedFunctionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlUserDefinedFunctionResource(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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName} + /// + /// + /// Operation Id + /// SqlResources_GetSqlUserDefinedFunction + /// + /// + /// + /// Cosmos DB userDefinedFunction name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string userDefinedFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userDefinedFunctionName, nameof(userDefinedFunctionName)); + + using var scope = _cosmosDBSqlUserDefinedFunctionSqlResourcesClientDiagnostics.CreateScope("CosmosDBSqlUserDefinedFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBSqlUserDefinedFunctionSqlResourcesRestClient.GetSqlUserDefinedFunction(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userDefinedFunctionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBSqlUserDefinedFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableCollection.cs index 0fcc3456a5ce..1bc016a29cc8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string tableName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName} + /// + /// + /// Operation Id + /// TableResources_GetTable + /// + /// + /// + /// Cosmos DB table name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _cosmosDBTableTableResourcesClientDiagnostics.CreateScope("CosmosDBTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBTableTableResourcesRestClient.GetTableAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tableName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBTableResource(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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName} + /// + /// + /// Operation Id + /// TableResources_GetTable + /// + /// + /// + /// Cosmos DB table name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tableName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); + + using var scope = _cosmosDBTableTableResourcesClientDiagnostics.CreateScope("CosmosDBTableCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBTableTableResourcesRestClient.GetTable(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tableName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBTableResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultCollection.cs index b537a60cc62e..b7382be33136 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string jobName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName} + /// + /// + /// Operation Id + /// DataTransferJobs_Get + /// + /// + /// + /// Name of the Data Transfer Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataTransferJobGetResultDataTransferJobsClientDiagnostics.CreateScope("DataTransferJobGetResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataTransferJobGetResultDataTransferJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataTransferJobGetResultResource(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.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName} + /// + /// + /// Operation Id + /// DataTransferJobs_Get + /// + /// + /// + /// Name of the Data Transfer Job. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataTransferJobGetResultDataTransferJobsClientDiagnostics.CreateScope("DataTransferJobGetResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataTransferJobGetResultDataTransferJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataTransferJobGetResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultCollection.cs index bf6300fa5f84..32baf3e1dc37 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string graphName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName} + /// + /// + /// Operation Id + /// GraphResources_GetGraph + /// + /// + /// + /// Cosmos DB graph resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string graphName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(graphName, nameof(graphName)); + + using var scope = _graphResourceGetResultGraphResourcesClientDiagnostics.CreateScope("GraphResourceGetResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _graphResourceGetResultGraphResourcesRestClient.GetGraphAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, graphName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GraphResourceGetResultResource(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.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName} + /// + /// + /// Operation Id + /// GraphResources_GetGraph + /// + /// + /// + /// Cosmos DB graph resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string graphName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(graphName, nameof(graphName)); + + using var scope = _graphResourceGetResultGraphResourcesClientDiagnostics.CreateScope("GraphResourceGetResultCollection.GetIfExists"); + scope.Start(); + try + { + var response = _graphResourceGetResultGraphResourcesRestClient.GetGraph(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, graphName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GraphResourceGetResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseCollection.cs index 7ffa747e33f7..de0a71cd2b9f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName} + /// + /// + /// Operation Id + /// GremlinResources_GetGremlinDatabase + /// + /// + /// + /// Cosmos DB database name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _gremlinDatabaseGremlinResourcesClientDiagnostics.CreateScope("GremlinDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _gremlinDatabaseGremlinResourcesRestClient.GetGremlinDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GremlinDatabaseResource(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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName} + /// + /// + /// Operation Id + /// GremlinResources_GetGremlinDatabase + /// + /// + /// + /// Cosmos DB database name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _gremlinDatabaseGremlinResourcesClientDiagnostics.CreateScope("GremlinDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _gremlinDatabaseGremlinResourcesRestClient.GetGremlinDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GremlinDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphCollection.cs index 9e2e08621b38..c6714b220126 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string graphName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName} + /// + /// + /// Operation Id + /// GremlinResources_GetGremlinGraph + /// + /// + /// + /// Cosmos DB graph name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string graphName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(graphName, nameof(graphName)); + + using var scope = _gremlinGraphGremlinResourcesClientDiagnostics.CreateScope("GremlinGraphCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _gremlinGraphGremlinResourcesRestClient.GetGremlinGraphAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, graphName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GremlinGraphResource(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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName} + /// + /// + /// Operation Id + /// GremlinResources_GetGremlinGraph + /// + /// + /// + /// Cosmos DB graph name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string graphName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(graphName, nameof(graphName)); + + using var scope = _gremlinGraphGremlinResourcesClientDiagnostics.CreateScope("GremlinGraphCollection.GetIfExists"); + scope.Start(); + try + { + var response = _gremlinGraphGremlinResourcesRestClient.GetGremlinGraph(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, graphName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GremlinGraphResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterCollection.cs index a8aa296c4ea4..3921622d65ad 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string mongoClusterName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName} + /// + /// + /// Operation Id + /// MongoClusters_Get + /// + /// + /// + /// The name of the mongo cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string mongoClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + + using var scope = _mongoClusterClientDiagnostics.CreateScope("MongoClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mongoClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, mongoClusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoClusterResource(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.DocumentDB/mongoClusters/{mongoClusterName} + /// + /// + /// Operation Id + /// MongoClusters_Get + /// + /// + /// + /// The name of the mongo cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string mongoClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + + using var scope = _mongoClusterClientDiagnostics.CreateScope("MongoClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mongoClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, mongoClusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionCollection.cs index de2bdad78886..3e89a39a1552 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string collectionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName} + /// + /// + /// Operation Id + /// MongoDBResources_GetMongoDBCollection + /// + /// + /// + /// Cosmos DB collection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string collectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(collectionName, nameof(collectionName)); + + using var scope = _mongoDBCollectionMongoDBResourcesClientDiagnostics.CreateScope("MongoDBCollectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mongoDBCollectionMongoDBResourcesRestClient.GetMongoDBCollectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, collectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoDBCollectionResource(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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName} + /// + /// + /// Operation Id + /// MongoDBResources_GetMongoDBCollection + /// + /// + /// + /// Cosmos DB collection name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string collectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(collectionName, nameof(collectionName)); + + using var scope = _mongoDBCollectionMongoDBResourcesClientDiagnostics.CreateScope("MongoDBCollectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mongoDBCollectionMongoDBResourcesRestClient.GetMongoDBCollection(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, collectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoDBCollectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseCollection.cs index 11d7a3354fdc..415d3ba40b8e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string databaseName, CancellationToken canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName} + /// + /// + /// Operation Id + /// MongoDBResources_GetMongoDBDatabase + /// + /// + /// + /// Cosmos DB database name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _mongoDBDatabaseMongoDBResourcesClientDiagnostics.CreateScope("MongoDBDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mongoDBDatabaseMongoDBResourcesRestClient.GetMongoDBDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoDBDatabaseResource(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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName} + /// + /// + /// Operation Id + /// MongoDBResources_GetMongoDBDatabase + /// + /// + /// + /// Cosmos DB database name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string databaseName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var scope = _mongoDBDatabaseMongoDBResourcesClientDiagnostics.CreateScope("MongoDBDatabaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mongoDBDatabaseMongoDBResourcesRestClient.GetMongoDBDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, databaseName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoDBDatabaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionCollection.cs index 05f64175cf02..b16a529902fb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string mongoRoleDefinitionId, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId} + /// + /// + /// Operation Id + /// MongoDBResources_GetMongoRoleDefinition + /// + /// + /// + /// The ID for the Role Definition {dbName.roleName}. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string mongoRoleDefinitionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mongoRoleDefinitionId, nameof(mongoRoleDefinitionId)); + + using var scope = _mongoDBRoleDefinitionMongoDBResourcesClientDiagnostics.CreateScope("MongoDBRoleDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mongoDBRoleDefinitionMongoDBResourcesRestClient.GetMongoRoleDefinitionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mongoRoleDefinitionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoDBRoleDefinitionResource(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.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId} + /// + /// + /// Operation Id + /// MongoDBResources_GetMongoRoleDefinition + /// + /// + /// + /// The ID for the Role Definition {dbName.roleName}. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string mongoRoleDefinitionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mongoRoleDefinitionId, nameof(mongoRoleDefinitionId)); + + using var scope = _mongoDBRoleDefinitionMongoDBResourcesClientDiagnostics.CreateScope("MongoDBRoleDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mongoDBRoleDefinitionMongoDBResourcesRestClient.GetMongoRoleDefinition(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mongoRoleDefinitionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoDBRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionCollection.cs index a1729357a63b..4ea1f07f2a0f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionCollection.cs @@ -322,6 +322,80 @@ public virtual Response Exists(string mongoUserDefinitionId, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId} + /// + /// + /// Operation Id + /// MongoDBResources_GetMongoUserDefinition + /// + /// + /// + /// The ID for the User Definition {dbName.userName}. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string mongoUserDefinitionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mongoUserDefinitionId, nameof(mongoUserDefinitionId)); + + using var scope = _mongoDBUserDefinitionMongoDBResourcesClientDiagnostics.CreateScope("MongoDBUserDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mongoDBUserDefinitionMongoDBResourcesRestClient.GetMongoUserDefinitionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mongoUserDefinitionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoDBUserDefinitionResource(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.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId} + /// + /// + /// Operation Id + /// MongoDBResources_GetMongoUserDefinition + /// + /// + /// + /// The ID for the User Definition {dbName.userName}. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string mongoUserDefinitionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mongoUserDefinitionId, nameof(mongoUserDefinitionId)); + + using var scope = _mongoDBUserDefinitionMongoDBResourcesClientDiagnostics.CreateScope("MongoDBUserDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mongoDBUserDefinitionMongoDBResourcesRestClient.GetMongoUserDefinition(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mongoUserDefinitionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MongoDBUserDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountCollection.cs index 8cba090da6df..be97b5cb4754 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountCollection.cs @@ -223,6 +223,72 @@ public virtual Response Exists(Guid instanceId, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId} + /// + /// + /// Operation Id + /// RestorableDatabaseAccounts_GetByLocation + /// + /// + /// + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(Guid instanceId, CancellationToken cancellationToken = default) + { + using var scope = _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics.CreateScope("RestorableCosmosDBAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _restorableCosmosDBAccountRestorableDatabaseAccountsRestClient.GetByLocationAsync(Id.SubscriptionId, new AzureLocation(Id.Name), instanceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorableCosmosDBAccountResource(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}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId} + /// + /// + /// Operation Id + /// RestorableDatabaseAccounts_GetByLocation + /// + /// + /// + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(Guid instanceId, CancellationToken cancellationToken = default) + { + using var scope = _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics.CreateScope("RestorableCosmosDBAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _restorableCosmosDBAccountRestorableDatabaseAccountsRestClient.GetByLocation(Id.SubscriptionId, new AzureLocation(Id.Name), instanceId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RestorableCosmosDBAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlClusterCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlClusterCollection.cs index 0d051b5bda89..7afde6444fdf 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlClusterCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlClusterCollection.cs @@ -413,5 +413,47 @@ public async Task Exists_GetTheCluster() Console.WriteLine($"Succeeded: {result}"); } + + // Get the cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheCluster() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterGet.json + // this example is just showing the usage of "Clusters_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBForPostgreSqlClusterResource + CosmosDBForPostgreSqlClusterCollection collection = resourceGroupResource.GetCosmosDBForPostgreSqlClusters(); + + // invoke the operation + string clusterName = "testcluster1"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + CosmosDBForPostgreSqlClusterResource 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 + CosmosDBForPostgreSqlClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlClusterServerCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlClusterServerCollection.cs index 9f87821b367f..842f1362eca3 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlClusterServerCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlClusterServerCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetTheServerOfCluster() Console.WriteLine($"Succeeded: {result}"); } + + // Get the server of cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheServerOfCluster() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ServerGet.json + // this example is just showing the usage of "Servers_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 CosmosDBForPostgreSqlClusterResource created on azure + // for more information of creating CosmosDBForPostgreSqlClusterResource, please refer to the document of CosmosDBForPostgreSqlClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string clusterName = "testcluster1"; + ResourceIdentifier cosmosDBForPostgreSqlClusterResourceId = CosmosDBForPostgreSqlClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CosmosDBForPostgreSqlClusterResource cosmosDBForPostgreSqlCluster = client.GetCosmosDBForPostgreSqlClusterResource(cosmosDBForPostgreSqlClusterResourceId); + + // get the collection of this CosmosDBForPostgreSqlClusterServerResource + CosmosDBForPostgreSqlClusterServerCollection collection = cosmosDBForPostgreSqlCluster.GetCosmosDBForPostgreSqlClusterServers(); + + // invoke the operation + string serverName = "testcluster1-c"; + NullableResponse response = await collection.GetIfExistsAsync(serverName); + CosmosDBForPostgreSqlClusterServerResource 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 + CosmosDBForPostgreSqlClusterServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlConfigurationCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlConfigurationCollection.cs index ae93c48a8104..ead6e8bfb1e6 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlConfigurationCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlConfigurationCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetConfigurationDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Get configuration details. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConfigurationDetails() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGet.json + // this example is just showing the usage of "Configurations_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 CosmosDBForPostgreSqlClusterResource created on azure + // for more information of creating CosmosDBForPostgreSqlClusterResource, please refer to the document of CosmosDBForPostgreSqlClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string clusterName = "testcluster"; + ResourceIdentifier cosmosDBForPostgreSqlClusterResourceId = CosmosDBForPostgreSqlClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CosmosDBForPostgreSqlClusterResource cosmosDBForPostgreSqlCluster = client.GetCosmosDBForPostgreSqlClusterResource(cosmosDBForPostgreSqlClusterResourceId); + + // get the collection of this CosmosDBForPostgreSqlConfigurationResource + CosmosDBForPostgreSqlConfigurationCollection collection = cosmosDBForPostgreSqlCluster.GetCosmosDBForPostgreSqlConfigurations(); + + // invoke the operation + string configurationName = "client_encoding"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + CosmosDBForPostgreSqlConfigurationResource 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 + CosmosDBForPostgreSqlConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlCoordinatorConfigurationCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlCoordinatorConfigurationCollection.cs index 482f64fbaee4..a77755a70ee7 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlCoordinatorConfigurationCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlCoordinatorConfigurationCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetConfigurationDetailsForCoordinator() Console.WriteLine($"Succeeded: {result}"); } + // Get configuration details for coordinator. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConfigurationDetailsForCoordinator() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGetCoordinator.json + // this example is just showing the usage of "Configurations_GetCoordinator" 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 CosmosDBForPostgreSqlClusterResource created on azure + // for more information of creating CosmosDBForPostgreSqlClusterResource, please refer to the document of CosmosDBForPostgreSqlClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string clusterName = "testcluster"; + ResourceIdentifier cosmosDBForPostgreSqlClusterResourceId = CosmosDBForPostgreSqlClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CosmosDBForPostgreSqlClusterResource cosmosDBForPostgreSqlCluster = client.GetCosmosDBForPostgreSqlClusterResource(cosmosDBForPostgreSqlClusterResourceId); + + // get the collection of this CosmosDBForPostgreSqlCoordinatorConfigurationResource + CosmosDBForPostgreSqlCoordinatorConfigurationCollection collection = cosmosDBForPostgreSqlCluster.GetCosmosDBForPostgreSqlCoordinatorConfigurations(); + + // invoke the operation + string configurationName = "array_nulls"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + CosmosDBForPostgreSqlCoordinatorConfigurationResource 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 + CosmosDBForPostgreSqlServerConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update single configuration of coordinator [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlFirewallRuleCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlFirewallRuleCollection.cs index 50b92c67e985..352279c9389a 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlFirewallRuleCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlFirewallRuleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetTheFirewallRuleOfTheCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get the firewall rule of the cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheFirewallRuleOfTheCluster() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/FirewallRuleGet.json + // this example is just showing the usage of "FirewallRules_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 CosmosDBForPostgreSqlClusterResource created on azure + // for more information of creating CosmosDBForPostgreSqlClusterResource, please refer to the document of CosmosDBForPostgreSqlClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string clusterName = "pgtestsvc4"; + ResourceIdentifier cosmosDBForPostgreSqlClusterResourceId = CosmosDBForPostgreSqlClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CosmosDBForPostgreSqlClusterResource cosmosDBForPostgreSqlCluster = client.GetCosmosDBForPostgreSqlClusterResource(cosmosDBForPostgreSqlClusterResourceId); + + // get the collection of this CosmosDBForPostgreSqlFirewallRuleResource + CosmosDBForPostgreSqlFirewallRuleCollection collection = cosmosDBForPostgreSqlCluster.GetCosmosDBForPostgreSqlFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + CosmosDBForPostgreSqlFirewallRuleResource 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 + CosmosDBForPostgreSqlFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // List firewall rules of the cluster [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlNodeConfigurationCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlNodeConfigurationCollection.cs index cd21a138b65b..f63061fd4782 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlNodeConfigurationCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlNodeConfigurationCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetConfigurationDetailsForNode() Console.WriteLine($"Succeeded: {result}"); } + // Get configuration details for node. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetConfigurationDetailsForNode() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGetNode.json + // this example is just showing the usage of "Configurations_GetNode" 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 CosmosDBForPostgreSqlClusterResource created on azure + // for more information of creating CosmosDBForPostgreSqlClusterResource, please refer to the document of CosmosDBForPostgreSqlClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string clusterName = "testcluster"; + ResourceIdentifier cosmosDBForPostgreSqlClusterResourceId = CosmosDBForPostgreSqlClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CosmosDBForPostgreSqlClusterResource cosmosDBForPostgreSqlCluster = client.GetCosmosDBForPostgreSqlClusterResource(cosmosDBForPostgreSqlClusterResourceId); + + // get the collection of this CosmosDBForPostgreSqlNodeConfigurationResource + CosmosDBForPostgreSqlNodeConfigurationCollection collection = cosmosDBForPostgreSqlCluster.GetCosmosDBForPostgreSqlNodeConfigurations(); + + // invoke the operation + string configurationName = "array_nulls"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + CosmosDBForPostgreSqlNodeConfigurationResource 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 + CosmosDBForPostgreSqlServerConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Update single configuration of nodes [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs index a1013c62eb78..398ebbc0a845 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_GetsPrivateEndpointConnection() Console.WriteLine($"Succeeded: {result}"); } + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsGet.json + // this example is just showing the usage of "PrivateEndpointConnections_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 CosmosDBForPostgreSqlClusterResource created on azure + // for more information of creating CosmosDBForPostgreSqlClusterResource, please refer to the document of CosmosDBForPostgreSqlClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string clusterName = "testcluster"; + ResourceIdentifier cosmosDBForPostgreSqlClusterResourceId = CosmosDBForPostgreSqlClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CosmosDBForPostgreSqlClusterResource cosmosDBForPostgreSqlCluster = client.GetCosmosDBForPostgreSqlClusterResource(cosmosDBForPostgreSqlClusterResourceId); + + // get the collection of this CosmosDBForPostgreSqlPrivateEndpointConnectionResource + CosmosDBForPostgreSqlPrivateEndpointConnectionCollection collection = cosmosDBForPostgreSqlCluster.GetCosmosDBForPostgreSqlPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "private-endpoint-connection-name"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + CosmosDBForPostgreSqlPrivateEndpointConnectionResource 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 + CosmosDBForPostgreSqlPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Approves or Rejects a Private Endpoint Connection with a given name. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs index 04b839a0472d..ea4ffe580e15 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_GetsAPrivateLinkResourceForCluster() Console.WriteLine($"Succeeded: {result}"); } + + // Gets a private link resource for cluster. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAPrivateLinkResourceForCluster() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateLinkResourcesGet.json + // this example is just showing the usage of "PrivateLinkResources_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 CosmosDBForPostgreSqlClusterResource created on azure + // for more information of creating CosmosDBForPostgreSqlClusterResource, please refer to the document of CosmosDBForPostgreSqlClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string clusterName = "testcluster"; + ResourceIdentifier cosmosDBForPostgreSqlClusterResourceId = CosmosDBForPostgreSqlClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CosmosDBForPostgreSqlClusterResource cosmosDBForPostgreSqlCluster = client.GetCosmosDBForPostgreSqlClusterResource(cosmosDBForPostgreSqlClusterResourceId); + + // get the collection of this CosmosDBForPostgreSqlPrivateLinkResource + CosmosDBForPostgreSqlPrivateLinkResourceCollection collection = cosmosDBForPostgreSqlCluster.GetCosmosDBForPostgreSqlPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "plr"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + CosmosDBForPostgreSqlPrivateLinkResource 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 + CosmosDBForPostgreSqlPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlRoleCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlRoleCollection.cs index 1493ec417be4..01a0a3888601 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlRoleCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/samples/Generated/Samples/Sample_CosmosDBForPostgreSqlRoleCollection.cs @@ -83,6 +83,49 @@ public async Task Exists_GetTheRoleOfTheCluster() Console.WriteLine($"Succeeded: {result}"); } + // Get the role of the cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheRoleOfTheCluster() + { + // Generated from example definition: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleGet.json + // this example is just showing the usage of "Roles_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 CosmosDBForPostgreSqlClusterResource created on azure + // for more information of creating CosmosDBForPostgreSqlClusterResource, please refer to the document of CosmosDBForPostgreSqlClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string clusterName = "pgtestsvc4"; + ResourceIdentifier cosmosDBForPostgreSqlClusterResourceId = CosmosDBForPostgreSqlClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CosmosDBForPostgreSqlClusterResource cosmosDBForPostgreSqlCluster = client.GetCosmosDBForPostgreSqlClusterResource(cosmosDBForPostgreSqlClusterResourceId); + + // get the collection of this CosmosDBForPostgreSqlRoleResource + CosmosDBForPostgreSqlRoleCollection collection = cosmosDBForPostgreSqlCluster.GetCosmosDBForPostgreSqlRoles(); + + // invoke the operation + string roleName = "role1"; + NullableResponse response = await collection.GetIfExistsAsync(roleName); + CosmosDBForPostgreSqlRoleResource 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 + CosmosDBForPostgreSqlRoleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RoleCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterCollection.cs index 0be20124eeba..6c535bb1c945 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _cosmosDBForPostgreSqlClusterClustersClientDiagnostics.CreateScope("CosmosDBForPostgreSqlClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlClusterResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var scope = _cosmosDBForPostgreSqlClusterClustersClientDiagnostics.CreateScope("CosmosDBForPostgreSqlClusterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlClusterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerCollection.cs index 0a49d1e01232..682a4706e6d0 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string serverName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _cosmosDBForPostgreSqlClusterServerServersClientDiagnostics.CreateScope("CosmosDBForPostgreSqlClusterServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlClusterServerServersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlClusterServerResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName}/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var scope = _cosmosDBForPostgreSqlClusterServerServersClientDiagnostics.CreateScope("CosmosDBForPostgreSqlClusterServerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlClusterServerServersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlClusterServerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationCollection.cs index fcf88499cbcf..7f27bdd819ec 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the cluster configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _cosmosDBForPostgreSqlConfigurationConfigurationsClientDiagnostics.CreateScope("CosmosDBForPostgreSqlConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlConfigurationConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlConfigurationResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName}/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_Get + /// + /// + /// + /// The name of the cluster configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _cosmosDBForPostgreSqlConfigurationConfigurationsClientDiagnostics.CreateScope("CosmosDBForPostgreSqlConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlConfigurationConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlCoordinatorConfigurationCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlCoordinatorConfigurationCollection.cs index b863fd87c2f3..e36a94f5ffa6 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlCoordinatorConfigurationCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlCoordinatorConfigurationCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string configurationName, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/coordinatorConfigurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_GetCoordinator + /// + /// + /// + /// The name of the cluster configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _cosmosDBForPostgreSqlCoordinatorConfigurationConfigurationsClientDiagnostics.CreateScope("CosmosDBForPostgreSqlCoordinatorConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlCoordinatorConfigurationConfigurationsRestClient.GetCoordinatorAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlCoordinatorConfigurationResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName}/coordinatorConfigurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_GetCoordinator + /// + /// + /// + /// The name of the cluster configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _cosmosDBForPostgreSqlCoordinatorConfigurationConfigurationsClientDiagnostics.CreateScope("CosmosDBForPostgreSqlCoordinatorConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlCoordinatorConfigurationConfigurationsRestClient.GetCoordinator(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlCoordinatorConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleCollection.cs index e7c0f58657d1..209bf8793c3b 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the cluster firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _cosmosDBForPostgreSqlFirewallRuleFirewallRulesClientDiagnostics.CreateScope("CosmosDBForPostgreSqlFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlFirewallRuleResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the cluster firewall rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _cosmosDBForPostgreSqlFirewallRuleFirewallRulesClientDiagnostics.CreateScope("CosmosDBForPostgreSqlFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlNodeConfigurationCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlNodeConfigurationCollection.cs index e3d49b79df03..8ffcf9f541c6 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlNodeConfigurationCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlNodeConfigurationCollection.cs @@ -275,5 +275,79 @@ public virtual Response Exists(string configurationName, CancellationToken throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/nodeConfigurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_GetNode + /// + /// + /// + /// The name of the cluster configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _cosmosDBForPostgreSqlNodeConfigurationConfigurationsClientDiagnostics.CreateScope("CosmosDBForPostgreSqlNodeConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlNodeConfigurationConfigurationsRestClient.GetNodeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlNodeConfigurationResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName}/nodeConfigurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_GetNode + /// + /// + /// + /// The name of the cluster configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _cosmosDBForPostgreSqlNodeConfigurationConfigurationsClientDiagnostics.CreateScope("CosmosDBForPostgreSqlNodeConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlNodeConfigurationConfigurationsRestClient.GetNode(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlNodeConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs index e1eab92420da..04f103cfeb02 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlPrivateEndpointConnectionResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The name of the private endpoint connection associated with the cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs index 53a6df12ed2f..647033cd6690 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs @@ -239,6 +239,80 @@ public virtual Response Exists(string privateLinkResourceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link 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 privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("CosmosDBForPostgreSqlPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlPrivateLinkResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The name of the private link resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("CosmosDBForPostgreSqlPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleCollection.cs index 19cbc988c705..dd0a2901aa62 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleCollection.cs @@ -321,6 +321,80 @@ public virtual Response Exists(string roleName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/roles/{roleName} + /// + /// + /// Operation Id + /// Roles_Get + /// + /// + /// + /// The name of the cluster role. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string roleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); + + using var scope = _cosmosDBForPostgreSqlRoleRolesClientDiagnostics.CreateScope("CosmosDBForPostgreSqlRoleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _cosmosDBForPostgreSqlRoleRolesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlRoleResource(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.DBforPostgreSQL/serverGroupsv2/{clusterName}/roles/{roleName} + /// + /// + /// Operation Id + /// Roles_Get + /// + /// + /// + /// The name of the cluster role. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string roleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); + + using var scope = _cosmosDBForPostgreSqlRoleRolesClientDiagnostics.CreateScope("CosmosDBForPostgreSqlRoleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _cosmosDBForPostgreSqlRoleRolesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CosmosDBForPostgreSqlRoleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementAlertCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementAlertCollection.cs index f17265b95d03..cb584a726310 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementAlertCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementAlertCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -314,6 +315,46 @@ public async Task Exists_SingleResourceGroupAlerts() Console.WriteLine($"Succeeded: {result}"); } + // SingleResourceGroupAlerts + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SingleResourceGroupAlerts() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleResourceGroupAlert.json + // this example is just showing the usage of "Alerts_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementAlertResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementAlertCollection collection = client.GetCostManagementAlerts(scopeId); + + // invoke the operation + string alertId = "22222222-2222-2222-2222-222222222222"; + NullableResponse response = await collection.GetIfExistsAsync(alertId); + CostManagementAlertResource 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 + CostManagementAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SingleSubscriptionAlerts [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -373,5 +414,45 @@ public async Task Exists_SingleSubscriptionAlerts() Console.WriteLine($"Succeeded: {result}"); } + + // SingleSubscriptionAlerts + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SingleSubscriptionAlerts() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleSubscriptionAlert.json + // this example is just showing the usage of "Alerts_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementAlertResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementAlertCollection collection = client.GetCostManagementAlerts(scopeId); + + // invoke the operation + string alertId = "22222222-2222-2222-2222-222222222222"; + NullableResponse response = await collection.GetIfExistsAsync(alertId); + CostManagementAlertResource 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 + CostManagementAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementExportCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementExportCollection.cs index c5c1b2200a87..0fced816994d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementExportCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementExportCollection.cs @@ -282,6 +282,46 @@ public async Task Exists_ExportGetByBillingAccount() Console.WriteLine($"Succeeded: {result}"); } + // ExportGetByBillingAccount + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExportGetByBillingAccount() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByBillingAccount.json + // this example is just showing the usage of "Exports_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementExportCollection collection = client.GetCostManagementExports(scopeId); + + // invoke the operation + string exportName = "TestExport"; + NullableResponse response = await collection.GetIfExistsAsync(exportName); + CostManagementExportResource 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 + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExportGetByDepartment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -342,6 +382,46 @@ public async Task Exists_ExportGetByDepartment() Console.WriteLine($"Succeeded: {result}"); } + // ExportGetByDepartment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExportGetByDepartment() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByDepartment.json + // this example is just showing the usage of "Exports_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/12/departments/1234"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementExportCollection collection = client.GetCostManagementExports(scopeId); + + // invoke the operation + string exportName = "TestExport"; + NullableResponse response = await collection.GetIfExistsAsync(exportName); + CostManagementExportResource 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 + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExportGetByEnrollmentAccount [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -402,6 +482,46 @@ public async Task Exists_ExportGetByEnrollmentAccount() Console.WriteLine($"Succeeded: {result}"); } + // ExportGetByEnrollmentAccount + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExportGetByEnrollmentAccount() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByEnrollmentAccount.json + // this example is just showing the usage of "Exports_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementExportCollection collection = client.GetCostManagementExports(scopeId); + + // invoke the operation + string exportName = "TestExport"; + NullableResponse response = await collection.GetIfExistsAsync(exportName); + CostManagementExportResource 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 + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExportGetByManagementGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -462,6 +582,46 @@ public async Task Exists_ExportGetByManagementGroup() Console.WriteLine($"Succeeded: {result}"); } + // ExportGetByManagementGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExportGetByManagementGroup() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByManagementGroup.json + // this example is just showing the usage of "Exports_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Management/managementGroups/TestMG"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementExportCollection collection = client.GetCostManagementExports(scopeId); + + // invoke the operation + string exportName = "TestExport"; + NullableResponse response = await collection.GetIfExistsAsync(exportName); + CostManagementExportResource 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 + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExportGetByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -522,6 +682,46 @@ public async Task Exists_ExportGetByResourceGroup() Console.WriteLine($"Succeeded: {result}"); } + // ExportGetByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExportGetByResourceGroup() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByResourceGroup.json + // this example is just showing the usage of "Exports_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementExportResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementExportCollection collection = client.GetCostManagementExports(scopeId); + + // invoke the operation + string exportName = "TestExport"; + NullableResponse response = await collection.GetIfExistsAsync(exportName); + CostManagementExportResource 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 + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExportGetBySubscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -582,6 +782,46 @@ public async Task Exists_ExportGetBySubscription() Console.WriteLine($"Succeeded: {result}"); } + // ExportGetBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ExportGetBySubscription() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetBySubscription.json + // this example is just showing the usage of "Exports_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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementExportResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementExportCollection collection = client.GetCostManagementExports(scopeId); + + // invoke the operation + string exportName = "TestExport"; + NullableResponse response = await collection.GetIfExistsAsync(exportName); + CostManagementExportResource 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 + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ExportCreateOrUpdateByBillingAccount [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementViewsCollection.cs index 396fd4f90181..24ec4a0b8b6a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_CostManagementViewsCollection.cs @@ -112,6 +112,46 @@ public async Task Exists_ResourceGroupView() Console.WriteLine($"Succeeded: {result}"); } + // ResourceGroupView + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ResourceGroupView() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewByResourceGroup.json + // this example is just showing the usage of "Views_GetByScope" 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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this CostManagementViewsResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + CostManagementViewsCollection collection = client.GetAllCostManagementViews(scopeId); + + // invoke the operation + string viewName = "swaggerExample"; + NullableResponse response = await collection.GetIfExistsAsync(viewName); + CostManagementViewsResource 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 + CostManagementViewData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ResourceGroupCreateOrUpdateView [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_ScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_ScheduledActionCollection.cs index e2af595b5d4e..6145fac16113 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_ScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_ScheduledActionCollection.cs @@ -253,5 +253,45 @@ public async Task Exists_ScheduledActionByScope() Console.WriteLine($"Succeeded: {result}"); } + + // ScheduledActionByScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ScheduledActionByScope() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-shared.json + // this example is just showing the usage of "ScheduledActions_GetByScope" 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 ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this ScheduledActionResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + ScheduledActionCollection collection = client.GetScheduledActions(scopeId); + + // invoke the operation + string name = "monthlyCostByResource"; + NullableResponse response = await collection.GetIfExistsAsync(name); + ScheduledActionResource 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 + ScheduledActionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_TenantScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_TenantScheduledActionCollection.cs index 660e2620f57e..98e043651988 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_TenantScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_TenantScheduledActionCollection.cs @@ -131,5 +131,44 @@ public async Task Exists_PrivateScheduledAction() Console.WriteLine($"Succeeded: {result}"); } + + // PrivateScheduledAction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateScheduledAction() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-private.json + // this example is just showing the usage of "ScheduledActions_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantScheduledActionResource + TenantScheduledActionCollection collection = tenantResource.GetTenantScheduledActions(); + + // invoke the operation + string name = "monthlyCostByResource"; + NullableResponse response = await collection.GetIfExistsAsync(name); + TenantScheduledActionResource 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 + ScheduledActionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_TenantsCostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_TenantsCostManagementViewsCollection.cs index c1f11e9f289d..091f3ede2a90 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_TenantsCostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/samples/Generated/Samples/Sample_TenantsCostManagementViewsCollection.cs @@ -76,6 +76,45 @@ public async Task Exists_PrivateView() Console.WriteLine($"Succeeded: {result}"); } + // PrivateView + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PrivateView() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateView.json + // this example is just showing the usage of "Views_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantsCostManagementViewsResource + TenantsCostManagementViewsCollection collection = tenantResource.GetAllTenantsCostManagementViews(); + + // invoke the operation + string viewName = "swaggerExample"; + NullableResponse response = await collection.GetIfExistsAsync(viewName); + TenantsCostManagementViewsResource 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 + CostManagementViewData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // CreateOrUpdatePrivateView [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs index 5217b40e438e..1454794a6a69 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs @@ -225,6 +225,78 @@ public virtual Response Exists(string alertId, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} + /// + /// + /// Operation Id + /// Alerts_Get + /// + /// + /// + /// Alert ID. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetIfExistsAsync(string alertId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(alertId, nameof(alertId)); + + using var scope = _costManagementAlertAlertsClientDiagnostics.CreateScope("CostManagementAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _costManagementAlertAlertsRestClient.GetAsync(Id, alertId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CostManagementAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} + /// + /// + /// Operation Id + /// Alerts_Get + /// + /// + /// + /// Alert ID. + /// The cancellation token to use. + /// is null. + public virtual NullableResponse GetIfExists(string alertId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(alertId, nameof(alertId)); + + using var scope = _costManagementAlertAlertsClientDiagnostics.CreateScope("CostManagementAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _costManagementAlertAlertsRestClient.Get(Id, alertId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CostManagementAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs index bb132e74f1e8..cccd2ff950eb 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs @@ -317,6 +317,82 @@ public virtual Response Exists(string exportName, string expand = null, Ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} + /// + /// + /// Operation Id + /// Exports_Get + /// + /// + /// + /// Export Name. + /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string exportName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(exportName, nameof(exportName)); + + using var scope = _costManagementExportExportsClientDiagnostics.CreateScope("CostManagementExportCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _costManagementExportExportsRestClient.GetAsync(Id, exportName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CostManagementExportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} + /// + /// + /// Operation Id + /// Exports_Get + /// + /// + /// + /// Export Name. + /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string exportName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(exportName, nameof(exportName)); + + using var scope = _costManagementExportExportsClientDiagnostics.CreateScope("CostManagementExportCollection.GetIfExists"); + scope.Start(); + try + { + var response = _costManagementExportExportsRestClient.Get(Id, exportName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CostManagementExportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs index 4e54499e7a53..b11e50e289fd 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs @@ -313,6 +313,80 @@ public virtual Response Exists(string viewName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_GetByScope + /// + /// + /// + /// View name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string viewName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); + + using var scope = _costManagementViewsViewsClientDiagnostics.CreateScope("CostManagementViewsCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _costManagementViewsViewsRestClient.GetByScopeAsync(Id, viewName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CostManagementViewsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_GetByScope + /// + /// + /// + /// View name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string viewName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); + + using var scope = _costManagementViewsViewsClientDiagnostics.CreateScope("CostManagementViewsCollection.GetIfExists"); + scope.Start(); + try + { + var response = _costManagementViewsViewsRestClient.GetByScope(Id, viewName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CostManagementViewsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs index 830fd899b06f..aaf31accb8f9 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs @@ -317,6 +317,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_GetByScope + /// + /// + /// + /// Scheduled action name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _scheduledActionClientDiagnostics.CreateScope("ScheduledActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scheduledActionRestClient.GetByScopeAsync(Id, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScheduledActionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_GetByScope + /// + /// + /// + /// Scheduled action name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _scheduledActionClientDiagnostics.CreateScope("ScheduledActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scheduledActionRestClient.GetByScope(Id, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ScheduledActionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionCollection.cs index d864d9643d10..b76e62ae66bc 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionCollection.cs @@ -278,5 +278,79 @@ public virtual Response Exists(string name, CancellationToken cancellation throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_Get + /// + /// + /// + /// Scheduled action name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _tenantScheduledActionScheduledActionsClientDiagnostics.CreateScope("TenantScheduledActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantScheduledActionScheduledActionsRestClient.GetAsync(name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantScheduledActionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_Get + /// + /// + /// + /// Scheduled action name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _tenantScheduledActionScheduledActionsClientDiagnostics.CreateScope("TenantScheduledActionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantScheduledActionScheduledActionsRestClient.Get(name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantScheduledActionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsCollection.cs index 61c3a430da33..e0827527dfb6 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsCollection.cs @@ -276,5 +276,79 @@ public virtual Response Exists(string viewName, CancellationToken cancella throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_Get + /// + /// + /// + /// View name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string viewName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); + + using var scope = _tenantsCostManagementViewsViewsClientDiagnostics.CreateScope("TenantsCostManagementViewsCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _tenantsCostManagementViewsViewsRestClient.GetAsync(viewName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantsCostManagementViewsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_Get + /// + /// + /// + /// View name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string viewName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); + + using var scope = _tenantsCostManagementViewsViewsClientDiagnostics.CreateScope("TenantsCostManagementViewsCollection.GetIfExists"); + scope.Start(); + try + { + var response = _tenantsCostManagementViewsViewsRestClient.Get(viewName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TenantsCostManagementViewsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_AuthorizationPolicyResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_AuthorizationPolicyResourceFormatCollection.cs index 1c2c7dd4f8e8..4443c436206f 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_AuthorizationPolicyResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_AuthorizationPolicyResourceFormatCollection.cs @@ -127,6 +127,49 @@ public async Task Exists_AuthorizationPoliciesGet() Console.WriteLine($"Succeeded: {result}"); } + // AuthorizationPolicies_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AuthorizationPoliciesGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/AuthorizationPoliciesGet.json + // this example is just showing the usage of "AuthorizationPolicies_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "azSdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this AuthorizationPolicyResourceFormatResource + AuthorizationPolicyResourceFormatCollection collection = hub.GetAuthorizationPolicyResourceFormats(); + + // invoke the operation + string authorizationPolicyName = "testPolicy4222"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationPolicyName); + AuthorizationPolicyResourceFormatResource 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 + AuthorizationPolicyResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // AuthorizationPolicies_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ConnectorMappingResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ConnectorMappingResourceFormatCollection.cs index adc109381451..385bf6519a67 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ConnectorMappingResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ConnectorMappingResourceFormatCollection.cs @@ -158,6 +158,50 @@ public async Task Exists_ConnectorMappingsGet() Console.WriteLine($"Succeeded: {result}"); } + // ConnectorMappings_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConnectorMappingsGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/ConnectorMappingsGet.json + // this example is just showing the usage of "ConnectorMappings_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 ConnectorResourceFormatResource created on azure + // for more information of creating ConnectorResourceFormatResource, please refer to the document of ConnectorResourceFormatResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + string connectorName = "testConnector8858"; + ResourceIdentifier connectorResourceFormatResourceId = ConnectorResourceFormatResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName, connectorName); + ConnectorResourceFormatResource connectorResourceFormat = client.GetConnectorResourceFormatResource(connectorResourceFormatResourceId); + + // get the collection of this ConnectorMappingResourceFormatResource + ConnectorMappingResourceFormatCollection collection = connectorResourceFormat.GetConnectorMappingResourceFormats(); + + // invoke the operation + string mappingName = "testMapping12491"; + NullableResponse response = await collection.GetIfExistsAsync(mappingName); + ConnectorMappingResourceFormatResource 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 + ConnectorMappingResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ConnectorMappings_ListByConnector [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ConnectorResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ConnectorResourceFormatCollection.cs index 62e5acb4daef..2bb75bf31e05 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ConnectorResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ConnectorResourceFormatCollection.cs @@ -134,6 +134,49 @@ public async Task Exists_ConnectorsGet() Console.WriteLine($"Succeeded: {result}"); } + // Connectors_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConnectorsGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/ConnectorsGet.json + // this example is just showing the usage of "Connectors_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this ConnectorResourceFormatResource + ConnectorResourceFormatCollection collection = hub.GetConnectorResourceFormats(); + + // invoke the operation + string connectorName = "testConnector"; + NullableResponse response = await collection.GetIfExistsAsync(connectorName); + ConnectorResourceFormatResource 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 + ConnectorResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Connectors_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_HubCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_HubCollection.cs index 301dfbe87087..cb4a60d7839c 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_HubCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_HubCollection.cs @@ -127,6 +127,48 @@ public async Task Exists_HubsGet() Console.WriteLine($"Succeeded: {result}"); } + // Hubs_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HubsGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/HubsGet.json + // this example is just showing the usage of "Hubs_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 = "subid"; + string resourceGroupName = "TestHubRG"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this HubResource + HubCollection collection = resourceGroupResource.GetHubs(); + + // invoke the operation + string hubName = "sdkTestHub"; + NullableResponse response = await collection.GetIfExistsAsync(hubName); + HubResource 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 + HubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Hubs_ListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_InteractionResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_InteractionResourceFormatCollection.cs index 59073d71d9ea..ca4bacbf6d4b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_InteractionResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_InteractionResourceFormatCollection.cs @@ -140,6 +140,49 @@ public async Task Exists_InteractionsGet() Console.WriteLine($"Succeeded: {result}"); } + // Interactions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_InteractionsGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/InteractionsGet.json + // this example is just showing the usage of "Interactions_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this InteractionResourceFormatResource + InteractionResourceFormatCollection collection = hub.GetInteractionResourceFormats(); + + // invoke the operation + string interactionName = "TestInteractionType6358"; + NullableResponse response = await collection.GetIfExistsAsync(interactionName); + InteractionResourceFormatResource 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 + InteractionResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Interactions_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_KpiResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_KpiResourceFormatCollection.cs index 5ab627363e67..1bc19e017107 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_KpiResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_KpiResourceFormatCollection.cs @@ -146,6 +146,49 @@ public async Task Exists_KpiGet() Console.WriteLine($"Succeeded: {result}"); } + // Kpi_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_KpiGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/KpiGet.json + // this example is just showing the usage of "Kpi_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this KpiResourceFormatResource + KpiResourceFormatCollection collection = hub.GetKpiResourceFormats(); + + // invoke the operation + string kpiName = "kpiTest45453647"; + NullableResponse response = await collection.GetIfExistsAsync(kpiName); + KpiResourceFormatResource 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 + KpiResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Kpi_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_LinkResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_LinkResourceFormatCollection.cs index 6d3df1400d21..923bea8cd161 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_LinkResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_LinkResourceFormatCollection.cs @@ -146,6 +146,49 @@ public async Task Exists_LinksGet() Console.WriteLine($"Succeeded: {result}"); } + // Links_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LinksGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/LinksGet.json + // this example is just showing the usage of "Links_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this LinkResourceFormatResource + LinkResourceFormatCollection collection = hub.GetLinkResourceFormats(); + + // invoke the operation + string linkName = "linkTest4806"; + NullableResponse response = await collection.GetIfExistsAsync(linkName); + LinkResourceFormatResource 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 + LinkResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Links_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_PredictionResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_PredictionResourceFormatCollection.cs index f69f799ced5f..99a58abfa946 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_PredictionResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_PredictionResourceFormatCollection.cs @@ -151,6 +151,49 @@ public async Task Exists_PredictionsGet() Console.WriteLine($"Succeeded: {result}"); } + // Predictions_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PredictionsGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/PredictionsGet.json + // this example is just showing the usage of "Predictions_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "c909e979-ef71-4def-a970-bc7c154db8c5"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this PredictionResourceFormatResource + PredictionResourceFormatCollection collection = hub.GetPredictionResourceFormats(); + + // invoke the operation + string predictionName = "sdktest"; + NullableResponse response = await collection.GetIfExistsAsync(predictionName); + PredictionResourceFormatResource 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 + PredictionResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Predictions_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ProfileResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ProfileResourceFormatCollection.cs index 9042e76efcca..b2572d404230 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ProfileResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ProfileResourceFormatCollection.cs @@ -162,6 +162,49 @@ public async Task Exists_ProfilesGet() Console.WriteLine($"Succeeded: {result}"); } + // Profiles_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProfilesGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/ProfilesGet.json + // this example is just showing the usage of "Profiles_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this ProfileResourceFormatResource + ProfileResourceFormatCollection collection = hub.GetProfileResourceFormats(); + + // invoke the operation + string profileName = "TestProfileType396"; + NullableResponse response = await collection.GetIfExistsAsync(profileName); + ProfileResourceFormatResource 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 + ProfileResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Profiles_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RelationshipLinkResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RelationshipLinkResourceFormatCollection.cs index 5e17ae9c537a..8af6164c8eb6 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RelationshipLinkResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RelationshipLinkResourceFormatCollection.cs @@ -141,6 +141,49 @@ public async Task Exists_RelationshipLinksGet() Console.WriteLine($"Succeeded: {result}"); } + // RelationshipLinks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RelationshipLinksGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/RelationshipLinksGet.json + // this example is just showing the usage of "RelationshipLinks_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this RelationshipLinkResourceFormatResource + RelationshipLinkResourceFormatCollection collection = hub.GetRelationshipLinkResourceFormats(); + + // invoke the operation + string relationshipLinkName = "Somelink"; + NullableResponse response = await collection.GetIfExistsAsync(relationshipLinkName); + RelationshipLinkResourceFormatResource 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 + RelationshipLinkResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RelationshipLinks_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RelationshipResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RelationshipResourceFormatCollection.cs index 3f7811a0a624..cf1ae244882a 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RelationshipResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RelationshipResourceFormatCollection.cs @@ -137,6 +137,49 @@ public async Task Exists_RelationshipsGet() Console.WriteLine($"Succeeded: {result}"); } + // Relationships_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RelationshipsGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/RelationshipsGet.json + // this example is just showing the usage of "Relationships_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this RelationshipResourceFormatResource + RelationshipResourceFormatCollection collection = hub.GetRelationshipResourceFormats(); + + // invoke the operation + string relationshipName = "SomeRelationship"; + NullableResponse response = await collection.GetIfExistsAsync(relationshipName); + RelationshipResourceFormatResource 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 + RelationshipResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Relationships_ListByHub [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RoleAssignmentResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RoleAssignmentResourceFormatCollection.cs index e52eb019b669..ece39ba99fee 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RoleAssignmentResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_RoleAssignmentResourceFormatCollection.cs @@ -164,5 +164,48 @@ public async Task Exists_RoleAssignmentsGet() Console.WriteLine($"Succeeded: {result}"); } + + // RoleAssignments_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RoleAssignmentsGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/RoleAssignmentsGet.json + // this example is just showing the usage of "RoleAssignments_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this RoleAssignmentResourceFormatResource + RoleAssignmentResourceFormatCollection collection = hub.GetRoleAssignmentResourceFormats(); + + // invoke the operation + string assignmentName = "assignmentName8976"; + NullableResponse response = await collection.GetIfExistsAsync(assignmentName); + RoleAssignmentResourceFormatResource 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 + RoleAssignmentResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ViewResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ViewResourceFormatCollection.cs index f607649fbd2e..71929102952f 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ViewResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_ViewResourceFormatCollection.cs @@ -167,5 +167,49 @@ public async Task Exists_ViewsGet() Console.WriteLine($"Succeeded: {result}"); } + + // Views_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ViewsGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/ViewsGet.json + // this example is just showing the usage of "Views_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this ViewResourceFormatResource + ViewResourceFormatCollection collection = hub.GetViewResourceFormats(); + + // invoke the operation + string viewName = "testView"; + string userId = "*"; + NullableResponse response = await collection.GetIfExistsAsync(viewName, userId); + ViewResourceFormatResource 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 + ViewResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_WidgetTypeResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_WidgetTypeResourceFormatCollection.cs index 3bc046e85090..c39c6cff4693 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_WidgetTypeResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/samples/Generated/Samples/Sample_WidgetTypeResourceFormatCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_WidgetTypesGet() Console.WriteLine($"Succeeded: {result}"); } + + // WidgetTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_WidgetTypesGet() + { + // Generated from example definition: specification/customer-insights/resource-manager/Microsoft.CustomerInsights/stable/2017-04-26/examples/WidgetTypesGet.json + // this example is just showing the usage of "WidgetTypes_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 HubResource created on azure + // for more information of creating HubResource, please refer to the document of HubResource + string subscriptionId = "subid"; + string resourceGroupName = "TestHubRG"; + string hubName = "sdkTestHub"; + ResourceIdentifier hubResourceId = HubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hubName); + HubResource hub = client.GetHubResource(hubResourceId); + + // get the collection of this WidgetTypeResourceFormatResource + WidgetTypeResourceFormatCollection collection = hub.GetWidgetTypeResourceFormats(); + + // invoke the operation + string widgetTypeName = "ActivityGauge"; + NullableResponse response = await collection.GetIfExistsAsync(widgetTypeName); + WidgetTypeResourceFormatResource 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 + WidgetTypeResourceFormatData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatCollection.cs index 95bc1276e9b9..aafd8e604a38 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string authorizationPolicyName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName} + /// + /// + /// Operation Id + /// AuthorizationPolicies_Get + /// + /// + /// + /// The name of the policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationPolicyName, nameof(authorizationPolicyName)); + + using var scope = _authorizationPolicyResourceFormatAuthorizationPoliciesClientDiagnostics.CreateScope("AuthorizationPolicyResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _authorizationPolicyResourceFormatAuthorizationPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationPolicyResourceFormatResource(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.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName} + /// + /// + /// Operation Id + /// AuthorizationPolicies_Get + /// + /// + /// + /// The name of the policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationPolicyName, nameof(authorizationPolicyName)); + + using var scope = _authorizationPolicyResourceFormatAuthorizationPoliciesClientDiagnostics.CreateScope("AuthorizationPolicyResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _authorizationPolicyResourceFormatAuthorizationPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationPolicyResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatCollection.cs index f8513e056109..755a2149117d 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string mappingName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName} + /// + /// + /// Operation Id + /// ConnectorMappings_Get + /// + /// + /// + /// The name of the connector mapping. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string mappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mappingName, nameof(mappingName)); + + using var scope = _connectorMappingResourceFormatConnectorMappingsClientDiagnostics.CreateScope("ConnectorMappingResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _connectorMappingResourceFormatConnectorMappingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, mappingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectorMappingResourceFormatResource(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.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName} + /// + /// + /// Operation Id + /// ConnectorMappings_Get + /// + /// + /// + /// The name of the connector mapping. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string mappingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(mappingName, nameof(mappingName)); + + using var scope = _connectorMappingResourceFormatConnectorMappingsClientDiagnostics.CreateScope("ConnectorMappingResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _connectorMappingResourceFormatConnectorMappingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, mappingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectorMappingResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatCollection.cs index d3012224f20b..4319727cd12c 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string connectorName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connectors_Get + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorResourceFormatConnectorsClientDiagnostics.CreateScope("ConnectorResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _connectorResourceFormatConnectorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectorResourceFormatResource(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.CustomerInsights/hubs/{hubName}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connectors_Get + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorResourceFormatConnectorsClientDiagnostics.CreateScope("ConnectorResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _connectorResourceFormatConnectorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectorResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubCollection.cs index e4d9efbed699..3a36ba68c2af 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string hubName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName} + /// + /// + /// Operation Id + /// Hubs_Get + /// + /// + /// + /// The name of the hub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hubName, nameof(hubName)); + + using var scope = _hubClientDiagnostics.CreateScope("HubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, hubName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HubResource(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.CustomerInsights/hubs/{hubName} + /// + /// + /// Operation Id + /// Hubs_Get + /// + /// + /// + /// The name of the hub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hubName, nameof(hubName)); + + using var scope = _hubClientDiagnostics.CreateScope("HubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, hubName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatCollection.cs index 957ea7f94f60..d76cff7647bc 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string interactionName, string localeCode = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions/{interactionName} + /// + /// + /// Operation Id + /// Interactions_Get + /// + /// + /// + /// The name of the interaction. + /// Locale of interaction to retrieve, default is en-us. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string interactionName, string localeCode = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(interactionName, nameof(interactionName)); + + using var scope = _interactionResourceFormatInteractionsClientDiagnostics.CreateScope("InteractionResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _interactionResourceFormatInteractionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, interactionName, localeCode, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InteractionResourceFormatResource(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.CustomerInsights/hubs/{hubName}/interactions/{interactionName} + /// + /// + /// Operation Id + /// Interactions_Get + /// + /// + /// + /// The name of the interaction. + /// Locale of interaction to retrieve, default is en-us. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string interactionName, string localeCode = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(interactionName, nameof(interactionName)); + + using var scope = _interactionResourceFormatInteractionsClientDiagnostics.CreateScope("InteractionResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _interactionResourceFormatInteractionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, interactionName, localeCode, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InteractionResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatCollection.cs index 0b256742c72e..12bd17e02f4d 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string kpiName, CancellationToken cancellat } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName} + /// + /// + /// Operation Id + /// Kpi_Get + /// + /// + /// + /// The name of the KPI. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string kpiName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(kpiName, nameof(kpiName)); + + using var scope = _kpiResourceFormatKpiClientDiagnostics.CreateScope("KpiResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _kpiResourceFormatKpiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, kpiName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KpiResourceFormatResource(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.CustomerInsights/hubs/{hubName}/kpi/{kpiName} + /// + /// + /// Operation Id + /// Kpi_Get + /// + /// + /// + /// The name of the KPI. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string kpiName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(kpiName, nameof(kpiName)); + + using var scope = _kpiResourceFormatKpiClientDiagnostics.CreateScope("KpiResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _kpiResourceFormatKpiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, kpiName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KpiResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatCollection.cs index 04367b3cdc32..730cfc6a94dd 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string linkName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links/{linkName} + /// + /// + /// Operation Id + /// Links_Get + /// + /// + /// + /// The name of the link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string linkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkName, nameof(linkName)); + + using var scope = _linkResourceFormatLinksClientDiagnostics.CreateScope("LinkResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _linkResourceFormatLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LinkResourceFormatResource(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.CustomerInsights/hubs/{hubName}/links/{linkName} + /// + /// + /// Operation Id + /// Links_Get + /// + /// + /// + /// The name of the link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkName, nameof(linkName)); + + using var scope = _linkResourceFormatLinksClientDiagnostics.CreateScope("LinkResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _linkResourceFormatLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LinkResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatCollection.cs index b3a74e91c8d4..2ec1f8e2302e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string predictionName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions/{predictionName} + /// + /// + /// Operation Id + /// Predictions_Get + /// + /// + /// + /// The name of the Prediction. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string predictionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(predictionName, nameof(predictionName)); + + using var scope = _predictionResourceFormatPredictionsClientDiagnostics.CreateScope("PredictionResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _predictionResourceFormatPredictionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, predictionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PredictionResourceFormatResource(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.CustomerInsights/hubs/{hubName}/predictions/{predictionName} + /// + /// + /// Operation Id + /// Predictions_Get + /// + /// + /// + /// The name of the Prediction. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string predictionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(predictionName, nameof(predictionName)); + + using var scope = _predictionResourceFormatPredictionsClientDiagnostics.CreateScope("PredictionResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _predictionResourceFormatPredictionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, predictionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PredictionResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatCollection.cs index 29c5184d4f5a..ab9e1e67bc57 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string profileName, string localeCode = nul } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// The name of the profile. + /// Locale of profile to retrieve, default is en-us. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string profileName, string localeCode = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); + + using var scope = _profileResourceFormatProfilesClientDiagnostics.CreateScope("ProfileResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _profileResourceFormatProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, profileName, localeCode, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProfileResourceFormatResource(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.CustomerInsights/hubs/{hubName}/profiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// The name of the profile. + /// Locale of profile to retrieve, default is en-us. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string profileName, string localeCode = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); + + using var scope = _profileResourceFormatProfilesClientDiagnostics.CreateScope("ProfileResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _profileResourceFormatProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, profileName, localeCode, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProfileResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatCollection.cs index ca0b179c800f..2ea00ab5838e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string relationshipLinkName, CancellationTo } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName} + /// + /// + /// Operation Id + /// RelationshipLinks_Get + /// + /// + /// + /// The name of the relationship link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string relationshipLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(relationshipLinkName, nameof(relationshipLinkName)); + + using var scope = _relationshipLinkResourceFormatRelationshipLinksClientDiagnostics.CreateScope("RelationshipLinkResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _relationshipLinkResourceFormatRelationshipLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, relationshipLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelationshipLinkResourceFormatResource(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.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName} + /// + /// + /// Operation Id + /// RelationshipLinks_Get + /// + /// + /// + /// The name of the relationship link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string relationshipLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(relationshipLinkName, nameof(relationshipLinkName)); + + using var scope = _relationshipLinkResourceFormatRelationshipLinksClientDiagnostics.CreateScope("RelationshipLinkResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _relationshipLinkResourceFormatRelationshipLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, relationshipLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelationshipLinkResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatCollection.cs index 4f85bea60313..29d9ec44eb91 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string relationshipName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName} + /// + /// + /// Operation Id + /// Relationships_Get + /// + /// + /// + /// The name of the relationship. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string relationshipName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(relationshipName, nameof(relationshipName)); + + using var scope = _relationshipResourceFormatRelationshipsClientDiagnostics.CreateScope("RelationshipResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _relationshipResourceFormatRelationshipsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, relationshipName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelationshipResourceFormatResource(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.CustomerInsights/hubs/{hubName}/relationships/{relationshipName} + /// + /// + /// Operation Id + /// Relationships_Get + /// + /// + /// + /// The name of the relationship. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string relationshipName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(relationshipName, nameof(relationshipName)); + + using var scope = _relationshipResourceFormatRelationshipsClientDiagnostics.CreateScope("RelationshipResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _relationshipResourceFormatRelationshipsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, relationshipName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RelationshipResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatCollection.cs index e1cc8e37e53a..9048d6e4c13e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string assignmentName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// The name of the role assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string assignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assignmentName, nameof(assignmentName)); + + using var scope = _roleAssignmentResourceFormatRoleAssignmentsClientDiagnostics.CreateScope("RoleAssignmentResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _roleAssignmentResourceFormatRoleAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, assignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentResourceFormatResource(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.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// The name of the role assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string assignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assignmentName, nameof(assignmentName)); + + using var scope = _roleAssignmentResourceFormatRoleAssignmentsClientDiagnostics.CreateScope("RoleAssignmentResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _roleAssignmentResourceFormatRoleAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, assignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RoleAssignmentResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatCollection.cs index 08a9c33ed285..9a7e26ce13f2 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatCollection.cs @@ -336,5 +336,83 @@ public virtual Response Exists(string viewName, string userId, Cancellatio throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views/{viewName} + /// + /// + /// Operation Id + /// Views_Get + /// + /// + /// + /// The name of the view. + /// The user ID. Use * to retrieve hub level view. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string viewName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); + Argument.AssertNotNull(userId, nameof(userId)); + + using var scope = _viewResourceFormatViewsClientDiagnostics.CreateScope("ViewResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _viewResourceFormatViewsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, viewName, userId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ViewResourceFormatResource(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.CustomerInsights/hubs/{hubName}/views/{viewName} + /// + /// + /// Operation Id + /// Views_Get + /// + /// + /// + /// The name of the view. + /// The user ID. Use * to retrieve hub level view. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string viewName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); + Argument.AssertNotNull(userId, nameof(userId)); + + using var scope = _viewResourceFormatViewsClientDiagnostics.CreateScope("ViewResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _viewResourceFormatViewsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, viewName, userId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ViewResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatCollection.cs index 67002c7b6836..46f94d2c52a8 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string widgetTypeName, CancellationToken ca } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/widgetTypes/{widgetTypeName} + /// + /// + /// Operation Id + /// WidgetTypes_Get + /// + /// + /// + /// The name of the widget type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string widgetTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(widgetTypeName, nameof(widgetTypeName)); + + using var scope = _widgetTypeResourceFormatWidgetTypesClientDiagnostics.CreateScope("WidgetTypeResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _widgetTypeResourceFormatWidgetTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, widgetTypeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WidgetTypeResourceFormatResource(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.CustomerInsights/hubs/{hubName}/widgetTypes/{widgetTypeName} + /// + /// + /// Operation Id + /// WidgetTypes_Get + /// + /// + /// + /// The name of the widget type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string widgetTypeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(widgetTypeName, nameof(widgetTypeName)); + + using var scope = _widgetTypeResourceFormatWidgetTypesClientDiagnostics.CreateScope("WidgetTypeResourceFormatCollection.GetIfExists"); + scope.Start(); + try + { + var response = _widgetTypeResourceFormatWidgetTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, widgetTypeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WidgetTypeResourceFormatResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databox/Azure.ResourceManager.DataBox/samples/Generated/Samples/Sample_DataBoxJobCollection.cs b/sdk/databox/Azure.ResourceManager.DataBox/samples/Generated/Samples/Sample_DataBoxJobCollection.cs index 92356d87151e..b75090e0f6c4 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/samples/Generated/Samples/Sample_DataBoxJobCollection.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/samples/Generated/Samples/Sample_DataBoxJobCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_JobsGet() Console.WriteLine($"Succeeded: {result}"); } + // JobsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_JobsGet() + { + // Generated from example definition: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGet.json + // this example is just showing the usage of "Jobs_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 = "YourSubscriptionId"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataBoxJobResource + DataBoxJobCollection collection = resourceGroupResource.GetDataBoxJobs(); + + // invoke the operation + string jobName = "TestJobName1"; + string expand = "details"; + NullableResponse response = await collection.GetIfExistsAsync(jobName, expand: expand); + DataBoxJobResource 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 + DataBoxJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // JobsGetCmk [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -188,6 +231,49 @@ public async Task Exists_JobsGetCmk() Console.WriteLine($"Succeeded: {result}"); } + // JobsGetCmk + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_JobsGetCmk() + { + // Generated from example definition: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetCmk.json + // this example is just showing the usage of "Jobs_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 = "YourSubscriptionId"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataBoxJobResource + DataBoxJobCollection collection = resourceGroupResource.GetDataBoxJobs(); + + // invoke the operation + string jobName = "TestJobName1"; + string expand = "details"; + NullableResponse response = await collection.GetIfExistsAsync(jobName, expand: expand); + DataBoxJobResource 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 + DataBoxJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // JobsGetCopyStuck [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -254,6 +340,49 @@ public async Task Exists_JobsGetCopyStuck() Console.WriteLine($"Succeeded: {result}"); } + // JobsGetCopyStuck + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_JobsGetCopyStuck() + { + // Generated from example definition: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetCopyStuck.json + // this example is just showing the usage of "Jobs_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 = "YourSubscriptionId"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataBoxJobResource + DataBoxJobCollection collection = resourceGroupResource.GetDataBoxJobs(); + + // invoke the operation + string jobName = "TestJobName1"; + string expand = "details"; + NullableResponse response = await collection.GetIfExistsAsync(jobName, expand: expand); + DataBoxJobResource 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 + DataBoxJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // JobsGetExport [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -320,6 +449,49 @@ public async Task Exists_JobsGetExport() Console.WriteLine($"Succeeded: {result}"); } + // JobsGetExport + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_JobsGetExport() + { + // Generated from example definition: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetExport.json + // this example is just showing the usage of "Jobs_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 = "YourSubscriptionId"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataBoxJobResource + DataBoxJobCollection collection = resourceGroupResource.GetDataBoxJobs(); + + // invoke the operation + string jobName = "TestJobName1"; + string expand = "details"; + NullableResponse response = await collection.GetIfExistsAsync(jobName, expand: expand); + DataBoxJobResource 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 + DataBoxJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // JobsGetWaitingForAction [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -386,6 +558,49 @@ public async Task Exists_JobsGetWaitingForAction() Console.WriteLine($"Succeeded: {result}"); } + // JobsGetWaitingForAction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_JobsGetWaitingForAction() + { + // Generated from example definition: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetWaitingForAction.json + // this example is just showing the usage of "Jobs_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 = "YourSubscriptionId"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataBoxJobResource + DataBoxJobCollection collection = resourceGroupResource.GetDataBoxJobs(); + + // invoke the operation + string jobName = "TestJobName1"; + string expand = "details"; + NullableResponse response = await collection.GetIfExistsAsync(jobName, expand: expand); + DataBoxJobResource 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 + DataBoxJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // JobsCreate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobCollection.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobCollection.cs index a6c33eb91055..9829d801c12e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobCollection.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobCollection.cs @@ -330,6 +330,82 @@ public virtual Response Exists(string jobName, string expand = null, Cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string jobName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataBoxJobJobsClientDiagnostics.CreateScope("DataBoxJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxJobJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, jobName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxJobResource(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.DataBox/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string jobName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataBoxJobJobsClientDiagnostics.CreateScope("DataBoxJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxJobJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, jobName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_BandwidthScheduleCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_BandwidthScheduleCollection.cs index 4ef4cf12d6eb..b3002a5dbd07 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_BandwidthScheduleCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_BandwidthScheduleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_BandwidthScheduleGet() Console.WriteLine($"Succeeded: {result}"); } + // BandwidthScheduleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_BandwidthScheduleGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/BandwidthScheduleGet.json + // this example is just showing the usage of "BandwidthSchedules_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this BandwidthScheduleResource + BandwidthScheduleCollection collection = dataBoxEdgeDevice.GetBandwidthSchedules(); + + // invoke the operation + string name = "bandwidth-1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + BandwidthScheduleResource 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 + BandwidthScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // BandwidthSchedulePut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeAlertCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeAlertCollection.cs index 3b428816804e..a6432c7a6d41 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeAlertCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeAlertCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_AlertGet() Console.WriteLine($"Succeeded: {result}"); } + + // AlertGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_AlertGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/AlertGet.json + // this example is just showing the usage of "Alerts_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this DataBoxEdgeAlertResource + DataBoxEdgeAlertCollection collection = dataBoxEdgeDevice.GetDataBoxEdgeAlerts(); + + // invoke the operation + string name = "159a00c7-8543-4343-9435-263ac87df3bb"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DataBoxEdgeAlertResource 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 + DataBoxEdgeAlertData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeDeviceCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeDeviceCollection.cs index 09bba3712427..6555b084859b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeDeviceCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeDeviceCollection.cs @@ -119,6 +119,48 @@ public async Task Exists_DataBoxEdgeDeviceGetByName() Console.WriteLine($"Succeeded: {result}"); } + // DataBoxEdgeDeviceGetByName + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataBoxEdgeDeviceGetByName() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/DataBoxEdgeDeviceGetByName.json + // this example is just showing the usage of "Devices_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 = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataBoxEdgeDeviceResource + DataBoxEdgeDeviceCollection collection = resourceGroupResource.GetDataBoxEdgeDevices(); + + // invoke the operation + string deviceName = "testedgedevice"; + NullableResponse response = await collection.GetIfExistsAsync(deviceName); + DataBoxEdgeDeviceResource 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 + DataBoxEdgeDeviceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DataBoxEdgeDeviceGetByNameWithDataResidency [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -183,6 +225,48 @@ public async Task Exists_DataBoxEdgeDeviceGetByNameWithDataResidency() Console.WriteLine($"Succeeded: {result}"); } + // DataBoxEdgeDeviceGetByNameWithDataResidency + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataBoxEdgeDeviceGetByNameWithDataResidency() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/DataBoxEdgeDeviceGetByNameWithDataResidency.json + // this example is just showing the usage of "Devices_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 = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataBoxEdgeDeviceResource + DataBoxEdgeDeviceCollection collection = resourceGroupResource.GetDataBoxEdgeDevices(); + + // invoke the operation + string deviceName = "testedgedevice"; + NullableResponse response = await collection.GetIfExistsAsync(deviceName); + DataBoxEdgeDeviceResource 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 + DataBoxEdgeDeviceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DataBoxEdgeDevicePut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeJobCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeJobCollection.cs index 8add1e63a30b..39d1eb3d07dd 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeJobCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeJobCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -81,5 +82,48 @@ public async Task Exists_JobsGet() Console.WriteLine($"Succeeded: {result}"); } + + // JobsGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_JobsGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/JobsGet.json + // this example is just showing the usage of "Jobs_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this DataBoxEdgeJobResource + DataBoxEdgeJobCollection collection = dataBoxEdgeDevice.GetDataBoxEdgeJobs(); + + // invoke the operation + string name = "159a00c7-8543-4343-9435-263ac87df3bb"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DataBoxEdgeJobResource 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 + DataBoxEdgeJobData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeRoleAddonCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeRoleAddonCollection.cs index 27ed25c669cd..23665dce6a8c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeRoleAddonCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeRoleAddonCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_GetAddOns() Console.WriteLine($"Succeeded: {result}"); } + // GetAddOns + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAddOns() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/GetAddons.json + // this example is just showing the usage of "Addons_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 DataBoxEdgeRoleResource created on azure + // for more information of creating DataBoxEdgeRoleResource, please refer to the document of DataBoxEdgeRoleResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + string roleName = "KubernetesRole"; + ResourceIdentifier dataBoxEdgeRoleResourceId = DataBoxEdgeRoleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName, roleName); + DataBoxEdgeRoleResource dataBoxEdgeRole = client.GetDataBoxEdgeRoleResource(dataBoxEdgeRoleResourceId); + + // get the collection of this DataBoxEdgeRoleAddonResource + DataBoxEdgeRoleAddonCollection collection = dataBoxEdgeRole.GetDataBoxEdgeRoleAddons(); + + // invoke the operation + string addonName = "arcName"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + DataBoxEdgeRoleAddonResource 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 + DataBoxEdgeRoleAddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // PutAddOns [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeRoleCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeRoleCollection.cs index 4fe774bfcae4..a4ee7fc81311 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeRoleCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeRoleCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_RoleGet() Console.WriteLine($"Succeeded: {result}"); } + // RoleGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RoleGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/RoleGet.json + // this example is just showing the usage of "Roles_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this DataBoxEdgeRoleResource + DataBoxEdgeRoleCollection collection = dataBoxEdgeDevice.GetDataBoxEdgeRoles(); + + // invoke the operation + string name = "IoTRole1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DataBoxEdgeRoleResource 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 + DataBoxEdgeRoleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // RolePut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeShareCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeShareCollection.cs index d77029483c66..05c63f7a089f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeShareCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeShareCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_ShareGet() Console.WriteLine($"Succeeded: {result}"); } + // ShareGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ShareGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/ShareGet.json + // this example is just showing the usage of "Shares_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this DataBoxEdgeShareResource + DataBoxEdgeShareCollection collection = dataBoxEdgeDevice.GetDataBoxEdgeShares(); + + // invoke the operation + string name = "smbshare"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DataBoxEdgeShareResource 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 + DataBoxEdgeShareData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SharePut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageAccountCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageAccountCollection.cs index b65fe07ad670..2e2fe4deafac 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageAccountCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageAccountCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_StorageAccountGet() Console.WriteLine($"Succeeded: {result}"); } + // StorageAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_StorageAccountGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/StorageAccountGet.json + // this example is just showing the usage of "StorageAccounts_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this DataBoxEdgeStorageAccountResource + DataBoxEdgeStorageAccountCollection collection = dataBoxEdgeDevice.GetDataBoxEdgeStorageAccounts(); + + // invoke the operation + string storageAccountName = "blobstorageaccount1"; + NullableResponse response = await collection.GetIfExistsAsync(storageAccountName); + DataBoxEdgeStorageAccountResource 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 + DataBoxEdgeStorageAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // StorageAccountPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageAccountCredentialCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageAccountCredentialCollection.cs index 90459146a35f..01c19104c1b6 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageAccountCredentialCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageAccountCredentialCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_SACGet() Console.WriteLine($"Succeeded: {result}"); } + // SACGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SACGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/SACGet.json + // this example is just showing the usage of "StorageAccountCredentials_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this DataBoxEdgeStorageAccountCredentialResource + DataBoxEdgeStorageAccountCredentialCollection collection = dataBoxEdgeDevice.GetDataBoxEdgeStorageAccountCredentials(); + + // invoke the operation + string name = "sac1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DataBoxEdgeStorageAccountCredentialResource 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 + DataBoxEdgeStorageAccountCredentialData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // SACPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageContainerCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageContainerCollection.cs index 8b8808d8d7c2..ad83e0872fd8 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageContainerCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeStorageContainerCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_ContainerGet() Console.WriteLine($"Succeeded: {result}"); } + // ContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ContainerGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/ContainerGet.json + // this example is just showing the usage of "Containers_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 DataBoxEdgeStorageAccountResource created on azure + // for more information of creating DataBoxEdgeStorageAccountResource, please refer to the document of DataBoxEdgeStorageAccountResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + string storageAccountName = "storageaccount1"; + ResourceIdentifier dataBoxEdgeStorageAccountResourceId = DataBoxEdgeStorageAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName, storageAccountName); + DataBoxEdgeStorageAccountResource dataBoxEdgeStorageAccount = client.GetDataBoxEdgeStorageAccountResource(dataBoxEdgeStorageAccountResourceId); + + // get the collection of this DataBoxEdgeStorageContainerResource + DataBoxEdgeStorageContainerCollection collection = dataBoxEdgeStorageAccount.GetDataBoxEdgeStorageContainers(); + + // invoke the operation + string containerName = "blobcontainer1"; + NullableResponse response = await collection.GetIfExistsAsync(containerName); + DataBoxEdgeStorageContainerResource 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 + DataBoxEdgeStorageContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // ContainerPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeTriggerCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeTriggerCollection.cs index fda721a64b50..b20d2f1c335f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeTriggerCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeTriggerCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_TriggerGet() Console.WriteLine($"Succeeded: {result}"); } + // TriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TriggerGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/TriggerGet.json + // this example is just showing the usage of "Triggers_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this DataBoxEdgeTriggerResource + DataBoxEdgeTriggerCollection collection = dataBoxEdgeDevice.GetDataBoxEdgeTriggers(); + + // invoke the operation + string name = "trigger1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DataBoxEdgeTriggerResource 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 + DataBoxEdgeTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // TriggerPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeUserCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeUserCollection.cs index 9337ebe2f92e..e90acc1d94db 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeUserCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/samples/Generated/Samples/Sample_DataBoxEdgeUserCollection.cs @@ -121,6 +121,49 @@ public async Task Exists_UserGet() Console.WriteLine($"Succeeded: {result}"); } + // UserGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_UserGet() + { + // Generated from example definition: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/UserGet.json + // this example is just showing the usage of "Users_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 DataBoxEdgeDeviceResource created on azure + // for more information of creating DataBoxEdgeDeviceResource, please refer to the document of DataBoxEdgeDeviceResource + string subscriptionId = "4385cf00-2d3a-425a-832f-f4285b1c9dce"; + string resourceGroupName = "GroupForEdgeAutomation"; + string deviceName = "testedgedevice"; + ResourceIdentifier dataBoxEdgeDeviceResourceId = DataBoxEdgeDeviceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, deviceName); + DataBoxEdgeDeviceResource dataBoxEdgeDevice = client.GetDataBoxEdgeDeviceResource(dataBoxEdgeDeviceResourceId); + + // get the collection of this DataBoxEdgeUserResource + DataBoxEdgeUserCollection collection = dataBoxEdgeDevice.GetDataBoxEdgeUsers(); + + // invoke the operation + string name = "user1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DataBoxEdgeUserResource 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 + DataBoxEdgeUserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // UserPut [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleCollection.cs index 19088aec80ec..a50fd31896d1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name} + /// + /// + /// Operation Id + /// BandwidthSchedules_Get + /// + /// + /// + /// The bandwidth schedule name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _bandwidthScheduleClientDiagnostics.CreateScope("BandwidthScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _bandwidthScheduleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BandwidthScheduleResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name} + /// + /// + /// Operation Id + /// BandwidthSchedules_Get + /// + /// + /// + /// The bandwidth schedule name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _bandwidthScheduleClientDiagnostics.CreateScope("BandwidthScheduleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _bandwidthScheduleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BandwidthScheduleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertCollection.cs index f3b81208a6ba..29b2f67fa568 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name} + /// + /// + /// Operation Id + /// Alerts_Get + /// + /// + /// + /// The alert name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeAlertAlertsClientDiagnostics.CreateScope("DataBoxEdgeAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeAlertAlertsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeAlertResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name} + /// + /// + /// Operation Id + /// Alerts_Get + /// + /// + /// + /// The alert name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeAlertAlertsClientDiagnostics.CreateScope("DataBoxEdgeAlertCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeAlertAlertsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeAlertResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceCollection.cs index 9aaa46331a20..1708ebee9cda 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceCollection.cs @@ -326,6 +326,80 @@ public virtual Response Exists(string deviceName, CancellationToken cancel } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName} + /// + /// + /// Operation Id + /// Devices_Get + /// + /// + /// + /// The device name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deviceName, nameof(deviceName)); + + using var scope = _dataBoxEdgeDeviceDevicesClientDiagnostics.CreateScope("DataBoxEdgeDeviceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeDeviceDevicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, deviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeDeviceResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName} + /// + /// + /// Operation Id + /// Devices_Get + /// + /// + /// + /// The device name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deviceName, nameof(deviceName)); + + using var scope = _dataBoxEdgeDeviceDevicesClientDiagnostics.CreateScope("DataBoxEdgeDeviceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeDeviceDevicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, deviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeDeviceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobCollection.cs index 071d27d39c92..e882bd824914 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobCollection.cs @@ -193,5 +193,79 @@ public virtual Response Exists(string name, CancellationToken cancellation throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The job name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeJobJobsClientDiagnostics.CreateScope("DataBoxEdgeJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeJobJobsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeJobResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The job name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeJobJobsClientDiagnostics.CreateScope("DataBoxEdgeJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeJobJobsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeJobResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonCollection.cs index 84aa729743a2..8c84d5382f8f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string addonName, CancellationToken cancell } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName} + /// + /// + /// Operation Id + /// Addons_Get + /// + /// + /// + /// The addon name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string addonName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); + + using var scope = _dataBoxEdgeRoleAddonAddonsClientDiagnostics.CreateScope("DataBoxEdgeRoleAddonCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeRoleAddonAddonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeRoleAddonResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName} + /// + /// + /// Operation Id + /// Addons_Get + /// + /// + /// + /// The addon name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string addonName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); + + using var scope = _dataBoxEdgeRoleAddonAddonsClientDiagnostics.CreateScope("DataBoxEdgeRoleAddonCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeRoleAddonAddonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, addonName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeRoleAddonResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleCollection.cs index ab42d1711813..5569f10f3ce9 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name} + /// + /// + /// Operation Id + /// Roles_Get + /// + /// + /// + /// The role name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeRoleRolesClientDiagnostics.CreateScope("DataBoxEdgeRoleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeRoleRolesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeRoleResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name} + /// + /// + /// Operation Id + /// Roles_Get + /// + /// + /// + /// The role name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeRoleRolesClientDiagnostics.CreateScope("DataBoxEdgeRoleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeRoleRolesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeRoleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareCollection.cs index 03fca4cbe6b1..d09d61e1bd0a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name} + /// + /// + /// Operation Id + /// Shares_Get + /// + /// + /// + /// The share name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeShareSharesClientDiagnostics.CreateScope("DataBoxEdgeShareCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeShareSharesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeShareResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name} + /// + /// + /// Operation Id + /// Shares_Get + /// + /// + /// + /// The share name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeShareSharesClientDiagnostics.CreateScope("DataBoxEdgeShareCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeShareSharesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeShareResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCollection.cs index b234266a95e6..b1e9238f7588 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string storageAccountName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName} + /// + /// + /// Operation Id + /// StorageAccounts_Get + /// + /// + /// + /// The storage account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageAccountName, nameof(storageAccountName)); + + using var scope = _dataBoxEdgeStorageAccountStorageAccountsClientDiagnostics.CreateScope("DataBoxEdgeStorageAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeStorageAccountStorageAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageAccountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeStorageAccountResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName} + /// + /// + /// Operation Id + /// StorageAccounts_Get + /// + /// + /// + /// The storage account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageAccountName, nameof(storageAccountName)); + + using var scope = _dataBoxEdgeStorageAccountStorageAccountsClientDiagnostics.CreateScope("DataBoxEdgeStorageAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeStorageAccountStorageAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageAccountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeStorageAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialCollection.cs index 839f959c3a73..d25993c219da 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name} + /// + /// + /// Operation Id + /// StorageAccountCredentials_Get + /// + /// + /// + /// The storage account credential name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsClientDiagnostics.CreateScope("DataBoxEdgeStorageAccountCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeStorageAccountCredentialResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name} + /// + /// + /// Operation Id + /// StorageAccountCredentials_Get + /// + /// + /// + /// The storage account credential name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsClientDiagnostics.CreateScope("DataBoxEdgeStorageAccountCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeStorageAccountCredentialResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerCollection.cs index 887b52a4bed7..bb805b821553 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string containerName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName} + /// + /// + /// Operation Id + /// Containers_Get + /// + /// + /// + /// The container Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _dataBoxEdgeStorageContainerContainersClientDiagnostics.CreateScope("DataBoxEdgeStorageContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeStorageContainerContainersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeStorageContainerResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName} + /// + /// + /// Operation Id + /// Containers_Get + /// + /// + /// + /// The container Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _dataBoxEdgeStorageContainerContainersClientDiagnostics.CreateScope("DataBoxEdgeStorageContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeStorageContainerContainersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeStorageContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerCollection.cs index 5949de533da4..bc14108ccba0 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name} + /// + /// + /// Operation Id + /// Triggers_Get + /// + /// + /// + /// The trigger name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeTriggerTriggersClientDiagnostics.CreateScope("DataBoxEdgeTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeTriggerTriggersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeTriggerResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name} + /// + /// + /// Operation Id + /// Triggers_Get + /// + /// + /// + /// The trigger name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeTriggerTriggersClientDiagnostics.CreateScope("DataBoxEdgeTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeTriggerTriggersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeTriggerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserCollection.cs index 61a41c17eda4..55204c7ac3a1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserCollection.cs @@ -325,6 +325,80 @@ public virtual Response Exists(string name, CancellationToken cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name} + /// + /// + /// Operation Id + /// Users_Get + /// + /// + /// + /// The user name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeUserUsersClientDiagnostics.CreateScope("DataBoxEdgeUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataBoxEdgeUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeUserResource(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name} + /// + /// + /// Operation Id + /// Users_Get + /// + /// + /// + /// The user name. + /// 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) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _dataBoxEdgeUserUsersClientDiagnostics.CreateScope("DataBoxEdgeUserCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataBoxEdgeUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataBoxEdgeUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_DatadogMonitorResourceCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_DatadogMonitorResourceCollection.cs index 4e2c3ee1cb89..3d0fe88bfb72 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_DatadogMonitorResourceCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_DatadogMonitorResourceCollection.cs @@ -118,6 +118,48 @@ public async Task Exists_MonitorsGet() Console.WriteLine($"Succeeded: {result}"); } + // Monitors_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MonitorsGet() + { + // Generated from example definition: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/Monitors_Get.json + // this example is just showing the usage of "Monitors_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 = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatadogMonitorResource + DatadogMonitorResourceCollection collection = resourceGroupResource.GetDatadogMonitorResources(); + + // invoke the operation + string monitorName = "myMonitor"; + NullableResponse response = await collection.GetIfExistsAsync(monitorName); + DatadogMonitorResource 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 + DatadogMonitorResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Monitors_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_DatadogSingleSignOnResourceCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_DatadogSingleSignOnResourceCollection.cs index 1022c3a7d1ce..4709b19509b4 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_DatadogSingleSignOnResourceCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_DatadogSingleSignOnResourceCollection.cs @@ -156,5 +156,48 @@ public async Task Exists_SingleSignOnConfigurationsGet() Console.WriteLine($"Succeeded: {result}"); } + + // SingleSignOnConfigurations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SingleSignOnConfigurationsGet() + { + // Generated from example definition: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/SingleSignOnConfigurations_Get.json + // this example is just showing the usage of "SingleSignOnConfigurations_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 DatadogMonitorResource created on azure + // for more information of creating DatadogMonitorResource, please refer to the document of DatadogMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier datadogMonitorResourceId = DatadogMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + DatadogMonitorResource datadogMonitorResource = client.GetDatadogMonitorResource(datadogMonitorResourceId); + + // get the collection of this DatadogSingleSignOnResource + DatadogSingleSignOnResourceCollection collection = datadogMonitorResource.GetDatadogSingleSignOnResources(); + + // invoke the operation + string configurationName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + DatadogSingleSignOnResource 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 + DatadogSingleSignOnResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs index b6364073a71c..11546ac549c3 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs @@ -156,5 +156,48 @@ public async Task Exists_TagRulesGet() Console.WriteLine($"Succeeded: {result}"); } + + // TagRules_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TagRulesGet() + { + // Generated from example definition: specification/datadog/resource-manager/Microsoft.Datadog/stable/2021-03-01/examples/TagRules_Get.json + // this example is just showing the usage of "TagRules_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 DatadogMonitorResource created on azure + // for more information of creating DatadogMonitorResource, please refer to the document of DatadogMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier datadogMonitorResourceId = DatadogMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + DatadogMonitorResource datadogMonitorResource = client.GetDatadogMonitorResource(datadogMonitorResourceId); + + // get the collection of this MonitoringTagRuleResource + MonitoringTagRuleCollection collection = datadogMonitorResource.GetMonitoringTagRules(); + + // invoke the operation + string ruleSetName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(ruleSetName); + MonitoringTagRuleResource 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 + MonitoringTagRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceCollection.cs index b03e8a2bcf7c..d20cedeb10c8 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string monitorName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _datadogMonitorResourceMonitorsClientDiagnostics.CreateScope("DatadogMonitorResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _datadogMonitorResourceMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatadogMonitorResource(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.Datadog/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var scope = _datadogMonitorResourceMonitorsClientDiagnostics.CreateScope("DatadogMonitorResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _datadogMonitorResourceMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatadogMonitorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceCollection.cs index b138b3bca552..6536fa545c37 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string configurationName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName} + /// + /// + /// Operation Id + /// SingleSignOnConfigurations_Get + /// + /// + /// + /// Configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _datadogSingleSignOnResourceSingleSignOnConfigurationsClientDiagnostics.CreateScope("DatadogSingleSignOnResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _datadogSingleSignOnResourceSingleSignOnConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatadogSingleSignOnResource(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.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName} + /// + /// + /// Operation Id + /// SingleSignOnConfigurations_Get + /// + /// + /// + /// Configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _datadogSingleSignOnResourceSingleSignOnConfigurationsClientDiagnostics.CreateScope("DatadogSingleSignOnResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _datadogSingleSignOnResourceSingleSignOnConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatadogSingleSignOnResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleCollection.cs index e47b6d307772..6157ae2244be 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string ruleSetName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName} + /// + /// + /// Operation Id + /// TagRules_Get + /// + /// + /// + /// Rule set name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _monitoringTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(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.Datadog/monitors/{monitorName}/tagRules/{ruleSetName} + /// + /// + /// Operation Id + /// TagRules_Get + /// + /// + /// + /// Rule set name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); + + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _monitoringTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryChangeDataCaptureCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryChangeDataCaptureCollection.cs index 0c59a740a25f..7d33ba4aa253 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryChangeDataCaptureCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryChangeDataCaptureCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -118,5 +119,48 @@ public async Task Exists_ChangeDataCaptureGet() Console.WriteLine($"Succeeded: {result}"); } + + // ChangeDataCapture_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ChangeDataCaptureGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Get.json + // this example is just showing the usage of "ChangeDataCapture_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryChangeDataCaptureResource + DataFactoryChangeDataCaptureCollection collection = dataFactory.GetDataFactoryChangeDataCaptures(); + + // invoke the operation + string changeDataCaptureName = "exampleChangeDataCapture"; + NullableResponse response = await collection.GetIfExistsAsync(changeDataCaptureName); + DataFactoryChangeDataCaptureResource 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 + DataFactoryChangeDataCaptureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryCollection.cs index eba18f7046fb..c978f77580cd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryCollection.cs @@ -153,5 +153,47 @@ public async Task Exists_FactoriesGet() Console.WriteLine($"Succeeded: {result}"); } + + // Factories_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FactoriesGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Factories_Get.json + // this example is just showing the usage of "Factories_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 = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataFactoryResource + DataFactoryCollection collection = resourceGroupResource.GetDataFactories(); + + // invoke the operation + string factoryName = "exampleFactoryName"; + NullableResponse response = await collection.GetIfExistsAsync(factoryName); + DataFactoryResource 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 + DataFactoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDataFlowCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDataFlowCollection.cs index b07895c66e0a..dc78808dfb8a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDataFlowCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDataFlowCollection.cs @@ -212,6 +212,49 @@ public async Task Exists_DataFlowsGet() Console.WriteLine($"Succeeded: {result}"); } + // DataFlows_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataFlowsGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/DataFlows_Get.json + // this example is just showing the usage of "DataFlows_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryDataFlowResource + DataFactoryDataFlowCollection collection = dataFactory.GetDataFactoryDataFlows(); + + // invoke the operation + string dataFlowName = "exampleDataFlow"; + NullableResponse response = await collection.GetIfExistsAsync(dataFlowName); + DataFactoryDataFlowResource 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 + DataFactoryDataFlowData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // DataFlows_ListByFactory [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetCollection.cs index ecf9011d9929..c9d6a2e80965 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryDatasetCollection.cs @@ -216,5 +216,48 @@ public async Task Exists_DatasetsGet() Console.WriteLine($"Succeeded: {result}"); } + + // Datasets_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DatasetsGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Datasets_Get.json + // this example is just showing the usage of "Datasets_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryDatasetResource + DataFactoryDatasetCollection collection = dataFactory.GetDataFactoryDatasets(); + + // invoke the operation + string datasetName = "exampleDataset"; + NullableResponse response = await collection.GetIfExistsAsync(datasetName); + DataFactoryDatasetResource 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 + DataFactoryDatasetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryGlobalParameterCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryGlobalParameterCollection.cs index a19bc71c3880..86f825b41a36 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryGlobalParameterCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryGlobalParameterCollection.cs @@ -122,6 +122,49 @@ public async Task Exists_GlobalParametersGet() Console.WriteLine($"Succeeded: {result}"); } + // GlobalParameters_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GlobalParametersGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/GlobalParameters_Get.json + // this example is just showing the usage of "GlobalParameters_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryGlobalParameterResource + DataFactoryGlobalParameterCollection collection = dataFactory.GetDataFactoryGlobalParameters(); + + // invoke the operation + string globalParameterName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(globalParameterName); + DataFactoryGlobalParameterResource 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 + DataFactoryGlobalParameterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // GlobalParameters_Create [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryIntegrationRuntimeCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryIntegrationRuntimeCollection.cs index 28b3bd092843..c85f41d5d6ac 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryIntegrationRuntimeCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryIntegrationRuntimeCollection.cs @@ -160,5 +160,48 @@ public async Task Exists_IntegrationRuntimesGet() Console.WriteLine($"Succeeded: {result}"); } + + // IntegrationRuntimes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_IntegrationRuntimesGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/IntegrationRuntimes_Get.json + // this example is just showing the usage of "IntegrationRuntimes_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryIntegrationRuntimeResource + DataFactoryIntegrationRuntimeCollection collection = dataFactory.GetDataFactoryIntegrationRuntimes(); + + // invoke the operation + string integrationRuntimeName = "exampleIntegrationRuntime"; + NullableResponse response = await collection.GetIfExistsAsync(integrationRuntimeName); + DataFactoryIntegrationRuntimeResource 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 + DataFactoryIntegrationRuntimeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceCollection.cs index 9d45e54bb0a6..9d7a641321d1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryLinkedServiceCollection.cs @@ -202,5 +202,48 @@ public async Task Exists_LinkedServicesGet() Console.WriteLine($"Succeeded: {result}"); } + + // LinkedServices_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_LinkedServicesGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/LinkedServices_Get.json + // this example is just showing the usage of "LinkedServices_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryLinkedServiceResource + DataFactoryLinkedServiceCollection collection = dataFactory.GetDataFactoryLinkedServices(); + + // invoke the operation + string linkedServiceName = "exampleLinkedService"; + NullableResponse response = await collection.GetIfExistsAsync(linkedServiceName); + DataFactoryLinkedServiceResource 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 + DataFactoryLinkedServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialCollection.cs index 4d6526197b31..de8b6e209433 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedIdentityCredentialCollection.cs @@ -160,5 +160,48 @@ public async Task Exists_CredentialsGet() Console.WriteLine($"Succeeded: {result}"); } + + // Credentials_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CredentialsGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Credentials_Get.json + // this example is just showing the usage of "CredentialOperations_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryManagedIdentityCredentialResource + DataFactoryManagedIdentityCredentialCollection collection = dataFactory.GetDataFactoryManagedIdentityCredentials(); + + // invoke the operation + string credentialName = "exampleCredential"; + NullableResponse response = await collection.GetIfExistsAsync(credentialName); + DataFactoryManagedIdentityCredentialResource 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 + DataFactoryManagedIdentityCredentialData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedVirtualNetworkCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedVirtualNetworkCollection.cs index a35bb5674f2e..af80d8ce9726 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedVirtualNetworkCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryManagedVirtualNetworkCollection.cs @@ -157,5 +157,48 @@ public async Task Exists_ManagedVirtualNetworksGet() Console.WriteLine($"Succeeded: {result}"); } + + // ManagedVirtualNetworks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagedVirtualNetworksGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ManagedVirtualNetworks_Get.json + // this example is just showing the usage of "ManagedVirtualNetworks_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryManagedVirtualNetworkResource + DataFactoryManagedVirtualNetworkCollection collection = dataFactory.GetDataFactoryManagedVirtualNetworks(); + + // invoke the operation + string managedVirtualNetworkName = "exampleManagedVirtualNetworkName"; + NullableResponse response = await collection.GetIfExistsAsync(managedVirtualNetworkName); + DataFactoryManagedVirtualNetworkResource 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 + DataFactoryManagedVirtualNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineCollection.cs index e5d35484eaa6..59ba842d39c6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPipelineCollection.cs @@ -298,5 +298,48 @@ public async Task Exists_PipelinesGet() Console.WriteLine($"Succeeded: {result}"); } + + // Pipelines_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PipelinesGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Pipelines_Get.json + // this example is just showing the usage of "Pipelines_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryPipelineResource + DataFactoryPipelineCollection collection = dataFactory.GetDataFactoryPipelines(); + + // invoke the operation + string pipelineName = "examplePipeline"; + NullableResponse response = await collection.GetIfExistsAsync(pipelineName); + DataFactoryPipelineResource 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 + DataFactoryPipelineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPrivateEndpointCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPrivateEndpointCollection.cs index 2d3b36e3208f..7ef7745db1bf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPrivateEndpointCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPrivateEndpointCollection.cs @@ -168,5 +168,49 @@ public async Task Exists_ManagedPrivateEndpointsGet() Console.WriteLine($"Succeeded: {result}"); } + + // ManagedPrivateEndpoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagedPrivateEndpointsGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ManagedPrivateEndpoints_Get.json + // this example is just showing the usage of "ManagedPrivateEndpoints_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 DataFactoryManagedVirtualNetworkResource created on azure + // for more information of creating DataFactoryManagedVirtualNetworkResource, please refer to the document of DataFactoryManagedVirtualNetworkResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + string managedVirtualNetworkName = "exampleManagedVirtualNetworkName"; + ResourceIdentifier dataFactoryManagedVirtualNetworkResourceId = DataFactoryManagedVirtualNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName, managedVirtualNetworkName); + DataFactoryManagedVirtualNetworkResource dataFactoryManagedVirtualNetwork = client.GetDataFactoryManagedVirtualNetworkResource(dataFactoryManagedVirtualNetworkResourceId); + + // get the collection of this DataFactoryPrivateEndpointResource + DataFactoryPrivateEndpointCollection collection = dataFactoryManagedVirtualNetwork.GetDataFactoryPrivateEndpoints(); + + // invoke the operation + string managedPrivateEndpointName = "exampleManagedPrivateEndpointName"; + NullableResponse response = await collection.GetIfExistsAsync(managedPrivateEndpointName); + DataFactoryPrivateEndpointResource 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 + DataFactoryPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPrivateEndpointConnectionCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPrivateEndpointConnectionCollection.cs index 18516c3e8092..9bc38dccb3fa 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPrivateEndpointConnectionCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryPrivateEndpointConnectionCollection.cs @@ -169,5 +169,48 @@ public async Task Exists_GetAPrivateEndpointConnectionForADatafactory() Console.WriteLine($"Succeeded: {result}"); } + + // Get a private endpoint connection for a datafactory. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateEndpointConnectionForADatafactory() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/GetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryPrivateEndpointConnectionResource + DataFactoryPrivateEndpointConnectionCollection collection = dataFactory.GetDataFactoryPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "connection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + DataFactoryPrivateEndpointConnectionResource 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 + DataFactoryPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryTriggerCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryTriggerCollection.cs index b97d9390fda6..0369af73ae64 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryTriggerCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/samples/Generated/Samples/Sample_DataFactoryTriggerCollection.cs @@ -235,5 +235,48 @@ public async Task Exists_TriggersGet() Console.WriteLine($"Succeeded: {result}"); } + + // Triggers_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TriggersGet() + { + // Generated from example definition: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Triggers_Get.json + // this example is just showing the usage of "Triggers_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 DataFactoryResource created on azure + // for more information of creating DataFactoryResource, please refer to the document of DataFactoryResource + string subscriptionId = "12345678-1234-1234-1234-12345678abc"; + string resourceGroupName = "exampleResourceGroup"; + string factoryName = "exampleFactoryName"; + ResourceIdentifier dataFactoryResourceId = DataFactoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, factoryName); + DataFactoryResource dataFactory = client.GetDataFactoryResource(dataFactoryResourceId); + + // get the collection of this DataFactoryTriggerResource + DataFactoryTriggerCollection collection = dataFactory.GetDataFactoryTriggers(); + + // invoke the operation + string triggerName = "exampleTrigger"; + NullableResponse response = await collection.GetIfExistsAsync(triggerName); + DataFactoryTriggerResource 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 + DataFactoryTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureCollection.cs index 273e254d4f0a..5bba84ccab55 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string changeDataCaptureName, string ifNone } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName} + /// + /// + /// Operation Id + /// ChangeDataCapture_Get + /// + /// + /// + /// The change data capture name. + /// ETag of the change data capture entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string changeDataCaptureName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(changeDataCaptureName, nameof(changeDataCaptureName)); + + using var scope = _dataFactoryChangeDataCaptureChangeDataCaptureClientDiagnostics.CreateScope("DataFactoryChangeDataCaptureCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryChangeDataCaptureChangeDataCaptureRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, changeDataCaptureName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryChangeDataCaptureResource(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.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName} + /// + /// + /// Operation Id + /// ChangeDataCapture_Get + /// + /// + /// + /// The change data capture name. + /// ETag of the change data capture entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string changeDataCaptureName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(changeDataCaptureName, nameof(changeDataCaptureName)); + + using var scope = _dataFactoryChangeDataCaptureChangeDataCaptureClientDiagnostics.CreateScope("DataFactoryChangeDataCaptureCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryChangeDataCaptureChangeDataCaptureRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, changeDataCaptureName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryChangeDataCaptureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryCollection.cs index 09a9b00fa9d3..c75e6e95ef5c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryCollection.cs @@ -330,6 +330,82 @@ public virtual Response Exists(string factoryName, string ifNoneMatch = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName} + /// + /// + /// Operation Id + /// Factories_Get + /// + /// + /// + /// The factory name. + /// ETag of the factory entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string factoryName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(factoryName, nameof(factoryName)); + + using var scope = _dataFactoryFactoriesClientDiagnostics.CreateScope("DataFactoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryFactoriesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, factoryName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryResource(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.DataFactory/factories/{factoryName} + /// + /// + /// Operation Id + /// Factories_Get + /// + /// + /// + /// The factory name. + /// ETag of the factory entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string factoryName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(factoryName, nameof(factoryName)); + + using var scope = _dataFactoryFactoriesClientDiagnostics.CreateScope("DataFactoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryFactoriesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, factoryName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowCollection.cs index 2cd69ddedf07..8f2fd0e7334f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string dataFlowName, string ifNoneMatch = n } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/dataflows/{dataFlowName} + /// + /// + /// Operation Id + /// DataFlows_Get + /// + /// + /// + /// The data flow name. + /// ETag of the data flow entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// 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, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataFlowName, nameof(dataFlowName)); + + using var scope = _dataFactoryDataFlowDataFlowsClientDiagnostics.CreateScope("DataFactoryDataFlowCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryDataFlowDataFlowsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataFlowName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryDataFlowResource(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.DataFactory/factories/{factoryName}/dataflows/{dataFlowName} + /// + /// + /// Operation Id + /// DataFlows_Get + /// + /// + /// + /// The data flow name. + /// ETag of the data flow entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataFlowName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataFlowName, nameof(dataFlowName)); + + using var scope = _dataFactoryDataFlowDataFlowsClientDiagnostics.CreateScope("DataFactoryDataFlowCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryDataFlowDataFlowsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataFlowName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryDataFlowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetCollection.cs index 50ca95bd5fdb..199356c874a5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string datasetName, string ifNoneMatch = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName} + /// + /// + /// Operation Id + /// Datasets_Get + /// + /// + /// + /// The dataset name. + /// ETag of the dataset entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string datasetName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(datasetName, nameof(datasetName)); + + using var scope = _dataFactoryDatasetDatasetsClientDiagnostics.CreateScope("DataFactoryDatasetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryDatasetDatasetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, datasetName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryDatasetResource(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.DataFactory/factories/{factoryName}/datasets/{datasetName} + /// + /// + /// Operation Id + /// Datasets_Get + /// + /// + /// + /// The dataset name. + /// ETag of the dataset entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string datasetName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(datasetName, nameof(datasetName)); + + using var scope = _dataFactoryDatasetDatasetsClientDiagnostics.CreateScope("DataFactoryDatasetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryDatasetDatasetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, datasetName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryDatasetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterCollection.cs index feaf127969e6..12fa2debf2d9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string globalParameterName, CancellationTok } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/globalParameters/{globalParameterName} + /// + /// + /// Operation Id + /// GlobalParameters_Get + /// + /// + /// + /// The global parameter name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string globalParameterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(globalParameterName, nameof(globalParameterName)); + + using var scope = _dataFactoryGlobalParameterGlobalParametersClientDiagnostics.CreateScope("DataFactoryGlobalParameterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryGlobalParameterGlobalParametersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalParameterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryGlobalParameterResource(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.DataFactory/factories/{factoryName}/globalParameters/{globalParameterName} + /// + /// + /// Operation Id + /// GlobalParameters_Get + /// + /// + /// + /// The global parameter name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string globalParameterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(globalParameterName, nameof(globalParameterName)); + + using var scope = _dataFactoryGlobalParameterGlobalParametersClientDiagnostics.CreateScope("DataFactoryGlobalParameterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryGlobalParameterGlobalParametersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalParameterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryGlobalParameterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeCollection.cs index 7e95e84683be..ba085083c7d5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string integrationRuntimeName, string ifNon } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName} + /// + /// + /// Operation Id + /// IntegrationRuntimes_Get + /// + /// + /// + /// The integration runtime name. + /// ETag of the integration runtime entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string integrationRuntimeName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(integrationRuntimeName, nameof(integrationRuntimeName)); + + using var scope = _dataFactoryIntegrationRuntimeIntegrationRuntimesClientDiagnostics.CreateScope("DataFactoryIntegrationRuntimeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryIntegrationRuntimeIntegrationRuntimesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationRuntimeName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryIntegrationRuntimeResource(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.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName} + /// + /// + /// Operation Id + /// IntegrationRuntimes_Get + /// + /// + /// + /// The integration runtime name. + /// ETag of the integration runtime entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string integrationRuntimeName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(integrationRuntimeName, nameof(integrationRuntimeName)); + + using var scope = _dataFactoryIntegrationRuntimeIntegrationRuntimesClientDiagnostics.CreateScope("DataFactoryIntegrationRuntimeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryIntegrationRuntimeIntegrationRuntimesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationRuntimeName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryIntegrationRuntimeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceCollection.cs index ce0e6673025f..fef485a9135b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string linkedServiceName, string ifNoneMatc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName} + /// + /// + /// Operation Id + /// LinkedServices_Get + /// + /// + /// + /// The linked service name. + /// ETag of the linked service entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string linkedServiceName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkedServiceName, nameof(linkedServiceName)); + + using var scope = _dataFactoryLinkedServiceLinkedServicesClientDiagnostics.CreateScope("DataFactoryLinkedServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryLinkedServiceLinkedServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkedServiceName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryLinkedServiceResource(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.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName} + /// + /// + /// Operation Id + /// LinkedServices_Get + /// + /// + /// + /// The linked service name. + /// ETag of the linked service entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string linkedServiceName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(linkedServiceName, nameof(linkedServiceName)); + + using var scope = _dataFactoryLinkedServiceLinkedServicesClientDiagnostics.CreateScope("DataFactoryLinkedServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryLinkedServiceLinkedServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkedServiceName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryLinkedServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialCollection.cs index 1c64dab9ded1..3760914e30a4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string credentialName, string ifNoneMatch = } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/credentials/{credentialName} + /// + /// + /// Operation Id + /// CredentialOperations_Get + /// + /// + /// + /// Credential name. + /// ETag of the credential entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string credentialName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(credentialName, nameof(credentialName)); + + using var scope = _dataFactoryManagedIdentityCredentialCredentialOperationsClientDiagnostics.CreateScope("DataFactoryManagedIdentityCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryManagedIdentityCredentialCredentialOperationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, credentialName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryManagedIdentityCredentialResource(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.DataFactory/factories/{factoryName}/credentials/{credentialName} + /// + /// + /// Operation Id + /// CredentialOperations_Get + /// + /// + /// + /// Credential name. + /// ETag of the credential entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string credentialName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(credentialName, nameof(credentialName)); + + using var scope = _dataFactoryManagedIdentityCredentialCredentialOperationsClientDiagnostics.CreateScope("DataFactoryManagedIdentityCredentialCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryManagedIdentityCredentialCredentialOperationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, credentialName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryManagedIdentityCredentialResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkCollection.cs index 4886c35d0f56..544a45acbdcb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string managedVirtualNetworkName, string if } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName} + /// + /// + /// Operation Id + /// ManagedVirtualNetworks_Get + /// + /// + /// + /// Managed virtual network name. + /// ETag of the managed Virtual Network entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedVirtualNetworkName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedVirtualNetworkName, nameof(managedVirtualNetworkName)); + + using var scope = _dataFactoryManagedVirtualNetworkManagedVirtualNetworksClientDiagnostics.CreateScope("DataFactoryManagedVirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryManagedVirtualNetworkManagedVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedVirtualNetworkName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryManagedVirtualNetworkResource(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.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName} + /// + /// + /// Operation Id + /// ManagedVirtualNetworks_Get + /// + /// + /// + /// Managed virtual network name. + /// ETag of the managed Virtual Network entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedVirtualNetworkName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedVirtualNetworkName, nameof(managedVirtualNetworkName)); + + using var scope = _dataFactoryManagedVirtualNetworkManagedVirtualNetworksClientDiagnostics.CreateScope("DataFactoryManagedVirtualNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryManagedVirtualNetworkManagedVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedVirtualNetworkName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryManagedVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineCollection.cs index 3b23e583ed7e..fe5be536ef25 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string pipelineName, string ifNoneMatch = n } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName} + /// + /// + /// Operation Id + /// Pipelines_Get + /// + /// + /// + /// The pipeline name. + /// ETag of the pipeline entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string pipelineName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(pipelineName, nameof(pipelineName)); + + using var scope = _dataFactoryPipelinePipelinesClientDiagnostics.CreateScope("DataFactoryPipelineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryPipelinePipelinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pipelineName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryPipelineResource(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.DataFactory/factories/{factoryName}/pipelines/{pipelineName} + /// + /// + /// Operation Id + /// Pipelines_Get + /// + /// + /// + /// The pipeline name. + /// ETag of the pipeline entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string pipelineName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(pipelineName, nameof(pipelineName)); + + using var scope = _dataFactoryPipelinePipelinesClientDiagnostics.CreateScope("DataFactoryPipelineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryPipelinePipelinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pipelineName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryPipelineResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointCollection.cs index 9b6419bfec14..24066a0949b6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string managedPrivateEndpointName, string i } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// Managed private endpoint name. + /// ETag of the managed private endpoint entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedPrivateEndpointName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _dataFactoryPrivateEndpointManagedPrivateEndpointsClientDiagnostics.CreateScope("DataFactoryPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryPrivateEndpointManagedPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, managedPrivateEndpointName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryPrivateEndpointResource(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.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// Managed private endpoint name. + /// ETag of the managed private endpoint entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedPrivateEndpointName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _dataFactoryPrivateEndpointManagedPrivateEndpointsClientDiagnostics.CreateScope("DataFactoryPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryPrivateEndpointManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, managedPrivateEndpointName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionCollection.cs index c4ab92df0e75..546d9b91f62d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionCollection.cs @@ -335,6 +335,82 @@ public virtual Response Exists(string privateEndpointConnectionName, strin } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_Get + /// + /// + /// + /// The private endpoint connection name. + /// ETag of the private endpoint connection entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _dataFactoryPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics.CreateScope("DataFactoryPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryPrivateEndpointConnectionPrivateEndpointConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryPrivateEndpointConnectionResource(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.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_Get + /// + /// + /// + /// The private endpoint connection name. + /// ETag of the private endpoint connection entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _dataFactoryPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics.CreateScope("DataFactoryPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryPrivateEndpointConnectionPrivateEndpointConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerCollection.cs index 8b0c32586b56..d484790a53be 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string triggerName, string ifNoneMatch = nu } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName} + /// + /// + /// Operation Id + /// Triggers_Get + /// + /// + /// + /// The trigger name. + /// ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string triggerName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); + + using var scope = _dataFactoryTriggerTriggersClientDiagnostics.CreateScope("DataFactoryTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataFactoryTriggerTriggersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, triggerName, ifNoneMatch, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryTriggerResource(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.DataFactory/factories/{factoryName}/triggers/{triggerName} + /// + /// + /// Operation Id + /// Triggers_Get + /// + /// + /// + /// The trigger name. + /// ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string triggerName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(triggerName, nameof(triggerName)); + + using var scope = _dataFactoryTriggerTriggersClientDiagnostics.CreateScope("DataFactoryTriggerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataFactoryTriggerTriggersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, triggerName, ifNoneMatch, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataFactoryTriggerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsAccountCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsAccountCollection.cs index c6b798a40bc2..2edb1ad244c5 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsAccountCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsAccountCollection.cs @@ -191,5 +191,47 @@ public async Task Exists_GetsDetailsOfTheSpecifiedDataLakeAnalyticsAccount() Console.WriteLine($"Succeeded: {result}"); } + + // Gets details of the specified Data Lake Analytics account. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsDetailsOfTheSpecifiedDataLakeAnalyticsAccount() + { + // Generated from example definition: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/stable/2016-11-01/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 = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "contosorg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataLakeAnalyticsAccountResource + DataLakeAnalyticsAccountCollection collection = resourceGroupResource.GetDataLakeAnalyticsAccounts(); + + // invoke the operation + string accountName = "contosoadla"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + DataLakeAnalyticsAccountResource 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 + DataLakeAnalyticsAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsComputePolicyCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsComputePolicyCollection.cs index cdbd688ad8f6..57f725cd4087 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsComputePolicyCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsComputePolicyCollection.cs @@ -161,5 +161,48 @@ public async Task Exists_GetsTheSpecifiedComputePolicy() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the specified compute policy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheSpecifiedComputePolicy() + { + // Generated from example definition: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/stable/2016-11-01/examples/ComputePolicies_Get.json + // this example is just showing the usage of "ComputePolicies_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 DataLakeAnalyticsAccountResource created on azure + // for more information of creating DataLakeAnalyticsAccountResource, please refer to the document of DataLakeAnalyticsAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "contosorg"; + string accountName = "contosoadla"; + ResourceIdentifier dataLakeAnalyticsAccountResourceId = DataLakeAnalyticsAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DataLakeAnalyticsAccountResource dataLakeAnalyticsAccount = client.GetDataLakeAnalyticsAccountResource(dataLakeAnalyticsAccountResourceId); + + // get the collection of this DataLakeAnalyticsComputePolicyResource + DataLakeAnalyticsComputePolicyCollection collection = dataLakeAnalyticsAccount.GetDataLakeAnalyticsComputePolicies(); + + // invoke the operation + string computePolicyName = "test_policy"; + NullableResponse response = await collection.GetIfExistsAsync(computePolicyName); + DataLakeAnalyticsComputePolicyResource 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 + DataLakeAnalyticsComputePolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsFirewallRuleCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsFirewallRuleCollection.cs index 2c39e893de3d..202eadadde95 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsFirewallRuleCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsFirewallRuleCollection.cs @@ -158,5 +158,48 @@ public async Task Exists_GetsTheSpecifiedDataLakeAnalyticsFirewallRule() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the specified Data Lake Analytics firewall rule + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheSpecifiedDataLakeAnalyticsFirewallRule() + { + // Generated from example definition: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/stable/2016-11-01/examples/FirewallRules_Get.json + // this example is just showing the usage of "FirewallRules_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 DataLakeAnalyticsAccountResource created on azure + // for more information of creating DataLakeAnalyticsAccountResource, please refer to the document of DataLakeAnalyticsAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "contosorg"; + string accountName = "contosoadla"; + ResourceIdentifier dataLakeAnalyticsAccountResourceId = DataLakeAnalyticsAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DataLakeAnalyticsAccountResource dataLakeAnalyticsAccount = client.GetDataLakeAnalyticsAccountResource(dataLakeAnalyticsAccountResourceId); + + // get the collection of this DataLakeAnalyticsFirewallRuleResource + DataLakeAnalyticsFirewallRuleCollection collection = dataLakeAnalyticsAccount.GetDataLakeAnalyticsFirewallRules(); + + // invoke the operation + string firewallRuleName = "test_rule"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + DataLakeAnalyticsFirewallRuleResource 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 + DataLakeAnalyticsFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsStorageAccountInformationCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsStorageAccountInformationCollection.cs index 03a52d9ab426..3475c2070396 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsStorageAccountInformationCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsStorageAccountInformationCollection.cs @@ -156,5 +156,48 @@ public async Task Exists_GetsTheSpecifiedAzureStorageAccount() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the specified Azure Storage account + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheSpecifiedAzureStorageAccount() + { + // Generated from example definition: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/stable/2016-11-01/examples/StorageAccounts_Get.json + // this example is just showing the usage of "StorageAccounts_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 DataLakeAnalyticsAccountResource created on azure + // for more information of creating DataLakeAnalyticsAccountResource, please refer to the document of DataLakeAnalyticsAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "contosorg"; + string accountName = "contosoadla"; + ResourceIdentifier dataLakeAnalyticsAccountResourceId = DataLakeAnalyticsAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DataLakeAnalyticsAccountResource dataLakeAnalyticsAccount = client.GetDataLakeAnalyticsAccountResource(dataLakeAnalyticsAccountResourceId); + + // get the collection of this DataLakeAnalyticsStorageAccountInformationResource + DataLakeAnalyticsStorageAccountInformationCollection collection = dataLakeAnalyticsAccount.GetAllDataLakeAnalyticsStorageAccountInformation(); + + // invoke the operation + string storageAccountName = "test_storage"; + NullableResponse response = await collection.GetIfExistsAsync(storageAccountName); + DataLakeAnalyticsStorageAccountInformationResource 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 + DataLakeAnalyticsStorageAccountInformationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsStorageContainerCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsStorageContainerCollection.cs index 6869b21ca3bf..263ffcff4844 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsStorageContainerCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeAnalyticsStorageContainerCollection.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -121,5 +122,49 @@ public async Task Exists_GetsTheSpecifiedAzureStorageContainer() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the specified Azure Storage container + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheSpecifiedAzureStorageContainer() + { + // Generated from example definition: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/stable/2016-11-01/examples/StorageAccounts_GetStorageContainer.json + // this example is just showing the usage of "StorageAccounts_GetStorageContainer" 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 DataLakeAnalyticsStorageAccountInformationResource created on azure + // for more information of creating DataLakeAnalyticsStorageAccountInformationResource, please refer to the document of DataLakeAnalyticsStorageAccountInformationResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "contosorg"; + string accountName = "contosoadla"; + string storageAccountName = "test_storage"; + ResourceIdentifier dataLakeAnalyticsStorageAccountInformationResourceId = DataLakeAnalyticsStorageAccountInformationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, storageAccountName); + DataLakeAnalyticsStorageAccountInformationResource dataLakeAnalyticsStorageAccountInformation = client.GetDataLakeAnalyticsStorageAccountInformationResource(dataLakeAnalyticsStorageAccountInformationResourceId); + + // get the collection of this DataLakeAnalyticsStorageContainerResource + DataLakeAnalyticsStorageContainerCollection collection = dataLakeAnalyticsStorageAccountInformation.GetDataLakeAnalyticsStorageContainers(); + + // invoke the operation + string containerName = "test_container"; + NullableResponse response = await collection.GetIfExistsAsync(containerName); + DataLakeAnalyticsStorageContainerResource 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 + DataLakeAnalyticsStorageContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeStoreAccountInformationCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeStoreAccountInformationCollection.cs index 9550ef51d6db..5e79f1e4d8f2 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeStoreAccountInformationCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/samples/Generated/Samples/Sample_DataLakeStoreAccountInformationCollection.cs @@ -156,5 +156,48 @@ public async Task Exists_GetsTheSpecifiedDataLakeStoreAccountDetails() Console.WriteLine($"Succeeded: {result}"); } + + // Gets the specified Data Lake Store account details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheSpecifiedDataLakeStoreAccountDetails() + { + // Generated from example definition: specification/datalake-analytics/resource-manager/Microsoft.DataLakeAnalytics/stable/2016-11-01/examples/DataLakeStoreAccounts_Get.json + // this example is just showing the usage of "DataLakeStoreAccounts_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 DataLakeAnalyticsAccountResource created on azure + // for more information of creating DataLakeAnalyticsAccountResource, please refer to the document of DataLakeAnalyticsAccountResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1669ab345"; + string resourceGroupName = "contosorg"; + string accountName = "contosoadla"; + ResourceIdentifier dataLakeAnalyticsAccountResourceId = DataLakeAnalyticsAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + DataLakeAnalyticsAccountResource dataLakeAnalyticsAccount = client.GetDataLakeAnalyticsAccountResource(dataLakeAnalyticsAccountResourceId); + + // get the collection of this DataLakeStoreAccountInformationResource + DataLakeStoreAccountInformationCollection collection = dataLakeAnalyticsAccount.GetAllDataLakeStoreAccountInformation(); + + // invoke the operation + string dataLakeStoreAccountName = "test_adls_account"; + NullableResponse response = await collection.GetIfExistsAsync(dataLakeStoreAccountName); + DataLakeStoreAccountInformationResource 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 + DataLakeStoreAccountInformationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountCollection.cs index fbaefe845a33..e548c57a0722 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Data Lake Analytics 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _dataLakeAnalyticsAccountAccountsClientDiagnostics.CreateScope("DataLakeAnalyticsAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeAnalyticsAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsAccountResource(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.DataLakeAnalytics/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Data Lake Analytics account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _dataLakeAnalyticsAccountAccountsClientDiagnostics.CreateScope("DataLakeAnalyticsAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeAnalyticsAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsComputePolicyCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsComputePolicyCollection.cs index b04e3f7bf8f3..7797d55d200c 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsComputePolicyCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsComputePolicyCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string computePolicyName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName} + /// + /// + /// Operation Id + /// ComputePolicies_Get + /// + /// + /// + /// The name of the compute policy to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string computePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(computePolicyName, nameof(computePolicyName)); + + using var scope = _dataLakeAnalyticsComputePolicyComputePoliciesClientDiagnostics.CreateScope("DataLakeAnalyticsComputePolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeAnalyticsComputePolicyComputePoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, computePolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsComputePolicyResource(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.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName} + /// + /// + /// Operation Id + /// ComputePolicies_Get + /// + /// + /// + /// The name of the compute policy to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string computePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(computePolicyName, nameof(computePolicyName)); + + using var scope = _dataLakeAnalyticsComputePolicyComputePoliciesClientDiagnostics.CreateScope("DataLakeAnalyticsComputePolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeAnalyticsComputePolicyComputePoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, computePolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsComputePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsFirewallRuleCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsFirewallRuleCollection.cs index 855acf2cdd68..81ccefe91f5a 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsFirewallRuleCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsFirewallRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _dataLakeAnalyticsFirewallRuleFirewallRulesClientDiagnostics.CreateScope("DataLakeAnalyticsFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeAnalyticsFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsFirewallRuleResource(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.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _dataLakeAnalyticsFirewallRuleFirewallRulesClientDiagnostics.CreateScope("DataLakeAnalyticsFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeAnalyticsFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationCollection.cs index 63f50e42b367..830c7b46f5af 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string storageAccountName, CancellationToke } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName} + /// + /// + /// Operation Id + /// StorageAccounts_Get + /// + /// + /// + /// The name of the Azure Storage account for which to retrieve the details. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storageAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageAccountName, nameof(storageAccountName)); + + using var scope = _dataLakeAnalyticsStorageAccountInformationStorageAccountsClientDiagnostics.CreateScope("DataLakeAnalyticsStorageAccountInformationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeAnalyticsStorageAccountInformationStorageAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageAccountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsStorageAccountInformationResource(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.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName} + /// + /// + /// Operation Id + /// StorageAccounts_Get + /// + /// + /// + /// The name of the Azure Storage account for which to retrieve the details. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storageAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storageAccountName, nameof(storageAccountName)); + + using var scope = _dataLakeAnalyticsStorageAccountInformationStorageAccountsClientDiagnostics.CreateScope("DataLakeAnalyticsStorageAccountInformationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeAnalyticsStorageAccountInformationStorageAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storageAccountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsStorageAccountInformationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageContainerCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageContainerCollection.cs index d20b0407c288..48ad9e41f66c 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageContainerCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageContainerCollection.cs @@ -241,6 +241,80 @@ public virtual Response Exists(string containerName, CancellationToken can } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName} + /// + /// + /// Operation Id + /// StorageAccounts_GetStorageContainer + /// + /// + /// + /// The name of the Azure storage container to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _dataLakeAnalyticsStorageContainerStorageAccountsClientDiagnostics.CreateScope("DataLakeAnalyticsStorageContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeAnalyticsStorageContainerStorageAccountsRestClient.GetStorageContainerAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsStorageContainerResource(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.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName} + /// + /// + /// Operation Id + /// StorageAccounts_GetStorageContainer + /// + /// + /// + /// The name of the Azure storage container to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string containerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); + + using var scope = _dataLakeAnalyticsStorageContainerStorageAccountsClientDiagnostics.CreateScope("DataLakeAnalyticsStorageContainerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeAnalyticsStorageContainerStorageAccountsRestClient.GetStorageContainer(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeAnalyticsStorageContainerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeStoreAccountInformationCollection.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeStoreAccountInformationCollection.cs index 0dcbdabc41e5..6e7b1a36a66b 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeStoreAccountInformationCollection.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeStoreAccountInformationCollection.cs @@ -330,6 +330,80 @@ public virtual Response Exists(string dataLakeStoreAccountName, Cancellati } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName} + /// + /// + /// Operation Id + /// DataLakeStoreAccounts_Get + /// + /// + /// + /// The name of the Data Lake Store account to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataLakeStoreAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataLakeStoreAccountName, nameof(dataLakeStoreAccountName)); + + using var scope = _dataLakeStoreAccountInformationDataLakeStoreAccountsClientDiagnostics.CreateScope("DataLakeStoreAccountInformationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeStoreAccountInformationDataLakeStoreAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataLakeStoreAccountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreAccountInformationResource(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.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName} + /// + /// + /// Operation Id + /// DataLakeStoreAccounts_Get + /// + /// + /// + /// The name of the Data Lake Store account to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataLakeStoreAccountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataLakeStoreAccountName, nameof(dataLakeStoreAccountName)); + + using var scope = _dataLakeStoreAccountInformationDataLakeStoreAccountsClientDiagnostics.CreateScope("DataLakeStoreAccountInformationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeStoreAccountInformationDataLakeStoreAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataLakeStoreAccountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreAccountInformationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountCollection.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountCollection.cs index 0888bde080ae..d5d33cda89f9 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountCollection.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountCollection.cs @@ -331,6 +331,80 @@ public virtual Response Exists(string accountName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Data Lake Store 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 accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _dataLakeStoreAccountAccountsClientDiagnostics.CreateScope("DataLakeStoreAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeStoreAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreAccountResource(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.DataLakeStore/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Data Lake Store account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = _dataLakeStoreAccountAccountsClientDiagnostics.CreateScope("DataLakeStoreAccountCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeStoreAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll(options: null).GetEnumerator(); diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreFirewallRuleCollection.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreFirewallRuleCollection.cs index 5216686e7373..fbf57cd4ad95 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreFirewallRuleCollection.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreFirewallRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string firewallRuleName, CancellationToken } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _dataLakeStoreFirewallRuleFirewallRulesClientDiagnostics.CreateScope("DataLakeStoreFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeStoreFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreFirewallRuleResource(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.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName} + /// + /// + /// Operation Id + /// FirewallRules_Get + /// + /// + /// + /// The name of the firewall rule to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string firewallRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(firewallRuleName, nameof(firewallRuleName)); + + using var scope = _dataLakeStoreFirewallRuleFirewallRulesClientDiagnostics.CreateScope("DataLakeStoreFirewallRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeStoreFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, firewallRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreFirewallRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreTrustedIdProviderCollection.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreTrustedIdProviderCollection.cs index de0a9009f3e7..4177199a1e93 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreTrustedIdProviderCollection.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreTrustedIdProviderCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string trustedIdProviderName, CancellationT } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName} + /// + /// + /// Operation Id + /// TrustedIdProviders_Get + /// + /// + /// + /// The name of the trusted identity provider to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string trustedIdProviderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trustedIdProviderName, nameof(trustedIdProviderName)); + + using var scope = _dataLakeStoreTrustedIdProviderTrustedIdProvidersClientDiagnostics.CreateScope("DataLakeStoreTrustedIdProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeStoreTrustedIdProviderTrustedIdProvidersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedIdProviderName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreTrustedIdProviderResource(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.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName} + /// + /// + /// Operation Id + /// TrustedIdProviders_Get + /// + /// + /// + /// The name of the trusted identity provider to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string trustedIdProviderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(trustedIdProviderName, nameof(trustedIdProviderName)); + + using var scope = _dataLakeStoreTrustedIdProviderTrustedIdProvidersClientDiagnostics.CreateScope("DataLakeStoreTrustedIdProviderCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeStoreTrustedIdProviderTrustedIdProvidersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedIdProviderName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreTrustedIdProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreVirtualNetworkRuleCollection.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreVirtualNetworkRuleCollection.cs index d01896155678..cb9530871678 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreVirtualNetworkRuleCollection.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreVirtualNetworkRuleCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string virtualNetworkRuleName, Cancellation } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkRules_Get + /// + /// + /// + /// The name of the virtual network rule to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string virtualNetworkRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkRuleName, nameof(virtualNetworkRuleName)); + + using var scope = _dataLakeStoreVirtualNetworkRuleVirtualNetworkRulesClientDiagnostics.CreateScope("DataLakeStoreVirtualNetworkRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataLakeStoreVirtualNetworkRuleVirtualNetworkRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreVirtualNetworkRuleResource(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.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName} + /// + /// + /// Operation Id + /// VirtualNetworkRules_Get + /// + /// + /// + /// The name of the virtual network rule to retrieve. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string virtualNetworkRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkRuleName, nameof(virtualNetworkRuleName)); + + using var scope = _dataLakeStoreVirtualNetworkRuleVirtualNetworkRulesClientDiagnostics.CreateScope("DataLakeStoreVirtualNetworkRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataLakeStoreVirtualNetworkRuleVirtualNetworkRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualNetworkRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataLakeStoreVirtualNetworkRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DataMigrationServiceCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DataMigrationServiceCollection.cs index 07514c84f841..557726c707ee 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DataMigrationServiceCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DataMigrationServiceCollection.cs @@ -126,6 +126,48 @@ public async Task Exists_ServicesCreateOrUpdate() Console.WriteLine($"Succeeded: {result}"); } + // Services_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ServicesCreateOrUpdate() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/Services_Get.json + // this example is just showing the usage of "Services_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 = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + string groupName = "DmsSdkRg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, groupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataMigrationServiceResource + DataMigrationServiceCollection collection = resourceGroupResource.GetDataMigrationServices(); + + // invoke the operation + string serviceName = "DmsSdkService"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + DataMigrationServiceResource 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 + DataMigrationServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Services_ListByResourceGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlDBCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlDBCollection.cs index 10a66a2f6270..b2fd4ca9231f 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlDBCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlDBCollection.cs @@ -87,6 +87,50 @@ public async Task Exists_GetSqlDBDatabaseMigrationWithTheExpandParameter() Console.WriteLine($"Succeeded: {result}"); } + // Get Sql DB database Migration with the expand parameter. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSqlDBDatabaseMigrationWithTheExpandParameter() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/SqlDbGetDatabaseMigrationExpanded.json + // this example is just showing the usage of "DatabaseMigrationsSqlDb_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseMigrationSqlDBResource + DatabaseMigrationSqlDBCollection collection = resourceGroupResource.GetDatabaseMigrationSqlDBs(); + + // invoke the operation + string sqlDBInstanceName = "sqldbinstance"; + string targetDBName = "db1"; + string expand = "MigrationStatusDetails"; + NullableResponse response = await collection.GetIfExistsAsync(sqlDBInstanceName, targetDBName, expand: expand); + DatabaseMigrationSqlDBResource 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 + DatabaseMigrationSqlDBData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Sql DB database Migration without the expand parameter. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -153,6 +197,49 @@ public async Task Exists_GetSqlDBDatabaseMigrationWithoutTheExpandParameter() Console.WriteLine($"Succeeded: {result}"); } + // Get Sql DB database Migration without the expand parameter. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSqlDBDatabaseMigrationWithoutTheExpandParameter() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/SqlDbGetDatabaseMigration.json + // this example is just showing the usage of "DatabaseMigrationsSqlDb_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseMigrationSqlDBResource + DatabaseMigrationSqlDBCollection collection = resourceGroupResource.GetDatabaseMigrationSqlDBs(); + + // invoke the operation + string sqlDBInstanceName = "sqldbinstance"; + string targetDBName = "db1"; + NullableResponse response = await collection.GetIfExistsAsync(sqlDBInstanceName, targetDBName); + DatabaseMigrationSqlDBResource 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 + DatabaseMigrationSqlDBData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Database Migration resource with Maximum parameters. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlMICollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlMICollection.cs index e1eecd77ca75..5d6169a8c111 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlMICollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlMICollection.cs @@ -87,6 +87,50 @@ public async Task Exists_GetSqlMIDatabaseMigrationWithTheExpandParameter() Console.WriteLine($"Succeeded: {result}"); } + // Get Sql MI database Migration with the expand parameter. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSqlMIDatabaseMigrationWithTheExpandParameter() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/SqlMiGetDatabaseMigrationExpanded.json + // this example is just showing the usage of "DatabaseMigrationsSqlMi_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseMigrationSqlMIResource + DatabaseMigrationSqlMICollection collection = resourceGroupResource.GetDatabaseMigrationSqlMIs(); + + // invoke the operation + string managedInstanceName = "managedInstance1"; + string targetDBName = "db1"; + string expand = "MigrationStatusDetails"; + NullableResponse response = await collection.GetIfExistsAsync(managedInstanceName, targetDBName, expand: expand); + DatabaseMigrationSqlMIResource 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 + DatabaseMigrationSqlMIData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Sql MI database Migration without the expand parameter. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -153,6 +197,49 @@ public async Task Exists_GetSqlMIDatabaseMigrationWithoutTheExpandParameter() Console.WriteLine($"Succeeded: {result}"); } + // Get Sql MI database Migration without the expand parameter. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSqlMIDatabaseMigrationWithoutTheExpandParameter() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/SqlMiGetDatabaseMigration.json + // this example is just showing the usage of "DatabaseMigrationsSqlMi_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseMigrationSqlMIResource + DatabaseMigrationSqlMICollection collection = resourceGroupResource.GetDatabaseMigrationSqlMIs(); + + // invoke the operation + string managedInstanceName = "managedInstance1"; + string targetDBName = "db1"; + NullableResponse response = await collection.GetIfExistsAsync(managedInstanceName, targetDBName); + DatabaseMigrationSqlMIResource 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 + DatabaseMigrationSqlMIData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Database Migration resource with Maximum parameters. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlVmCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlVmCollection.cs index 1d6eb2426cc7..5b4b63a20111 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlVmCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_DatabaseMigrationSqlVmCollection.cs @@ -87,6 +87,50 @@ public async Task Exists_GetSqlVMDatabaseMigrationWithTheExpandParameter() Console.WriteLine($"Succeeded: {result}"); } + // Get Sql VM database Migration with the expand parameter. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSqlVMDatabaseMigrationWithTheExpandParameter() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/SqlVmGetDatabaseMigrationExpanded.json + // this example is just showing the usage of "DatabaseMigrationsSqlVm_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseMigrationSqlVmResource + DatabaseMigrationSqlVmCollection collection = resourceGroupResource.GetDatabaseMigrationSqlVms(); + + // invoke the operation + string sqlVirtualMachineName = "testvm"; + string targetDBName = "db1"; + string expand = "MigrationStatusDetails"; + NullableResponse response = await collection.GetIfExistsAsync(sqlVirtualMachineName, targetDBName, expand: expand); + DatabaseMigrationSqlVmResource 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 + DatabaseMigrationSqlVmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Get Sql VM database Migration without the expand parameter. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] @@ -153,6 +197,49 @@ public async Task Exists_GetSqlVMDatabaseMigrationWithoutTheExpandParameter() Console.WriteLine($"Succeeded: {result}"); } + // Get Sql VM database Migration without the expand parameter. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSqlVMDatabaseMigrationWithoutTheExpandParameter() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/SqlVmGetDatabaseMigration.json + // this example is just showing the usage of "DatabaseMigrationsSqlVm_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseMigrationSqlVmResource + DatabaseMigrationSqlVmCollection collection = resourceGroupResource.GetDatabaseMigrationSqlVms(); + + // invoke the operation + string sqlVirtualMachineName = "testvm"; + string targetDBName = "db1"; + NullableResponse response = await collection.GetIfExistsAsync(sqlVirtualMachineName, targetDBName); + DatabaseMigrationSqlVmResource 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 + DatabaseMigrationSqlVmData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update Database Migration resource with Maximum parameters. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ProjectCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ProjectCollection.cs index 0f6886290a48..ee0fdc8b7294 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ProjectCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ProjectCollection.cs @@ -161,5 +161,48 @@ public async Task Exists_ProjectsGet() Console.WriteLine($"Succeeded: {result}"); } + + // Projects_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ProjectsGet() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/Projects_Get.json + // this example is just showing the usage of "Projects_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 DataMigrationServiceResource created on azure + // for more information of creating DataMigrationServiceResource, please refer to the document of DataMigrationServiceResource + string subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + string groupName = "DmsSdkRg"; + string serviceName = "DmsSdkService"; + ResourceIdentifier dataMigrationServiceResourceId = DataMigrationServiceResource.CreateResourceIdentifier(subscriptionId, groupName, serviceName); + DataMigrationServiceResource dataMigrationService = client.GetDataMigrationServiceResource(dataMigrationServiceResourceId); + + // get the collection of this ProjectResource + ProjectCollection collection = dataMigrationService.GetProjects(); + + // invoke the operation + string projectName = "DmsSdkProject"; + NullableResponse response = await collection.GetIfExistsAsync(projectName); + ProjectResource 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 + ProjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ProjectFileCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ProjectFileCollection.cs index ad5925dc374b..94f7b7df3796 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ProjectFileCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ProjectFileCollection.cs @@ -124,6 +124,50 @@ public async Task Exists_FilesList() Console.WriteLine($"Succeeded: {result}"); } + // Files_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_FilesList() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/Files_Get.json + // this example is just showing the usage of "Files_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 ProjectResource created on azure + // for more information of creating ProjectResource, please refer to the document of ProjectResource + string subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + string groupName = "DmsSdkRg"; + string serviceName = "DmsSdkService"; + string projectName = "DmsSdkProject"; + ResourceIdentifier projectResourceId = ProjectResource.CreateResourceIdentifier(subscriptionId, groupName, serviceName, projectName); + ProjectResource project = client.GetProjectResource(projectResourceId); + + // get the collection of this ProjectFileResource + ProjectFileCollection collection = project.GetProjectFiles(); + + // invoke the operation + string fileName = "x114d023d8"; + NullableResponse response = await collection.GetIfExistsAsync(fileName); + ProjectFileResource 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 + ProjectFileData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Files_CreateOrUpdate [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ServiceProjectTaskCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ServiceProjectTaskCollection.cs index a451f9dffbf6..7d59bceb5fba 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ServiceProjectTaskCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ServiceProjectTaskCollection.cs @@ -174,5 +174,49 @@ public async Task Exists_TasksGet() Console.WriteLine($"Succeeded: {result}"); } + + // Tasks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TasksGet() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/Tasks_Get.json + // this example is just showing the usage of "Tasks_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 ProjectResource created on azure + // for more information of creating ProjectResource, please refer to the document of ProjectResource + string subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + string groupName = "DmsSdkRg"; + string serviceName = "DmsSdkService"; + string projectName = "DmsSdkProject"; + ResourceIdentifier projectResourceId = ProjectResource.CreateResourceIdentifier(subscriptionId, groupName, serviceName, projectName); + ProjectResource project = client.GetProjectResource(projectResourceId); + + // get the collection of this ServiceProjectTaskResource + ServiceProjectTaskCollection collection = project.GetServiceProjectTasks(); + + // invoke the operation + string taskName = "DmsSdkTask"; + NullableResponse response = await collection.GetIfExistsAsync(taskName); + ServiceProjectTaskResource 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 + ProjectTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ServiceServiceTaskCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ServiceServiceTaskCollection.cs index 9bb9e3e3799d..8d78c5446658 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ServiceServiceTaskCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_ServiceServiceTaskCollection.cs @@ -163,5 +163,48 @@ public async Task Exists_TasksGet() Console.WriteLine($"Succeeded: {result}"); } + + // Tasks_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TasksGet() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/ServiceTasks_Get.json + // this example is just showing the usage of "ServiceTasks_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 DataMigrationServiceResource created on azure + // for more information of creating DataMigrationServiceResource, please refer to the document of DataMigrationServiceResource + string subscriptionId = "fc04246f-04c5-437e-ac5e-206a19e7193f"; + string groupName = "DmsSdkRg"; + string serviceName = "DmsSdkService"; + ResourceIdentifier dataMigrationServiceResourceId = DataMigrationServiceResource.CreateResourceIdentifier(subscriptionId, groupName, serviceName); + DataMigrationServiceResource dataMigrationService = client.GetDataMigrationServiceResource(dataMigrationServiceResourceId); + + // get the collection of this ServiceServiceTaskResource + ServiceServiceTaskCollection collection = dataMigrationService.GetServiceServiceTasks(); + + // invoke the operation + string taskName = "DmsSdkTask"; + NullableResponse response = await collection.GetIfExistsAsync(taskName); + ServiceServiceTaskResource 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 + ProjectTaskData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } } } diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_SqlMigrationServiceCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_SqlMigrationServiceCollection.cs index 6b9330aa8f7c..cceeafdbffd4 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_SqlMigrationServiceCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/samples/Generated/Samples/Sample_SqlMigrationServiceCollection.cs @@ -82,6 +82,48 @@ public async Task Exists_GetMigrationService() Console.WriteLine($"Succeeded: {result}"); } + // Get Migration Service. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetMigrationService() + { + // Generated from example definition: specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/examples/GetMigrationService.json + // this example is just showing the usage of "SqlMigrationServices_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-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SqlMigrationServiceResource + SqlMigrationServiceCollection collection = resourceGroupResource.GetSqlMigrationServices(); + + // invoke the operation + string sqlMigrationServiceName = "service1"; + NullableResponse response = await collection.GetIfExistsAsync(sqlMigrationServiceName); + SqlMigrationServiceResource 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 + SqlMigrationServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + // Create or Update SQL Migration Service with maximum parameters. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceCollection.cs index a1468cb6b839..486a4e2d3914 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string serviceName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Name of the service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _dataMigrationServiceServicesClientDiagnostics.CreateScope("DataMigrationServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataMigrationServiceServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataMigrationServiceResource(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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Name of the service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var scope = _dataMigrationServiceServicesClientDiagnostics.CreateScope("DataMigrationServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataMigrationServiceServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, serviceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataMigrationServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlDBCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlDBCollection.cs index 2b1e838d77d4..f8f73583e499 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlDBCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlDBCollection.cs @@ -296,5 +296,87 @@ public virtual Response Exists(string sqlDBInstanceName, string targetDBNa throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlDb_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string sqlDBInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlDBInstanceName, nameof(sqlDBInstanceName)); + Argument.AssertNotNullOrEmpty(targetDBName, nameof(targetDBName)); + + using var scope = _databaseMigrationSqlDBDatabaseMigrationsSqlDBClientDiagnostics.CreateScope("DatabaseMigrationSqlDBCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseMigrationSqlDBDatabaseMigrationsSqlDBRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, sqlDBInstanceName, targetDBName, migrationOperationId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseMigrationSqlDBResource(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.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlDb_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string sqlDBInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlDBInstanceName, nameof(sqlDBInstanceName)); + Argument.AssertNotNullOrEmpty(targetDBName, nameof(targetDBName)); + + using var scope = _databaseMigrationSqlDBDatabaseMigrationsSqlDBClientDiagnostics.CreateScope("DatabaseMigrationSqlDBCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseMigrationSqlDBDatabaseMigrationsSqlDBRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, sqlDBInstanceName, targetDBName, migrationOperationId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseMigrationSqlDBResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlMICollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlMICollection.cs index db1ce987ebd0..413f867cc30d 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlMICollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlMICollection.cs @@ -296,5 +296,87 @@ public virtual Response Exists(string managedInstanceName, string targetDB throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlMi_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string managedInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(targetDBName, nameof(targetDBName)); + + using var scope = _databaseMigrationSqlMIDatabaseMigrationsSqlMIClientDiagnostics.CreateScope("DatabaseMigrationSqlMICollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseMigrationSqlMIDatabaseMigrationsSqlMIRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, managedInstanceName, targetDBName, migrationOperationId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseMigrationSqlMIResource(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.Sql/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlMi_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string managedInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(targetDBName, nameof(targetDBName)); + + using var scope = _databaseMigrationSqlMIDatabaseMigrationsSqlMIClientDiagnostics.CreateScope("DatabaseMigrationSqlMICollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseMigrationSqlMIDatabaseMigrationsSqlMIRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, managedInstanceName, targetDBName, migrationOperationId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseMigrationSqlMIResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlVmCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlVmCollection.cs index c604007905e2..19f9726bd097 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlVmCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlVmCollection.cs @@ -296,5 +296,87 @@ public virtual Response Exists(string sqlVirtualMachineName, string target throw; } } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlVm_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetIfExistsAsync(string sqlVirtualMachineName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlVirtualMachineName, nameof(sqlVirtualMachineName)); + Argument.AssertNotNullOrEmpty(targetDBName, nameof(targetDBName)); + + using var scope = _databaseMigrationSqlVmDatabaseMigrationsSqlVmClientDiagnostics.CreateScope("DatabaseMigrationSqlVmCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseMigrationSqlVmDatabaseMigrationsSqlVmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, sqlVirtualMachineName, targetDBName, migrationOperationId, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseMigrationSqlVmResource(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.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlVm_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual NullableResponse GetIfExists(string sqlVirtualMachineName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlVirtualMachineName, nameof(sqlVirtualMachineName)); + Argument.AssertNotNullOrEmpty(targetDBName, nameof(targetDBName)); + + using var scope = _databaseMigrationSqlVmDatabaseMigrationsSqlVmClientDiagnostics.CreateScope("DatabaseMigrationSqlVmCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseMigrationSqlVmDatabaseMigrationsSqlVmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, sqlVirtualMachineName, targetDBName, migrationOperationId, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseMigrationSqlVmResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectCollection.cs index 024e4bcc940e..a3a304b6fa9b 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string projectName, CancellationToken cance } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName} + /// + /// + /// Operation Id + /// Projects_Get + /// + /// + /// + /// Name of the project. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using var scope = _projectClientDiagnostics.CreateScope("ProjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _projectRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, projectName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProjectResource(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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName} + /// + /// + /// Operation Id + /// Projects_Get + /// + /// + /// + /// Name of the project. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using var scope = _projectClientDiagnostics.CreateScope("ProjectCollection.GetIfExists"); + scope.Start(); + try + { + var response = _projectRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, projectName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProjectResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectFileCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectFileCollection.cs index 1c09f82cc797..e1871ea21632 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectFileCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectFileCollection.cs @@ -323,6 +323,80 @@ public virtual Response Exists(string fileName, CancellationToken cancella } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/files/{fileName} + /// + /// + /// Operation Id + /// Files_Get + /// + /// + /// + /// Name of the File. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string fileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + using var scope = _projectFileFilesClientDiagnostics.CreateScope("ProjectFileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _projectFileFilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, fileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProjectFileResource(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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/files/{fileName} + /// + /// + /// Operation Id + /// Files_Get + /// + /// + /// + /// Name of the File. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fileName, nameof(fileName)); + + using var scope = _projectFileFilesClientDiagnostics.CreateScope("ProjectFileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _projectFileFilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, fileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProjectFileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceProjectTaskCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceProjectTaskCollection.cs index c4dde59e6b8c..7b0a25abf0d4 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceProjectTaskCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceProjectTaskCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string taskName, string expand = null, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_Get + /// + /// + /// + /// Name of the Task. + /// Expand the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string taskName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _serviceProjectTaskTasksClientDiagnostics.CreateScope("ServiceProjectTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceProjectTaskTasksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, taskName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceProjectTaskResource(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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_Get + /// + /// + /// + /// Name of the Task. + /// Expand the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string taskName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _serviceProjectTaskTasksClientDiagnostics.CreateScope("ServiceProjectTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceProjectTaskTasksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, taskName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceProjectTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceServiceTaskCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceServiceTaskCollection.cs index d0d40c867d0d..1e9a3a68c06b 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceServiceTaskCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceServiceTaskCollection.cs @@ -329,6 +329,82 @@ public virtual Response Exists(string taskName, string expand = null, Canc } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/serviceTasks/{taskName} + /// + /// + /// Operation Id + /// ServiceTasks_Get + /// + /// + /// + /// Name of the Task. + /// Expand the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string taskName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _serviceServiceTaskServiceTasksClientDiagnostics.CreateScope("ServiceServiceTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceServiceTaskServiceTasksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceServiceTaskResource(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/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/serviceTasks/{taskName} + /// + /// + /// Operation Id + /// ServiceTasks_Get + /// + /// + /// + /// Name of the Task. + /// Expand the response. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string taskName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskName, nameof(taskName)); + + using var scope = _serviceServiceTaskServiceTasksClientDiagnostics.CreateScope("ServiceServiceTaskCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceServiceTaskServiceTasksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskName, expand, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceServiceTaskResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/SqlMigrationServiceCollection.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/SqlMigrationServiceCollection.cs index 7575e17535a2..54b4182b6314 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/SqlMigrationServiceCollection.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/SqlMigrationServiceCollection.cs @@ -324,6 +324,80 @@ public virtual Response Exists(string sqlMigrationServiceName, Cancellatio } } + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices/{sqlMigrationServiceName} + /// + /// + /// Operation Id + /// SqlMigrationServices_Get + /// + /// + /// + /// Name of the SQL Migration Service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sqlMigrationServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlMigrationServiceName, nameof(sqlMigrationServiceName)); + + using var scope = _sqlMigrationServiceClientDiagnostics.CreateScope("SqlMigrationServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sqlMigrationServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, sqlMigrationServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlMigrationServiceResource(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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName} + /// + /// + /// Operation Id + /// SqlMigrationServices_Get + /// + /// + /// + /// Name of the SQL Migration Service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sqlMigrationServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sqlMigrationServiceName, nameof(sqlMigrationServiceName)); + + using var scope = _sqlMigrationServiceClientDiagnostics.CreateScope("SqlMigrationServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sqlMigrationServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, sqlMigrationServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SqlMigrationServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator();